refactored settings methodology, added theme settings files, initiated settings page
parent
3845ca9552
commit
069854d041
@ -0,0 +1,50 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const FileHound = require('filehound');
|
||||
const Models = require('../../models');
|
||||
const fs = require("fs-extra");
|
||||
var themes = [];
|
||||
var settings = [];
|
||||
//--------------------------
|
||||
// SETTINGS
|
||||
//--------------------------
|
||||
router.get('/', function(req, res)
|
||||
{
|
||||
fs.readJson('site-settings.json').then(obj =>
|
||||
{
|
||||
settings = obj;
|
||||
}).catch(err =>
|
||||
{
|
||||
//console.error(err)
|
||||
})
|
||||
FileHound.create().paths('themes').ext('json').find().then(files =>
|
||||
{
|
||||
for (let index = 0; index < files.length; index++)
|
||||
{
|
||||
fs.readJson(files[index]).then(theme =>
|
||||
{
|
||||
(theme.name == settings.theme) ? themes.push({theme: theme, current:true}) : themes.push({theme: theme, current:false})
|
||||
}).catch(err =>
|
||||
{
|
||||
//console.error(err)
|
||||
})
|
||||
}
|
||||
});
|
||||
if (req.session.user)
|
||||
{
|
||||
let memberInfo = [];
|
||||
memberInfo.push({handle:req.session.user.handle, email:req.session.user.email, avi:req.session.user.avatar});
|
||||
res.render('dash/settings',
|
||||
{
|
||||
title: 'Dashboard | Settings',
|
||||
themes: themes,
|
||||
settings: settings,
|
||||
member: memberInfo[0]
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
res.redirect('/@/dashboard');
|
||||
}
|
||||
});
|
||||
module.exports = router;
|
@ -1,59 +0,0 @@
|
||||
import TransformEffects from './TransformEffects.jsx';
|
||||
|
||||
class Slideshow{
|
||||
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor(slides)
|
||||
{
|
||||
this.slides = slides;
|
||||
var timer = null;
|
||||
this.slideIndex = 0;
|
||||
for(let i of slides)
|
||||
{
|
||||
new TransformEffects().rotateY(i, 0, 90, "top right");
|
||||
i.style.opacity = 1;
|
||||
}
|
||||
|
||||
this.start();
|
||||
}
|
||||
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
start()
|
||||
{
|
||||
new TransformEffects().rotateY(this.slides[this.slideIndex], 1, 0, "top right");
|
||||
this.startTimer()
|
||||
}
|
||||
|
||||
startTimer()
|
||||
{
|
||||
var self = this;
|
||||
this.timer = setTimeout(f=>
|
||||
{
|
||||
self.slideTranstion();
|
||||
}, 4000);
|
||||
}
|
||||
|
||||
slideTranstion()
|
||||
{
|
||||
new TransformEffects().rotateY(this.slides[this.slideIndex], 1, 90, "top right");
|
||||
++this.slideIndex;
|
||||
if(this.slideIndex > this.slides.length-1)
|
||||
this.slideIndex = 0;
|
||||
new TransformEffects().rotateY(this.slides[this.slideIndex], 1, 0, "top right");
|
||||
this.startTimer();
|
||||
}
|
||||
|
||||
setDisplayType()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------
|
||||
// eventhandlers
|
||||
//--------------------------
|
||||
}
|
||||
export {Slideshow as default}
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
"url": "http://fipamo.local/",
|
||||
"description":"The most chill blog framework ever.",
|
||||
"theme": "default",
|
||||
"private": false,
|
||||
"email": {
|
||||
"smtp": {
|
||||
"domain":"",
|
||||
"email": "",
|
||||
"password": ""
|
||||
},
|
||||
"mailgun": {
|
||||
"domain": "",
|
||||
"api-key": ""
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "default",
|
||||
"display-name":"Fipama Oh Won",
|
||||
"author": "Are0h",
|
||||
"description": "The most dangerous default theme in the known universe.",
|
||||
"version": "1.0.0"
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "the-twelfth-house",
|
||||
"display-name":"The Twelfth House",
|
||||
"author": "Are0h",
|
||||
"description": "The official theme for the personal site of Ro, The Twelfth House",
|
||||
"version": "3.0.0"
|
||||
}
|
Loading…
Reference in New Issue