mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-15 23:15:58 +00:00
Fixed a bug with saving while not logged in
This commit is contained in:
@@ -102,6 +102,7 @@ const MetadataEditor = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render : function(){
|
render : function(){
|
||||||
|
console.log(this.props.metadata);
|
||||||
return <div className='metadataEditor'>
|
return <div className='metadataEditor'>
|
||||||
<div className='field title'>
|
<div className='field title'>
|
||||||
<label>title</label>
|
<label>title</label>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const Homebrew = React.createClass({
|
|||||||
welcomeText : '',
|
welcomeText : '',
|
||||||
changelog : '',
|
changelog : '',
|
||||||
version : '0.0.0',
|
version : '0.0.0',
|
||||||
|
account : null,
|
||||||
brew : {
|
brew : {
|
||||||
title : '',
|
title : '',
|
||||||
text : '',
|
text : '',
|
||||||
|
|||||||
@@ -1,19 +1,16 @@
|
|||||||
|
|
||||||
@import 'naturalcrit/styles/core.less';
|
@import 'naturalcrit/styles/core.less';
|
||||||
.homebrew{
|
.homebrew{
|
||||||
height : 100%;
|
height : 100%;
|
||||||
|
|
||||||
.page{
|
.page{
|
||||||
display : flex;
|
display : flex;
|
||||||
height : 100%;
|
height : 100%;
|
||||||
background-color : @steel;
|
background-color : @steel;
|
||||||
flex-direction : column;
|
flex-direction : column;
|
||||||
.content{
|
.content{
|
||||||
position : relative;
|
position : relative;
|
||||||
height : calc(~"100% - 29px"); //Navbar height
|
height : calc(~"100% - 29px"); //Navbar height
|
||||||
flex : auto;
|
flex : auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ const Nav = require('naturalcrit/nav/nav.jsx');
|
|||||||
module.exports = function(props){
|
module.exports = function(props){
|
||||||
if(global.account){
|
if(global.account){
|
||||||
return <Nav.item href={`/user/${global.account.username}`} color='yellow' icon='fa-user'>
|
return <Nav.item href={`/user/${global.account.username}`} color='yellow' icon='fa-user'>
|
||||||
profile
|
{global.account.username}
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
}
|
}
|
||||||
let url = '';
|
let url = '';
|
||||||
|
|||||||
@@ -9,6 +9,13 @@ const RecentNavItem = require('../../navbar/recent.navitem.jsx');
|
|||||||
const Account = require('../../navbar/account.navitem.jsx');
|
const Account = require('../../navbar/account.navitem.jsx');
|
||||||
const BrewItem = require('./brewItem/brewItem.jsx');
|
const BrewItem = require('./brewItem/brewItem.jsx');
|
||||||
|
|
||||||
|
const brew = {
|
||||||
|
title : 'test',
|
||||||
|
authors : []
|
||||||
|
}
|
||||||
|
|
||||||
|
//const BREWS = _.times(25, ()=>{ return brew});
|
||||||
|
|
||||||
|
|
||||||
const UserPage = React.createClass({
|
const UserPage = React.createClass({
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
|
|
||||||
html, body, #reactContainer, .homebrew, .page {
|
|
||||||
height : auto;
|
|
||||||
min-height : 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.noColumns(){
|
.noColumns(){
|
||||||
column-count : auto;
|
column-count : auto;
|
||||||
column-fill : auto;
|
column-fill : auto;
|
||||||
@@ -16,21 +11,22 @@ html, body, #reactContainer, .homebrew, .page {
|
|||||||
-webkit-column-gap : auto;
|
-webkit-column-gap : auto;
|
||||||
-moz-column-gap : auto;
|
-moz-column-gap : auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.userPage{
|
.userPage{
|
||||||
.content .phb{
|
.content{
|
||||||
min-height : 350px;
|
overflow-y : scroll;
|
||||||
margin : 20px auto;
|
.phb{
|
||||||
height : auto;
|
.noColumns();
|
||||||
.noColumns();
|
height : auto;
|
||||||
&::after{
|
min-height : 350px;
|
||||||
display : none;
|
margin : 20px auto;
|
||||||
}
|
&::after{
|
||||||
|
display : none;
|
||||||
.noBrews{
|
}
|
||||||
margin: 10px 0px;
|
.noBrews{
|
||||||
font-style: italic;
|
margin : 10px 0px;
|
||||||
font-size: 1.3em;
|
font-size : 1.3em;
|
||||||
|
font-style : italic;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "homebrewery",
|
"name": "homebrewery",
|
||||||
"description": "Create authentic looking D&D homebrews using only markdown",
|
"description": "Create authentic looking D&D homebrews using only markdown",
|
||||||
"version": "2.5.1",
|
"version": "2.5.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node_modules/.bin/gulp prod",
|
"build": "node_modules/.bin/gulp prod",
|
||||||
"watch": "node_modules/.bin/gulp",
|
"watch": "node_modules/.bin/gulp",
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ app.get('/user/:username', (req, res, next) => {
|
|||||||
.then((brews) => {
|
.then((brews) => {
|
||||||
req.brews = brews;
|
req.brews = brews;
|
||||||
return next();
|
return next();
|
||||||
//return res.json(brews)
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|||||||
@@ -37,9 +37,13 @@ const getGoodBrewTitle = (text) => {
|
|||||||
|
|
||||||
|
|
||||||
router.post('/api', (req, res)=>{
|
router.post('/api', (req, res)=>{
|
||||||
|
|
||||||
|
let authors = [];
|
||||||
|
if(req.account) authors = [req.account.username];
|
||||||
|
|
||||||
const newHomebrew = new HomebrewModel(_.merge({},
|
const newHomebrew = new HomebrewModel(_.merge({},
|
||||||
req.body,
|
req.body,
|
||||||
{authors : [req.account.username]}
|
{authors : authors}
|
||||||
));
|
));
|
||||||
if(!newHomebrew.title){
|
if(!newHomebrew.title){
|
||||||
newHomebrew.title = getGoodBrewTitle(newHomebrew.text);
|
newHomebrew.title = getGoodBrewTitle(newHomebrew.text);
|
||||||
@@ -58,7 +62,7 @@ router.put('/api/update/:id', (req, res)=>{
|
|||||||
.then((brew)=>{
|
.then((brew)=>{
|
||||||
brew = _.merge(brew, req.body);
|
brew = _.merge(brew, req.body);
|
||||||
brew.updatedAt = new Date();
|
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)=>{
|
brew.save((err, obj)=>{
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
return res.status(200).send(obj);
|
return res.status(200).send(obj);
|
||||||
|
|||||||
Reference in New Issue
Block a user