mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-15 11:25:58 +00:00
Adding in lookup route
This commit is contained in:
@@ -3,11 +3,9 @@ const _ = require('lodash');
|
|||||||
|
|
||||||
const Nav = require('naturalcrit/nav/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
|
|
||||||
//const HomebrewAdmin = require('./homebrewAdmin/homebrewAdmin.jsx');
|
|
||||||
|
|
||||||
|
|
||||||
const BrewLookup = require('./brewLookup/brewLookup.jsx');
|
const BrewLookup = require('./brewLookup/brewLookup.jsx');
|
||||||
|
const AdminSearch = require('./adminSearch/adminSearch.jsx');
|
||||||
|
const InvalidBrew = require('./invalidBrew/invalidBrew.jsx');
|
||||||
|
|
||||||
const Admin = React.createClass({
|
const Admin = React.createClass({
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
@@ -31,10 +29,11 @@ const Admin = React.createClass({
|
|||||||
{this.renderNavbar()}
|
{this.renderNavbar()}
|
||||||
<main className='content'>
|
<main className='content'>
|
||||||
<BrewLookup adminKey={this.props.admin_key} />
|
<BrewLookup adminKey={this.props.admin_key} />
|
||||||
|
<AdminSearch adminKey={this.props.admin_key} />
|
||||||
|
|
||||||
Test
|
<div className='dangerZone'>Danger Zone</div>
|
||||||
|
|
||||||
|
|
||||||
|
<InvalidBrew adminKey={this.props.admin_key} />
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,23 @@
|
|||||||
@import 'naturalcrit/styles/core.less';
|
|
||||||
|
|
||||||
|
@import 'naturalcrit/styles/core.less';
|
||||||
html,body, #reactRoot{
|
html,body, #reactRoot{
|
||||||
min-height : 100%;
|
min-height : 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
body{
|
body{
|
||||||
background-color : #ddd;
|
height : 100%;
|
||||||
font-family : 'Open Sans', sans-serif;
|
|
||||||
color : #4b5055;
|
|
||||||
font-weight : 100;
|
|
||||||
text-rendering : optimizeLegibility;
|
|
||||||
margin : 0;
|
margin : 0;
|
||||||
padding : 0;
|
padding : 0;
|
||||||
height : 100%;
|
background-color : #ddd;
|
||||||
|
font-family : 'Open Sans', sans-serif;
|
||||||
|
font-weight : 100;
|
||||||
|
color : #4b5055;
|
||||||
|
text-rendering : optimizeLegibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin {
|
.admin {
|
||||||
nav {
|
nav {
|
||||||
background-color: @red;
|
background-color : @red;
|
||||||
.navItem{
|
.navItem{
|
||||||
background-color: @red;
|
background-color : @red;
|
||||||
}
|
}
|
||||||
.homebreweryLogo{
|
.homebreweryLogo{
|
||||||
font-family : CodeBold;
|
font-family : CodeBold;
|
||||||
@@ -31,19 +29,25 @@ body{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h1{
|
h1{
|
||||||
font-size: 2em;
|
margin-bottom : 10px;
|
||||||
font-weight: 800;
|
font-size : 2em;
|
||||||
border-bottom: 1px solid #ddd;
|
font-weight : 800;
|
||||||
margin-bottom: 10px;
|
border-bottom : 1px solid #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
main.content{
|
main.content{
|
||||||
background-color: white;
|
width : 1000px;
|
||||||
padding: 50px 20px;
|
margin : 0 auto;
|
||||||
width : 1000px;
|
padding : 50px 20px;
|
||||||
margin: 0 auto;
|
background-color : white;
|
||||||
|
.dangerZone{
|
||||||
|
margin : 30px 0px;
|
||||||
|
padding : 10px 20px;
|
||||||
|
background : repeating-linear-gradient(45deg, @yellow, @yellow 10px, darken(#333, 10%) 10px, darken(#333, 10%) 20px);
|
||||||
|
font-size : 1em;
|
||||||
|
font-weight : 800;
|
||||||
|
color : white;
|
||||||
|
text-transform : uppercase;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,6 @@ const mw = require('./middleware.js');
|
|||||||
const BrewData = require('./brew.data.js');
|
const BrewData = require('./brew.data.js');
|
||||||
|
|
||||||
router.get('/admin', mw.adminLogin, (req, res, next) => {
|
router.get('/admin', mw.adminLogin, (req, res, next) => {
|
||||||
console.log('yo');
|
|
||||||
return vitreumRender('admin', templateFn, {
|
return vitreumRender('admin', templateFn, {
|
||||||
url : req.originalUrl,
|
url : req.originalUrl,
|
||||||
admin_key : config.get('admin:key')
|
admin_key : config.get('admin:key')
|
||||||
@@ -30,4 +29,26 @@ router.delete('/admin/invalid', mw.adminOnly, (req, res, next)=>{
|
|||||||
.catch(next);
|
.catch(next);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.get('/admin/lookup/:search', (req, res) => {
|
||||||
|
//search for mathcing edit id
|
||||||
|
//search for matching share id
|
||||||
|
// search for partial match
|
||||||
|
|
||||||
|
BrewData.get({editId : req.params.search})
|
||||||
|
.then((brew) => {
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
BrewData.get({ $or:[
|
||||||
|
{editId : { "$regex": req.params.search, "$options": "i" }},
|
||||||
|
{shareId : { "$regex": req.params.search, "$options": "i" }},
|
||||||
|
]})
|
||||||
|
.then((brews) => {
|
||||||
|
console.log(brews);
|
||||||
|
return res.json(brews);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
Reference in New Issue
Block a user