post submission bug fixes, styles fixes for nav section

sql-version-freeze
Ro 6 years ago
parent 5decfa92e2
commit 57684e7a27

@ -110,7 +110,8 @@ router.post('/sync', (req, res) => {
} }
}); });
}); });
router.get('/json', function(req, res) { router.get('/json/:filter?', function(req, res) {
var filter = req.params.filter;
Models.FreshPost.findAll({ Models.FreshPost.findAll({
order: [['id', 'DESC']] order: [['id', 'DESC']]
}) })
@ -118,10 +119,18 @@ router.get('/json', function(req, res) {
let newlist = []; let newlist = [];
for (let index = 0; index < posts.length; index++) { for (let index = 0; index < posts.length; index++) {
let item = posts[index].post; let item = posts[index].post;
if (typeof item.deleted == 'undefined' || item.deleted == false) { switch (filter) {
newlist.push(posts[index]); case 'not-deleted':
} else { if (typeof item.deleted == 'undefined' || item.deleted == false) {
continue; newlist.push(posts[index]);
} else {
continue;
}
break;
default:
newlist.push(posts[index]);
break;
} }
} }
res.json(newlist); res.json(newlist);

@ -1,44 +1,44 @@
var express = require('express'); var express = require('express');
var path = require('path'); var path = require('path');
var favicon = require('serve-favicon'); //var favicon = require('serve-favicon');
var logger = require('morgan'); var logger = require('morgan');
var cookieParser = require('cookie-parser'); var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser'); var bodyParser = require('body-parser');
var session = require('express-session'); var session = require('express-session');
var MemoryStore = require('memorystore')(session) var MemoryStore = require('memorystore')(session);
var flash = require('connect-flash'); var flash = require('connect-flash');
var theme = "default-dark"; var theme = 'default-dark';
var app = express(); var app = express();
var request = require('request'); //var request = require('request');
// view engine setup // view engine setup
app.set('views', path.join(__dirname, '../themes')); app.set('views', path.join(__dirname, '../themes'));
app.set('view engine', 'pug'); app.set('view engine', 'pug');
app.use(express.static(__dirname + '../content/folio-images')); app.use(express.static(__dirname + '../content/folio-images'));
app.use(logger('dev')); app.use(logger('dev'));
app.use(bodyParser.json({limit: '50mb'})); app.use(bodyParser.json({ limit: '50mb' }));
app.use(bodyParser.urlencoded( app.use(
{ bodyParser.urlencoded({
extended: false, extended: false,
limit: '50mb' limit: '50mb'
})); })
);
app.use(cookieParser()); app.use(cookieParser());
app.use(express.static(path.join(__dirname, '../content'))); app.use(express.static(path.join(__dirname, '../content')));
app.use(express.static(path.join(__dirname, '../themes'))); app.use(express.static(path.join(__dirname, '../themes')));
app.use(session( app.use(
{ session({
store: new MemoryStore( store: new MemoryStore({
{ checkPeriod: 86400000 // prune expired entries every 24h
checkPeriod: 86400000 // prune expired entries every 24h }),
}), secret: '1KqZ18W8KskE1iSw',
secret: '1KqZ18W8KskE1iSw', saveUninitialized: false,
saveUninitialized: false, resave: false,
resave: false, cookie: {
cookie: maxAge: 608800000
{ }
maxAge: 608800000 })
} );
}))
app.use(flash()); app.use(flash());
//sections //sections
var front = require('./routes/front/index')(session); var front = require('./routes/front/index')(session);
@ -63,37 +63,30 @@ app.use('/@/dashboard/settings', settingsDashboard);
app.use('/@/dashboard/navigation', navDashboard); app.use('/@/dashboard/navigation', navDashboard);
//app.use('/mailer', mailer); //app.use('/mailer', mailer);
// catch 404 and forward to error handler // catch 404 and forward to error handler
app.use(function(req, res, next) app.use(function(req, res, next) {
{ var err = new Error('Not Found');
var err = new Error('Not Found'); err.status = 404;
err.status = 404; next(err);
next(err);
}); });
// error handlers // error handlers
// development error handler // development error handler
// will print stacktrace // will print stacktrace
if (app.get('env') === 'development') if (app.get('env') === 'development') {
{ app.use(function(err, req, res) {
app.use(function(err, req, res, next) res.status(err.status || 500);
{ res.render(theme + '/error', {
res.status(err.status || 500); message: err.message,
res.render(theme + '/error', error: err
{ });
message: err.message, });
error: err
});
});
} }
// production error handler // production error handler
// no stacktraces leaked to user // no stacktraces leaked to user
app.use(function(err, req, res, next) app.use(function(err, req, res) {
{ res.status(err.status || 500);
res.status(err.status || 500); res.render(theme + '/error', {
res.render(theme + '/error', message: err.message,
{ error: {}
message: err.message, });
error:
{}
});
}); });
module.exports = app; module.exports = app;

@ -66,7 +66,9 @@ router.get('/', function(req, res) {
} }
res.render('dash/navigation', { res.render('dash/navigation', {
pages: pages, pages: pages,
title: 'Dashboard | Global Nav' welcome: 'Edit Navigation',
user_status: true,
title: 'Dashboard | Navigation'
}); });
}) })
.catch(() => { .catch(() => {

@ -81,7 +81,9 @@ router.get('/:page?', function(req, res) {
router.get('/add/new', function(req, res) { router.get('/add/new', function(req, res) {
if (req.session.user) { if (req.session.user) {
res.render('dash/post-edit', { res.render('dash/post-edit', {
title: 'Make New Post', title: 'Dashboard New Post',
user_status: true,
welcome: 'New Post',
mode: 'admin', mode: 'admin',
date: date:
dateUtils.getDate('year', new Date()) + dateUtils.getDate('year', new Date()) +
@ -124,6 +126,8 @@ router.get('/edit/:id', function(req, res) {
res.render('dash/post-edit', { res.render('dash/post-edit', {
id: item.id, id: item.id,
title: 'Edit Post', title: 'Edit Post',
user_status: true,
welcome: 'Edit Post',
mode: 'admin', mode: 'admin',
post: item.post, post: item.post,
date: sexydate, date: sexydate,

@ -55,6 +55,8 @@ router.get('/', function(req, res) {
}); });
res.render('dash/settings', { res.render('dash/settings', {
title: 'Dashboard | Settings', title: 'Dashboard | Settings',
welcome: 'Your Settings',
user_status: true,
themes: themes, themes: themes,
settings: settings, settings: settings,
member: memberInfo[0] member: memberInfo[0]

@ -12,8 +12,9 @@ router.get('/', function(req, res) {
order: [['id', 'DESC']] order: [['id', 'DESC']]
}) })
.then(function(posts) { .then(function(posts) {
let title = 'Fipamo Admin'; let title = 'Fipamo Dashboard';
let welcome = ''(!loggedIn) let welcome = '';
!loggedIn
? (welcome = 'Hello.') ? (welcome = 'Hello.')
: (welcome = 'Welcome back, ' + req.session.user.handle); : (welcome = 'Welcome back, ' + req.session.user.handle);
let filtered = []; let filtered = [];

@ -70,16 +70,16 @@ function onError(error) {
throw error; throw error;
} }
var bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port; //var bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port;
// handle specific listen errors with friendly messages // handle specific listen errors with friendly messages
switch (error.code) { switch (error.code) {
case 'EACCES': case 'EACCES':
console.error(bind + ' requires elevated privileges'); //console.error(bind + ' requires elevated privileges');
process.exit(1); process.exit(1);
break; break;
case 'EADDRINUSE': case 'EADDRINUSE':
console.error(bind + ' is already in use'); //console.error(bind + ' is already in use');
process.exit(1); process.exit(1);
break; break;
default: default:

@ -2,7 +2,7 @@
------------------------------- -------------------------------
-- Bulma -- Bulma
------------------------------- -------------------------------
**/ * */
@-moz-keyframes spinAround { @-moz-keyframes spinAround {
from { from {
transform: rotate(0deg); transform: rotate(0deg);
@ -1263,17 +1263,17 @@
------------------------------- -------------------------------
-- Colors -- Colors
------------------------------- -------------------------------
**/ * */
/** /**
------------------------------- -------------------------------
-- Mixins -- Mixins
------------------------------- -------------------------------
**/ * */
/** /**
------------------------------- -------------------------------
-- Normalize -- Normalize
------------------------------- -------------------------------
**/ * */
html { html {
line-height: 1.15; line-height: 1.15;
-ms-text-size-adjust: 100%; -ms-text-size-adjust: 100%;
@ -1475,7 +1475,7 @@ template {
------------------------------- -------------------------------
-- Typography -- Typography
------------------------------- -------------------------------
**/ * */
@font-face { @font-face {
font-weight: 300; font-weight: 300;
font-style: normal; font-style: normal;
@ -1553,7 +1553,7 @@ h3 {
------------------------------- -------------------------------
-- Main Structure -- Main Structure
------------------------------- -------------------------------
**/ * */
html, html,
body { body {
background-color: #161d23; background-color: #161d23;
@ -1729,7 +1729,7 @@ svg.icons {
------------------------------- -------------------------------
-- Index -- Index
------------------------------- -------------------------------
**/ * */
#dash-index-content { #dash-index-content {
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -1889,7 +1889,7 @@ svg.icons {
------------------------------- -------------------------------
-- Settings -- Settings
------------------------------- -------------------------------
**/ * */
#site-background { #site-background {
margin: 0 0 10px 0; margin: 0 0 10px 0;
} }
@ -1921,7 +1921,7 @@ svg.icons {
} }
#settings-index #settings-index-wrapper button { #settings-index #settings-index-wrapper button {
margin-top: 5px; margin-top: 5px;
width: 320px; width: 100%;
height: 45px; height: 45px;
} }
#settings-index #settings-index-wrapper #member-settings, #settings-index #settings-index-wrapper #member-settings,
@ -2040,7 +2040,7 @@ svg.icons {
------------------------------- -------------------------------
-- Navigation -- Navigation
------------------------------- -------------------------------
**/ * */
#nav-index { #nav-index {
width: 100%; width: 100%;
max-width: 900px; max-width: 900px;
@ -2049,12 +2049,12 @@ svg.icons {
#nav-index #nav-index-wrapper { #nav-index #nav-index-wrapper {
padding: 0.75rem; padding: 0.75rem;
} }
#nav-index #nav-index-wrapper #nav-pages div.nav-item { #nav-index #nav-index-wrapper #nav-pages .nav-item {
display: block; display: block;
width: 100%; width: 98%;
background: #161d23; background: #374857;
border-radius: 3px; border-radius: 3px;
color: #b2cce5; color: #f2f1ef;
height: 30px; height: 30px;
padding: 10px; padding: 10px;
margin: 0 0 10px 0; margin: 0 0 10px 0;
@ -2079,7 +2079,7 @@ svg.icons {
------------------------------- -------------------------------
-- Forms -- Forms
------------------------------- -------------------------------
**/ * */
form { form {
display: inline-block; display: inline-block;
} }
@ -2140,7 +2140,7 @@ select {
------------------------------- -------------------------------
-- Blog -- Blog
------------------------------- -------------------------------
**/ * */
#post-index { #post-index {
width: 100%; width: 100%;
max-width: 900px; max-width: 900px;
@ -2669,7 +2669,7 @@ select {
------------------------------- -------------------------------
-- Editor -- Editor
------------------------------- -------------------------------
**/ * */
#edit-control { #edit-control {
top: 1px; top: 1px;
border-radius: 3px; border-radius: 3px;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -27,8 +27,8 @@
svg#submit-error.icon-hide(viewBox="0 0 20 20" class="icons") svg#submit-error.icon-hide(viewBox="0 0 20 20" class="icons")
use(xlink:href='/dash/assets/images/sprite.svg#entypo-thumbs-down') use(xlink:href='/dash/assets/images/sprite.svg#entypo-thumbs-down')
button#edit-delete.content-editor-btn-icon.editor-button.submit-delete(for="post-delete" title='delete post') button#edit-delete.content-editor-btn-icon.editor-button.submit-delete(for="post-delete" title='delete post')
svg#option-delete(viewBox="0 0 20 20" class="icons") svg#edit-delete(viewBox="0 0 20 20" class="icons")
use#option-delete(xlink:href='/dash/assets/images/sprite.svg#entypo-cross') use#edit-delete(xlink:href='/dash/assets/images/sprite.svg#entypo-cross')
else else
button#edit-save.post-sumbit-btn.submit-start.editor-button(data-action='blog-add' type='submit') button#edit-save.post-sumbit-btn.submit-start.editor-button(data-action='blog-add' type='submit')
svg#submit-save(viewBox="0 0 20 20" class="icons") svg#submit-save(viewBox="0 0 20 20" class="icons")

@ -1,59 +1,49 @@
import DataUtils, import DataUtils from '../../../../brain/tools/utilities/DataUtils';
{
REQUEST_TYPE_GET,
REQUEST_TYPE_PUT,
REQUEST_TYPE_POST,
REQUEST_TYPE_DELETE,
CONTENT_TYPE_JSON,
CONTENT_TYPE_FORM
}
from '../../../../brain/tools/utilities/DataUtils';
import * as DataEvent from '../../../../brain/tools/events/DataEvent'; import * as DataEvent from '../../../../brain/tools/events/DataEvent';
import DashManager from './controllers/DashManager'; import DashManager from './controllers/DashManager';
import DBUtils from '../../../../brain/tools/utilities/DBUtils'; import DBUtils from '../../../../brain/tools/utilities/DBUtils';
export default class Base export default class Base {
{ //--------------------------
//-------------------------- // constructor
// constructor //--------------------------
//-------------------------- constructor() {
constructor() this.dashManager = [];
{ this.dataUtils = new DataUtils();
var self = this; this.dbUtils = new DBUtils();
this.dashManager = []; this.settings = [];
this.dataUtils = new DataUtils(); this.storeLocalData();
this.dbUtils = new DBUtils(); }
this.settings = []; start() {
this.storeLocalData(); this.dashManager = new DashManager();
} }
start() //--------------------------
{ // methods
this.dashManager = new DashManager(); //--------------------------
} storeLocalData() {
//-------------------------- var self = this;
// methods this.dataUtils
//-------------------------- .request('/api/post/json', DataEvent.SETTINGS_LOADED)
storeLocalData() .then(response => {
{ let posts = JSON.parse(response.request['response']);
var self = this;
this.dataUtils.request('/api/post/json', DataEvent.SETTINGS_LOADED).then((response) =>
{
let posts = JSON.parse(response.request['response']);
let list = []; let list = [];
for (let index = 0; index < posts.length; index++) { for (let index = 0; index < posts.length; index++) {
list.push({id:posts[index].id ,post:posts[index].post}); list.push({ id: posts[index].id, post: posts[index].post });
} }
self.dbUtils.syncLocal(list).then(r=>{ self.dbUtils
self.start(); .syncLocal(list)
}).catch(err=>{ .then(() => {
console.log(err); self.start();
}); })
}).catch((err) => .catch(() => {
{ //console.log(err);
console.log(err); });
}); })
} .catch(() => {
//-------------------------- //console.log(err);
// event handlers });
//-------------------------- }
} //--------------------------
// event handlers
//--------------------------
}

@ -51,5 +51,3 @@ select
:-ms-input-placeholder :-ms-input-placeholder
font 1em 'Apercu-Mono' font 1em 'Apercu-Mono'
color $secondary color $secondary

@ -5,26 +5,30 @@
#nav-index-wrapper #nav-index-wrapper
padding 0.75rem padding 0.75rem
#nav-pages #nav-pages
div.nav-item .nav-item
display: block display block
width: 100% width 98%
background: $primary - 60% background $primary
border-radius 3px border-radius 3px
color $secondary color $white
height 30px height 30px
padding: 10px padding 10px
margin 0 0 10px 0; margin 0 0 10px 0
font-size 1.5em font-size 1.5em
cursor move cursor move
label label
display inline-block display inline-block
vertical-align: middle vertical-align middle
padding: 0 padding 0
margin: -15px 0 0 10px margin -15px 0 0 10px
cursor move cursor move
#nav-btns #nav-btns
float right float right
button
font-size: .8em button
margin: 0 0 0 10px font-size 0.8em
margin 0 0 0 10px

@ -30,7 +30,7 @@
button button
margin-top 5px margin-top 5px
width 320px width 100%
height 45px height 45px
#member-settings, #site-settings, #option-settings #member-settings, #site-settings, #option-settings
@ -105,8 +105,10 @@
fill $primary fill $primary
display inline-block display inline-block
float right float right
#mail-settings #mail-settings
min-height: 240px min-height 240px
a.mail-option a.mail-option
float right float right
font-family 'Apercu-Mono' font-family 'Apercu-Mono'

Loading…
Cancel
Save