moved settings file, completed nav ordering, switched to pm2

This commit is contained in:
Ro 2019-01-12 14:07:08 -05:00
parent 46d04ceb1e
commit 27a1e670e3
17 changed files with 422 additions and 24 deletions

View file

@ -60,7 +60,7 @@ router.post("/sync", (req, res, next) =>
{ {
if (rightsManager.check(user.role, OBJECT_SETTINGS, TASK_UPDATE)) if (rightsManager.check(user.role, OBJECT_SETTINGS, TASK_UPDATE))
{ {
fs.readJson('site-settings.json').then(obj => fs.readJson('config/site-settings.json').then(obj =>
{ {
if (user.hande != payload.handle || user.email != payload.email) if (user.hande != payload.handle || user.email != payload.email)
{ {
@ -93,7 +93,7 @@ router.post("/sync", (req, res, next) =>
obj.email.smtp.password = payload.mailSettings.smtp.password; obj.email.smtp.password = payload.mailSettings.smtp.password;
obj.email.mailgun.domain = payload.mailSettings.mailgun.domain; obj.email.mailgun.domain = payload.mailSettings.mailgun.domain;
obj.email.mailgun['api-key'] = payload.mailSettings.mailgun.key; obj.email.mailgun['api-key'] = payload.mailSettings.mailgun.key;
fs.writeJson('site-settings.json', obj).then(() => fs.writeJson('config/site-settings.json', obj).then(() =>
{ {
res.json( res.json(
{ {
@ -117,6 +117,44 @@ router.post("/sync", (req, res, next) =>
} }
}); });
}) })
router.post("/nav-sync", (req, res, next) =>
{
let payload = req.body;
Models.User.findById(req.session.user.id).then((user) =>
{
if (rightsManager.check(user.role, OBJECT_SETTINGS, TASK_UPDATE))
{
fs.readJson('config/site-settings.json').then(obj =>
{
obj.menu = payload;
fs.writeJson('config/site-settings.json', obj).then(() =>
{
res.json(
{
message: DataEvent.SETTINGS_UPDATED
});
}).catch(err =>
{
console.error(err)
})
}).catch(err =>
{
console.error(err)
})
}
else
{
res.json(
{
message: "Nah. You can't do that. Talk to the admin, sport."
});
}
});
})
/*** /***
UPLOAD AVATAR UPLOAD AVATAR
*/ */

View file

@ -2,16 +2,24 @@ const express = require('express');
const router = express.Router(); const router = express.Router();
const Models = require('../../models'); const Models = require('../../models');
const fs = require("fs-extra"); const fs = require("fs-extra");
var settings = [];
//-------------------------- //--------------------------
// SETTINGS // SETTINGS
//-------------------------- //--------------------------
router.get('/', function(req, res) router.get('/', function(req, res)
{ {
fs.readJson('config/site-settings.json').then(obj =>
{
settings = []
settings = obj;
}).catch(err =>
{
//console.error(err)
})
if (req.session.user) if (req.session.user)
{ {
Models.User.findById(req.session.user.id).then((user) => Models.User.findById(req.session.user.id).then((user) =>
{ {
let pages = [];
Models.FreshPost.findAll( Models.FreshPost.findAll(
{ {
order: [ order: [
@ -19,20 +27,32 @@ router.get('/', function(req, res)
] ]
}).then(posts => }).then(posts =>
{ {
for (let index = 0; index < posts.length; index++) let pages = []
if (settings.menu.length == 0)
{ {
let item = posts[index].post; for (let index = 0; index < posts.length; index++)
if(item.page == true || item.page == "true") pages.push(posts[index]); {
let item = posts[index].post;
if (item.page == true || item.page == "true") pages.push(
{
title: posts[index].post.title,
slug: posts[index].post.slug
});
}
} }
else
{
pages = settings.menu
}
res.render('dash/navigation',
{
pages: pages,
title: 'Dashboard | Global Nav'
});
}).catch(err => }).catch(err =>
{ {
console.log("ERROR", err) console.log("ERROR", err)
}) })
res.render('dash/navigation',
{
pages: pages,
title: 'Dashboard | Global Nav'
});
}) })
} }
else else

View file

@ -9,7 +9,7 @@ var settings = [];
//-------------------------- //--------------------------
router.get('/', function(req, res) router.get('/', function(req, res)
{ {
fs.readJson('site-settings.json').then(obj => fs.readJson('config/site-settings.json').then(obj =>
{ {
settings = obj; settings = obj;
}).catch(err => }).catch(err =>

View file

@ -1,7 +1,7 @@
var express = require('express'); var express = require('express');
var router = express.Router(); var router = express.Router();
var Models = require('../../models'); var Models = require('../../models');
var config = require('../../../site-settings.json'); var config = require('../../../config/site-settings.json');
module.exports = function (session) { module.exports = function (session) {
//-------------------------- //--------------------------
// Index // Index

54
package-lock.json generated
View file

@ -1,6 +1,6 @@
{ {
"name": "fipamo", "name": "fipamo",
"version": "0.0.5", "version": "0.0.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -1948,6 +1948,11 @@
"resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz", "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz",
"integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==" "integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw=="
}, },
"browser-split": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/browser-split/-/browser-split-0.0.0.tgz",
"integrity": "sha1-QUGcrvdpdVkp3VGJZ9PuwKYmJ3E="
},
"browserslist": { "browserslist": {
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.3.4.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.3.4.tgz",
@ -2104,6 +2109,14 @@
"upath": "^1.0.5" "upath": "^1.0.5"
} }
}, },
"class-list": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/class-list/-/class-list-0.1.1.tgz",
"integrity": "sha1-m5dFGSxBebXaCg12M2WOPHDXlss=",
"requires": {
"indexof": "0.0.1"
}
},
"class-utils": { "class-utils": {
"version": "0.3.6", "version": "0.3.6",
"resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz",
@ -4078,6 +4091,15 @@
} }
} }
}, },
"hyperscript": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/hyperscript/-/hyperscript-1.0.7.tgz",
"integrity": "sha1-2I7TxRk0xtb6NbKr/XwA8QCCD2U=",
"requires": {
"browser-split": "0.0.0",
"class-list": "~0.1.0"
}
},
"iconv-lite": { "iconv-lite": {
"version": "0.4.23", "version": "0.4.23",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
@ -4092,6 +4114,11 @@
"integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=", "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=",
"dev": true "dev": true
}, },
"indexof": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz",
"integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10="
},
"inflection": { "inflection": {
"version": "1.12.0", "version": "1.12.0",
"resolved": "https://registry.npmjs.org/inflection/-/inflection-1.12.0.tgz", "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.12.0.tgz",
@ -4321,6 +4348,11 @@
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
}, },
"jquery-browserify": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/jquery-browserify/-/jquery-browserify-1.8.1.tgz",
"integrity": "sha1-DeqddBpPQRWuGYDEUxsiUCmRoBU="
},
"js-beautify": { "js-beautify": {
"version": "1.8.8", "version": "1.8.8",
"resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.8.8.tgz", "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.8.8.tgz",
@ -5056,6 +5088,11 @@
"isobject": "^3.0.1" "isobject": "^3.0.1"
} }
}, },
"observable": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/observable/-/observable-1.3.1.tgz",
"integrity": "sha1-PSogOxQw2vak1tNvI2zBPm7Vu04="
},
"on-finished": { "on-finished": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
@ -6342,6 +6379,21 @@
"socks": "~2.2.0" "socks": "~2.2.0"
} }
}, },
"sortable": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/sortable/-/sortable-2.0.0.tgz",
"integrity": "sha1-NLNUK0KQTFm4RU9VFIoPT2AYaUM=",
"requires": {
"hyperscript": "~1.0.1",
"jquery-browserify": "~1.8.1",
"observable": "~1.3.1"
}
},
"sortablejs": {
"version": "1.8.0-rc1",
"resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.8.0-rc1.tgz",
"integrity": "sha512-umyNbQVDwRgc0SZvUB+FRUIUqACnu5vCCmK0zv/xWA3eDSOh+IZsg3GHdWvEOcUBwnykqyk760+YPgVa8HfxFg=="
},
"source-map": { "source-map": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",

View file

@ -7,14 +7,14 @@
"theme": "default-light", "theme": "default-light",
"scripts": { "scripts": {
"start": "forever start -r esm init.js", "start": "forever start -r esm init.js",
"stop": "forever stop init.js", "stop": "forever stop -r esm init.js",
"dev": "nodemon -r esm init.js", "dev": "nodemon -r esm init.js",
"watch-front-scripts": "parcel watch themes/$npm_package_theme/src/com/Start.jsx --out-dir themes/$npm_package_theme/assets/js --out-file start.min.js --public-url /$npm_package_theme/assets/js", "watch-front-scripts": "parcel watch themes/$npm_package_theme/src/com/Start.jsx --out-dir themes/$npm_package_theme/assets/js --out-file start.min.js --public-url /$npm_package_theme/assets/js",
"watch-front-styles": "stylus -w -m -o themes/$npm_package_theme/assets/css themes/$npm_package_theme/src/styles/base.styl", "watch-front-styles": "stylus -w -m -o themes/$npm_package_theme/assets/css themes/$npm_package_theme/src/styles/base.styl",
"build-front-kit": "uglifyjs node_modules/scramble-text/dist/ScrambleText.min.js node_modules/animejs/anime.min.js node_modules/reframe.js/dist/reframe.min.js -c -o themes/$npm_package_theme/assets/js/toolkit.min.js", "build-front-kit": "uglifyjs node_modules/scramble-text/dist/ScrambleText.min.js node_modules/animejs/anime.min.js node_modules/reframe.js/dist/reframe.min.js -c -o themes/$npm_package_theme/assets/js/toolkit.min.js",
"watch-back-scripts": "parcel watch themes/dash/src/com/Start.js --out-dir themes/dash/assets/js --out-file dash.min.js --public-url /dash/assets/js", "watch-back-scripts": "parcel watch themes/dash/src/com/Start.js --out-dir themes/dash/assets/js --out-file dash.min.js --public-url /dash/assets/js",
"watch-back-styles": "stylus -w -m -o themes/dash/assets/css themes/dash/src/styles/dash.styl", "watch-back-styles": "stylus -w -m -o themes/dash/assets/css themes/dash/src/styles/dash.styl",
"build-back-kit": "uglifyjs themes/dash/src/libraries/highlight.pack.js node_modules/dompurify/dist/purify.min.js node_modules/scramble-text/dist/ScrambleText.min.js node_modules/animejs/anime.min.js node_modules/reframe.js/dist/reframe.min.js -c -o themes/dash/assets/js/dashkit.min.js" "build-back-kit": "uglifyjs themes/dash/src/libraries/highlight.pack.js node_modules/sortablejs/Sortable.min.js node_modules/scramble-text/dist/ScrambleText.min.js node_modules/animejs/anime.min.js node_modules/reframe.js/dist/reframe.min.js -c -o themes/dash/assets/js/dashkit.min.js"
}, },
"engines": { "engines": {
"node": ">=8.12.0" "node": ">=8.12.0"
@ -52,6 +52,8 @@
"sequelize": "^4.37.6", "sequelize": "^4.37.6",
"sequelize-cli": "^5.3.0", "sequelize-cli": "^5.3.0",
"serve-favicon": "latest", "serve-favicon": "latest",
"sortable": "^2.0.0",
"sortablejs": "^1.8.0-rc1",
"tiny-date-picker": "^3.2.6", "tiny-date-picker": "^3.2.6",
"uuid": "^3.2.1", "uuid": "^3.2.1",
"workbox-sw": "^3.6.3" "workbox-sw": "^3.6.3"

View file

@ -2051,6 +2051,25 @@ 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 {
display: block;
width: 100%;
background: #161d23;
border-radius: 3px;
color: #b2cce5;
height: 30px;
padding: 10px;
margin: 0 0 10px 0;
font-size: 1.5em;
cursor: move;
}
#nav-index #nav-index-wrapper #nav-pages label {
display: inline-block;
vertical-align: middle;
padding: 0;
margin: -15px 0 0 10px;
cursor: move;
}
/** /**
------------------------------- -------------------------------
-- Forms -- Forms

File diff suppressed because one or more lines are too long

View file

@ -8588,7 +8588,144 @@ function () {
}(); }();
exports.default = SettingsIndex; exports.default = SettingsIndex;
},{"../actions/SettingsActions":"actions/SettingsActions.js","../../../../../brain/tools/utilities/DataUtils":"../../../../brain/tools/utilities/DataUtils.js","../../../../../brain/tools/events/DataEvent":"../../../../brain/tools/events/DataEvent.js"}],"controllers/DashManager.js":[function(require,module,exports) { },{"../actions/SettingsActions":"actions/SettingsActions.js","../../../../../brain/tools/utilities/DataUtils":"../../../../brain/tools/utilities/DataUtils.js","../../../../../brain/tools/events/DataEvent":"../../../../brain/tools/events/DataEvent.js"}],"actions/NavActions.js":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _DataUtils = _interopRequireWildcard(require("../../../../../brain//tools/utilities/DataUtils"));
var _StringUtils = _interopRequireDefault(require("../../../../../brain//tools/utilities/StringUtils"));
var _DateUtils = _interopRequireDefault(require("../../../../../brain/tools/utilities/DateUtils"));
var DataEvent = _interopRequireWildcard(require("../../../../../brain/tools/events/DataEvent"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var NavActions =
/*#__PURE__*/
function () {
//--------------------------
// constructor
//--------------------------
function NavActions() {
_classCallCheck(this, NavActions);
this.dataUtils = new _DataUtils.default();
this.dateUtils = new _DateUtils.default();
} //--------------------------
// methods
//--------------------------
_createClass(NavActions, [{
key: "save",
value: function save() {
var self = this;
var navData = [];
var items = document.getElementById('nav-pages').children;
for (var index = 0; index < items.length; index++) {
navData.push({
title: items[index].getElementsByTagName('label')[0].innerHTML,
slug: items[index].id
});
}
return new Promise(function (resolve, reject) {
self.dataUtils.request('/api/settings/nav-sync', DataEvent.SETTINGS_UPDATED, _DataUtils.REQUEST_TYPE_POST, _DataUtils.CONTENT_TYPE_JSON, navData).then(function (response) {
//console.log("RESPONSE", response)
resolve(response);
}).catch(function (err) {
reject(err);
});
});
} //--------------------------
// event handlers
//--------------------------
}]);
return NavActions;
}();
exports.default = NavActions;
},{"../../../../../brain//tools/utilities/DataUtils":"../../../../brain/tools/utilities/DataUtils.js","../../../../../brain//tools/utilities/StringUtils":"../../../../brain/tools/utilities/StringUtils.js","../../../../../brain/tools/utilities/DateUtils":"../../../../brain/tools/utilities/DateUtils.js","../../../../../brain/tools/events/DataEvent":"../../../../brain/tools/events/DataEvent.js"}],"controllers/NavIndex.js":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _NavActions = _interopRequireDefault(require("../actions/NavActions"));
var _DataUtils = _interopRequireWildcard(require("../../../../../brain/tools/utilities/DataUtils"));
var DataEvent = _interopRequireWildcard(require("../../../../../brain/tools/events/DataEvent"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var NavIndex =
/*#__PURE__*/
function () {
//--------------------------
// constructor
//--------------------------
function NavIndex() {
_classCallCheck(this, NavIndex);
this.start();
this.dataUtils = new _DataUtils.default();
} //--------------------------
// methods
//--------------------------
_createClass(NavIndex, [{
key: "start",
value: function start() {
var self = this;
var menu = Sortable.create(document.getElementById("nav-pages"), {
onUpdate: function onUpdate(e) {
new _NavActions.default().save().then(function (r) {
console.log(r);
}).catch(function (err) {
console.log(err);
});
}
});
} //--------------------------
// event handlers
//--------------------------
}]);
return NavIndex;
}();
exports.default = NavIndex;
},{"../actions/NavActions":"actions/NavActions.js","../../../../../brain/tools/utilities/DataUtils":"../../../../brain/tools/utilities/DataUtils.js","../../../../../brain/tools/events/DataEvent":"../../../../brain/tools/events/DataEvent.js"}],"controllers/DashManager.js":[function(require,module,exports) {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
@ -8600,6 +8737,8 @@ var _PostIndex = _interopRequireDefault(require("./PostIndex"));
var _SettingsIndex = _interopRequireDefault(require("./SettingsIndex")); var _SettingsIndex = _interopRequireDefault(require("./SettingsIndex"));
var _NavIndex = _interopRequireDefault(require("./NavIndex"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -8644,6 +8783,9 @@ function () {
this.currentDisplay = new _SettingsIndex.default(); this.currentDisplay = new _SettingsIndex.default();
break; break;
case 'navigation':
this.currentDisplay = new _NavIndex.default();
default: default:
// just chill // just chill
break; break;
@ -8660,7 +8802,7 @@ function () {
}(); }();
exports.default = DashManager; exports.default = DashManager;
},{"./PostIndex":"controllers/PostIndex.js","./SettingsIndex":"controllers/SettingsIndex.js"}],"Base.js":[function(require,module,exports) { },{"./PostIndex":"controllers/PostIndex.js","./SettingsIndex":"controllers/SettingsIndex.js","./NavIndex":"controllers/NavIndex.js"}],"Base.js":[function(require,module,exports) {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,8 +1,9 @@
-var versioning = Math.round(new Date().getTime()/1000)
doctype html doctype html
html(xmlns='http://www.w3.org/1999/xhtml', lang='en', xml:lang="en") html(xmlns='http://www.w3.org/1999/xhtml', lang='en', xml:lang="en")
head head
title= title title= title
meta(content="text/html;charset=utf-8", http-equiv="Content-Type")
meta(meta content="utf-8", http-equiv="encoding")
meta(name='viewport', content='width=device-width, initial-scale=1.0') meta(name='viewport', content='width=device-width, initial-scale=1.0')
meta(name="keywords" content="creative technoglogist, graphic design, web development, designer developer, social thought, political discussion, music producer, creative culture, black creative, black geek") meta(name="keywords" content="creative technoglogist, graphic design, web development, designer developer, social thought, political discussion, music producer, creative culture, black creative, black geek")
meta(name="description" content="The home site of Creative Technologist, music maker, and social philoshoper, Ro. Ha, I know. Me too.") meta(name="description" content="The home site of Creative Technologist, music maker, and social philoshoper, Ro. Ha, I know. Me too.")

View file

@ -2,5 +2,12 @@ extends frame
block main-content block main-content
#nav-index #nav-index
#nav-index-wrapper #nav-index-wrapper
| NAVI BRO #nav-pages
- var index = 0;
- for ( index; index < pages.length; index++)
.nav-item(id=pages[index].slug)
svg#item-arrows(viewBox="0 0 20 20" class="icons")
use(xlink:href='/dash/assets/images/sprite.svg#entypo-select-arrows')
label
= pages[index].title

View file

@ -0,0 +1,51 @@
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 StringUtils from '../../../../../brain//tools/utilities/StringUtils';
import DateUtils from '../../../../../brain/tools/utilities/DateUtils';
import * as DataEvent from '../../../../../brain/tools/events/DataEvent';
export default class NavActions
{
//--------------------------
// constructor
//--------------------------
constructor()
{
this.dataUtils = new DataUtils();
this.dateUtils = new DateUtils();
}
//--------------------------
// methods
//--------------------------
save()
{
let self = this;
let navData = [];
let items = document.getElementById('nav-pages').children;
for (let index = 0; index < items.length; index++) {
navData.push({title:items[index].getElementsByTagName('label')[0].innerHTML, slug:items[index].id})
}
return new Promise(function(resolve, reject)
{
self.dataUtils.request('/api/settings/nav-sync', DataEvent.SETTINGS_UPDATED, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, navData).then((response) =>
{
//console.log("RESPONSE", response)
resolve(response)
}).catch((err) =>
{
reject(err);
})
})
}
//--------------------------
// event handlers
//--------------------------
}

View file

@ -1,5 +1,6 @@
import PostIndex from './PostIndex'; import PostIndex from './PostIndex';
import SettingsIndex from './SettingsIndex'; import SettingsIndex from './SettingsIndex';
import NaviIndex from './NavIndex';
export default class DashManager { export default class DashManager {
//-------------------------- //--------------------------
@ -27,6 +28,8 @@ export default class DashManager {
case 'settings': case 'settings':
this.currentDisplay = new SettingsIndex(); this.currentDisplay = new SettingsIndex();
break; break;
case 'navigation':
this.currentDisplay = new NaviIndex();
default: default:
// just chill // just chill

View file

@ -0,0 +1,45 @@
import NavActions from "../actions/NavActions";
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 * as DataEvent from '../../../../../brain/tools/events/DataEvent';
export default class NavIndex
{
//--------------------------
// constructor
//--------------------------
constructor()
{
this.start();
this.dataUtils = new DataUtils();
}
//--------------------------
// methods
//--------------------------
start()
{
let self = this;
let menu = Sortable.create(document.getElementById("nav-pages"),
{
onUpdate: e =>
{
new NavActions().save().then(r=>{
console.log(r);
}).catch(err=>{
console.log(err)
})
}
});
}
//--------------------------
// event handlers
//--------------------------
}

View file

@ -5,3 +5,21 @@
#nav-index-wrapper #nav-index-wrapper
padding 0.75rem padding 0.75rem
#nav-pages
div
display: block
width: 100%
background: $primary - 60%
border-radius 3px
color $secondary
height 30px
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
cursor move