1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-12 23:45:57 +00:00

Fixed a bug with saving while not logged in

This commit is contained in:
Scott Tolksdorf
2016-11-27 18:55:50 -05:00
parent 30942785d1
commit a634b76117
9 changed files with 37 additions and 32 deletions

View File

@@ -102,6 +102,7 @@ const MetadataEditor = React.createClass({
},
render : function(){
console.log(this.props.metadata);
return <div className='metadataEditor'>
<div className='field title'>
<label>title</label>

View File

@@ -20,6 +20,7 @@ const Homebrew = React.createClass({
welcomeText : '',
changelog : '',
version : '0.0.0',
account : null,
brew : {
title : '',
text : '',

View File

@@ -1,19 +1,16 @@
@import 'naturalcrit/styles/core.less';
.homebrew{
height : 100%;
height : 100%;
.page{
display : flex;
height : 100%;
display : flex;
height : 100%;
background-color : @steel;
flex-direction : column;
flex-direction : column;
.content{
position : relative;
height : calc(~"100% - 29px"); //Navbar height
flex : auto;
}
}
}

View File

@@ -4,7 +4,7 @@ const Nav = require('naturalcrit/nav/nav.jsx');
module.exports = function(props){
if(global.account){
return <Nav.item href={`/user/${global.account.username}`} color='yellow' icon='fa-user'>
profile
{global.account.username}
</Nav.item>
}
let url = '';

View File

@@ -9,6 +9,13 @@ const RecentNavItem = require('../../navbar/recent.navitem.jsx');
const Account = require('../../navbar/account.navitem.jsx');
const BrewItem = require('./brewItem/brewItem.jsx');
const brew = {
title : 'test',
authors : []
}
//const BREWS = _.times(25, ()=>{ return brew});
const UserPage = React.createClass({
getDefaultProps: function() {

View File

@@ -1,9 +1,4 @@
html, body, #reactContainer, .homebrew, .page {
height : auto;
min-height : 100vh;
}
.noColumns(){
column-count : auto;
column-fill : auto;
@@ -16,21 +11,22 @@ html, body, #reactContainer, .homebrew, .page {
-webkit-column-gap : auto;
-moz-column-gap : auto;
}
.userPage{
.content .phb{
min-height : 350px;
margin : 20px auto;
height : auto;
.noColumns();
&::after{
display : none;
}
.noBrews{
margin: 10px 0px;
font-style: italic;
font-size: 1.3em;
.content{
overflow-y : scroll;
.phb{
.noColumns();
height : auto;
min-height : 350px;
margin : 20px auto;
&::after{
display : none;
}
.noBrews{
margin : 10px 0px;
font-size : 1.3em;
font-style : italic;
}
}
}
}

View File

@@ -1,7 +1,7 @@
{
"name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown",
"version": "2.5.1",
"version": "2.5.2",
"scripts": {
"build": "node_modules/.bin/gulp prod",
"watch": "node_modules/.bin/gulp",

View File

@@ -63,7 +63,6 @@ app.get('/user/:username', (req, res, next) => {
.then((brews) => {
req.brews = brews;
return next();
//return res.json(brews)
})
.catch((err) => {
console.log(err);

View File

@@ -37,9 +37,13 @@ const getGoodBrewTitle = (text) => {
router.post('/api', (req, res)=>{
let authors = [];
if(req.account) authors = [req.account.username];
const newHomebrew = new HomebrewModel(_.merge({},
req.body,
{authors : [req.account.username]}
{authors : authors}
));
if(!newHomebrew.title){
newHomebrew.title = getGoodBrewTitle(newHomebrew.text);
@@ -58,7 +62,7 @@ router.put('/api/update/:id', (req, res)=>{
.then((brew)=>{
brew = _.merge(brew, req.body);
brew.updatedAt = new Date();
brew.authors = _.uniq(_.concat(brew.authors, req.account.username));
if(req.account) brew.authors = _.uniq(_.concat(brew.authors, req.account.username));
brew.save((err, obj)=>{
if(err) throw err;
return res.status(200).send(obj);