post submission bug fixes, styles fixes for nav section

This commit is contained in:
Ro 2019-02-27 16:09:39 -05:00
parent 5decfa92e2
commit 57684e7a27
16 changed files with 500 additions and 546 deletions

View file

@ -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({
order: [['id', 'DESC']]
})
@ -118,11 +119,19 @@ router.get('/json', function(req, res) {
let newlist = [];
for (let index = 0; index < posts.length; index++) {
let item = posts[index].post;
switch (filter) {
case 'not-deleted':
if (typeof item.deleted == 'undefined' || item.deleted == false) {
newlist.push(posts[index]);
} else {
continue;
}
break;
default:
newlist.push(posts[index]);
break;
}
}
res.json(newlist);
})

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -70,16 +70,16 @@ function onError(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
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
//console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
//console.error(bind + ' is already in use');
process.exit(1);
break;
default:

View file

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

View file

@ -27,8 +27,8 @@
svg#submit-error.icon-hide(viewBox="0 0 20 20" class="icons")
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')
svg#option-delete(viewBox="0 0 20 20" class="icons")
use#option-delete(xlink:href='/dash/assets/images/sprite.svg#entypo-cross')
svg#edit-delete(viewBox="0 0 20 20" class="icons")
use#edit-delete(xlink:href='/dash/assets/images/sprite.svg#entypo-cross')
else
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")

View file

@ -1,56 +1,46 @@
import 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 DataUtils from '../../../../brain/tools/utilities/DataUtils';
import * as DataEvent from '../../../../brain/tools/events/DataEvent';
import DashManager from './controllers/DashManager';
import DBUtils from '../../../../brain/tools/utilities/DBUtils';
export default class Base
{
export default class Base {
//--------------------------
// constructor
//--------------------------
constructor()
{
var self = this;
constructor() {
this.dashManager = [];
this.dataUtils = new DataUtils();
this.dbUtils = new DBUtils();
this.settings = [];
this.storeLocalData();
}
start()
{
start() {
this.dashManager = new DashManager();
}
//--------------------------
// methods
//--------------------------
storeLocalData()
{
storeLocalData() {
var self = this;
this.dataUtils.request('/api/post/json', DataEvent.SETTINGS_LOADED).then((response) =>
{
this.dataUtils
.request('/api/post/json', DataEvent.SETTINGS_LOADED)
.then(response => {
let posts = JSON.parse(response.request['response']);
let list = [];
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
.syncLocal(list)
.then(() => {
self.start();
}).catch(err=>{
console.log(err);
})
.catch(() => {
//console.log(err);
});
}).catch((err) =>
{
console.log(err);
})
.catch(() => {
//console.log(err);
});
}
//--------------------------

View file

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

View file

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

View file

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