mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-15 13:36:00 +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 HomebrewAdmin = require('./homebrewAdmin/homebrewAdmin.jsx');
|
||||
|
||||
|
||||
const BrewLookup = require('./brewLookup/brewLookup.jsx');
|
||||
|
||||
const AdminSearch = require('./adminSearch/adminSearch.jsx');
|
||||
const InvalidBrew = require('./invalidBrew/invalidBrew.jsx');
|
||||
|
||||
const Admin = React.createClass({
|
||||
getDefaultProps: function() {
|
||||
@@ -31,10 +29,11 @@ const Admin = React.createClass({
|
||||
{this.renderNavbar()}
|
||||
<main className='content'>
|
||||
<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>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
@import 'naturalcrit/styles/core.less';
|
||||
|
||||
@import 'naturalcrit/styles/core.less';
|
||||
html,body, #reactRoot{
|
||||
min-height : 100%;
|
||||
}
|
||||
|
||||
body{
|
||||
background-color : #ddd;
|
||||
font-family : 'Open Sans', sans-serif;
|
||||
color : #4b5055;
|
||||
font-weight : 100;
|
||||
text-rendering : optimizeLegibility;
|
||||
height : 100%;
|
||||
margin : 0;
|
||||
padding : 0;
|
||||
height : 100%;
|
||||
background-color : #ddd;
|
||||
font-family : 'Open Sans', sans-serif;
|
||||
font-weight : 100;
|
||||
color : #4b5055;
|
||||
text-rendering : optimizeLegibility;
|
||||
}
|
||||
|
||||
.admin {
|
||||
nav {
|
||||
background-color: @red;
|
||||
background-color : @red;
|
||||
.navItem{
|
||||
background-color: @red;
|
||||
background-color : @red;
|
||||
}
|
||||
.homebreweryLogo{
|
||||
font-family : CodeBold;
|
||||
@@ -31,19 +29,25 @@ body{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
h1{
|
||||
font-size: 2em;
|
||||
font-weight: 800;
|
||||
border-bottom: 1px solid #ddd;
|
||||
margin-bottom: 10px;
|
||||
margin-bottom : 10px;
|
||||
font-size : 2em;
|
||||
font-weight : 800;
|
||||
border-bottom : 1px solid #ddd;
|
||||
}
|
||||
|
||||
|
||||
main.content{
|
||||
background-color: white;
|
||||
padding: 50px 20px;
|
||||
width : 1000px;
|
||||
margin: 0 auto;
|
||||
margin : 0 auto;
|
||||
padding : 50px 20px;
|
||||
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');
|
||||
|
||||
router.get('/admin', mw.adminLogin, (req, res, next) => {
|
||||
console.log('yo');
|
||||
return vitreumRender('admin', templateFn, {
|
||||
url : req.originalUrl,
|
||||
admin_key : config.get('admin:key')
|
||||
@@ -30,4 +29,26 @@ router.delete('/admin/invalid', mw.adminOnly, (req, res, 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;
|
||||
Reference in New Issue
Block a user