opn graph meta edits, log out made public, improved notifications

This commit is contained in:
Ro 2020-09-04 13:33:32 -07:00
parent 812be36edb
commit d9d004468a
10 changed files with 83 additions and 27 deletions

View file

@ -103,9 +103,12 @@ export default class Render {
} }
buffed = new StringUtils().decodeHTML(buffed); buffed = new StringUtils().decodeHTML(buffed);
let html = md.render(buffed, { html: true, xhtmlOut: true }); let html = md.render(buffed, { html: true, xhtmlOut: true });
//add open graph meta variables
let file = pug.renderFile(template, { let file = pug.renderFile(template, {
title: page.metadata.title, title: page.metadata.title,
default_bg: page.metadata.feature, default_bg: page.metadata.feature,
image: page.metadata.feature,
keywords: page.metadata.tags,
content: html, content: html,
tags: tags, tags: tags,
menu: config.menu, menu: config.menu,

View file

@ -54,10 +54,9 @@ router.get('/', function (req, res) {
//-------------------------- //--------------------------
// Logout // Logout
//-------------------------- //--------------------------
router.post('/logout', function (req, res) { router.get('/logout', (req, res) => {
req.logout(); //req.logout();
return res.json({ req.session.destroy();
message: 'LOGGED OUT' res.redirect('/@/dashboard');
});
}); });
module.exports = router; module.exports = router;

View file

@ -12,11 +12,17 @@ html(xmlns='http://www.w3.org/1999/xhtml', lang='en', xml:lang="en")
//meta(name="twitter:image" content="https://thetwelfth.house/base-assets/images/current.png") //meta(name="twitter:image" content="https://thetwelfth.house/base-assets/images/current.png")
link(rel='stylesheet', href="/assets/css/dash.css", type='text/css') link(rel='stylesheet', href="/assets/css/dash.css", type='text/css')
body body
#notifications.notifications #notifications.notifications.notify-close
#notifyMessage.notifyMessage #notifyMessage.notifyMessage
.notify-icon .notify-icon#notify-good
svg(viewBox="0 0 20 20" class="icons") svg(viewBox="0 0 20 20" class="icons")
use#submit-update(xlink:href='/assets/images/global/sprite.svg#entypo-bell') use#submit-update(xlink:href='/assets/images/global/sprite.svg#entypo-emoji-flirt')
.notify-icon#notify-lame
svg(viewBox="0 0 20 20" class="icons")
use#submit-update(xlink:href='/assets/images/global/sprite.svg#entypo-emoji-sad')
.notify-icon#notify-working
svg(viewBox="0 0 20 20" class="icons")
use#submit-update(xlink:href='/assets/images/global/sprite.svg#entypo-cog')
p#message-text This is a message p#message-text This is a message
.main-container#main-content .main-container#main-content
section#dash-index-content section#dash-index-content

View file

@ -2,3 +2,6 @@
a#settings(href="/@/dashboard/settings") Settings a#settings(href="/@/dashboard/settings") Settings
| . | .
a#navigation(href="/@/dashboard/navigation") Navigation a#navigation(href="/@/dashboard/navigation") Navigation
| .
a#navigation(href="/@/dashboard/logout") Log Out

View file

@ -50,11 +50,13 @@ export default class Base {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
let authForm = data.formDataToJSON(document.getElementById('login')); let authForm = data.formDataToJSON(document.getElementById('login'));
notify.alert('Looking, hold up', null);
api.login(authForm) api.login(authForm)
.then(response => { .then(response => {
if (response.type === DataEvent.REQUEST_LAME) { if (response.type === DataEvent.REQUEST_LAME) {
notify.alert(response.message, false); notify.alert(response.message, false);
} else { } else {
notify.alert(response.message, true);
e.target.innerHTML = response.message; e.target.innerHTML = response.message;
setTimeout(() => { setTimeout(() => {
window.location = '/@/dashboard'; window.location = '/@/dashboard';

View file

@ -19,6 +19,7 @@ export default class NavIndex {
Sortable.create(document.getElementById('nav-pages'), { Sortable.create(document.getElementById('nav-pages'), {
onUpdate: () => { onUpdate: () => {
new NavActions().syncMenu().then(data => { new NavActions().syncMenu().then(data => {
notify.alert('Updating Menu', null);
admin.syncNav(data).then(r => { admin.syncNav(data).then(r => {
if (r.type == DataEvent.MENU_UPDATED) { if (r.type == DataEvent.MENU_UPDATED) {
notify.alert(r.message, true); notify.alert(r.message, true);
@ -45,6 +46,7 @@ export default class NavIndex {
new NavActions().removeItem(id); new NavActions().removeItem(id);
new NavActions().syncMenu().then(data => { new NavActions().syncMenu().then(data => {
data.remove = e.target.getAttribute('data-uuid'); data.remove = e.target.getAttribute('data-uuid');
notify.alert('Editing Menu', null);
admin.syncNav(data).then(r => { admin.syncNav(data).then(r => {
if (r.type == DataEvent.MENU_UPDATED) { if (r.type == DataEvent.MENU_UPDATED) {
notify.alert(r.message, true); notify.alert(r.message, true);

View file

@ -134,6 +134,7 @@ export default class PostEditor {
new PageActions() new PageActions()
.collectInfo(document.getElementById('featured-image-upload').files[0]) .collectInfo(document.getElementById('featured-image-upload').files[0])
.then(page => { .then(page => {
notify.alert('Writing down changes', null);
admin admin
.pageActions(task, page) .pageActions(task, page)
.then(r => { .then(r => {

View file

@ -23,6 +23,7 @@ export default class SettingsIndex {
new SettingsActions() new SettingsActions()
.getInfo() .getInfo()
.then(data => { .then(data => {
notify.alert('Saving Settings', null);
admin.syncSettings(data).then(r => { admin.syncSettings(data).then(r => {
if (r.type == DataEvent.SETTINGS_UPDATED) { if (r.type == DataEvent.SETTINGS_UPDATED) {
notify.alert(r.message, true); notify.alert(r.message, true);
@ -155,6 +156,7 @@ export default class SettingsIndex {
} }
} }
handleImageUpload(type, files) { handleImageUpload(type, files) {
notify.alert('Uploading Image... ', null);
admin admin
.imageUpload(type, files) .imageUpload(type, files)
.then(r => { .then(r => {
@ -174,6 +176,7 @@ export default class SettingsIndex {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
let task = { task: 'publish all pages' }; let task = { task: 'publish all pages' };
notify.alert('Publishing site...', null);
admin admin
.publishSite(task) .publishSite(task)
.then(r => { .then(r => {
@ -186,6 +189,7 @@ export default class SettingsIndex {
handleBackup(e) { handleBackup(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
notify.alert('Creating backup', null);
admin admin
.handleBackup(e.target.id, e.target.files) .handleBackup(e.target.id, e.target.files)
.then(r => { .then(r => {

View file

@ -1,7 +1,10 @@
import anime from 'animejs/lib/anime.es.js'; import anime from 'animejs/lib/anime.es.js';
const notifcation = document.getElementById('notifications'); const notifcation = document.getElementById('notifications');
const message = document.getElementById('notifyMessage');
const messageText = document.getElementById('message-text'); const messageText = document.getElementById('message-text');
const iconGood = document.getElementById('notify-good');
const iconLame = document.getElementById('notify-lame');
const iconWorking = document.getElementById('notify-working');
export default class Notfications { export default class Notfications {
//-------------------------- //--------------------------
// constructor // constructor
@ -12,26 +15,44 @@ export default class Notfications {
//-------------------------- //--------------------------
alert(text, status) { alert(text, status) {
messageText.innerHTML = text; //notifcation.style.display = 'flex';
notifcation.style.display = 'flex'; iconWorking.style.display = 'none';
iconGood.style.display = 'none';
iconLame.style.display = 'none';
var color = ''; var color = '';
status ? (color = '#32cd32') : (color = '#F64747'); if (status !== null) {
if (status) {
color = '#32cd32';
iconWorking.style.display = 'none';
iconGood.style.display = 'block';
} else {
color = '#F64747';
iconWorking.style.display = 'none';
iconLame.style.display = 'block';
}
} else {
color = '#200317';
iconWorking.style.display = 'block';
}
notifcation.classList.remove('notify-close');
notifcation.classList.add('notify-open');
messageText.innerHTML = text;
anime({ anime({
targets: messageText, targets: messageText,
backgroundColor: color, backgroundColor: color,
easing: 'easeInOutQuint', easing: 'easeInOutQuint',
duration: 500, duration: 700,
complete: () => { complete: () => {
setTimeout(() => { if (status !== null) {
anime({ setTimeout(() => {
targets: messageText, notifcation.classList.add('notify-close');
backgroundColor: '#374857', notifcation.classList.remove('notify-open');
easing: 'easeOutQuint', }, 1000);
duration: 500 }
});
}, 1000);
} }
}); });
/*
anime({ anime({
targets: message, targets: message,
marginTop: '-20px', marginTop: '-20px',
@ -53,6 +74,7 @@ export default class Notfications {
}, 1000); }, 1000);
} }
}); });
*/
} }
//-------------------------- //--------------------------

View file

@ -2,6 +2,7 @@ html, body
background-color $primary - 60% background-color $primary - 60%
font 400 1em $baseType font 400 1em $baseType
height 100% height 100%
perspective: 1000px
a a
font 300 1em $baseType font 300 1em $baseType
@ -21,20 +22,24 @@ svg.icons
z-index 2000 z-index 2000
height 10% height 10%
width 100% width 100%
display none display block
align-items center align-items center
justify-content center justify-content center
padding 0 padding 0
margin 0 margin 0
transform-origin: 50% 0;
transition all 0.5s cubic-bezier(.83,.05,.28,1.0)//ks-easing( "out-back" );
#notifyMessage #notifyMessage
margin-top: 0px; margin 0 auto
padding-top -125px //padding-top -125px
height 50px; height 50px;
width 500px width 500px
display: flex; display: flex;
align-items center align-items center
justify-content center justify-content center
opacity: 0 opacity: 1
#notify-good, #notify-lame, #notify-working
display: none
.notify-icon .notify-icon
background $black background $black
padding 8px 5px 5px 5px padding 8px 5px 5px 5px
@ -45,7 +50,7 @@ svg.icons
border 2px solid $white border 2px solid $white
p p
color $white color $white
background $highlight background $primary - 60%
width 400px width 400px
height 28px height 28px
padding 15px 0 0 5px padding 15px 0 0 5px
@ -56,6 +61,15 @@ svg.icons
.icons .icons
fill $white fill $white
.notify-close
transform-style preserve-3d
transform: rotateX(-120deg)
.notify-open
transform-style preserve-3d
//-origin: 50% 0;
transform: rotateX(0deg)
.blog-container .blog-container
width 100% width 100%