From 3845ca9552f3279ac69ea70b94c7c67cc8a673ee Mon Sep 17 00:00:00 2001 From: Ro Date: Sat, 8 Dec 2018 13:21:48 -0500 Subject: [PATCH] removed service workers, removed a ton of legacy code --- brain/api/content/bookmarks.js | 168 ------------ brain/api/content/folio.js | 235 ----------------- brain/api/content/posts.js | 5 +- brain/api/content/project.js | 180 ------------- brain/app.js | 26 +- brain/models/Bookmark.js | 101 -------- brain/models/FolioProject.js | 94 ------- brain/models/Post.js | 92 ------- brain/routes/back/dash_posts.js | 10 +- brain/routes/back/index.js | 243 ++++-------------- brain/routes/front/index.js | 46 ---- brain/tools/utilities/RightsManager.js | 2 +- themes/dash/fipamo-edit.pug | 28 -- themes/dash/fipamo-index.pug | 32 --- themes/dash/partials/folio-hub.pug | 21 -- .../dash/partials/folio-project-display.pug | 39 --- themes/dash/partials/front.pug | 8 - themes/dash/partials/login.pug | 2 +- themes/dash/partials/project-panel.pug | 14 - themes/dash/partials/signup-form.pug | 10 - themes/dash/src/com/Base.js | 22 -- themes/dash/src/com/actions/ProjectFolio.js | 101 -------- themes/dash/src/com/actions/TaskFipamo.js | 72 ------ .../src/com/actions/UserAuthentication.js | 137 ---------- .../dash/src/com/controllers/DashManager.js | 2 - .../src/com/controllers/DisplayAdminFipamo.js | 25 -- .../src/com/controllers/DisplayAdminFolio.js | 75 ------ .../dash/src/com/controllers/DisplayBlog.js | 36 --- .../dash/src/com/controllers/DisplayClient.js | 79 ------ themes/dash/src/com/controllers/DisplayFi.js | 35 --- .../dash/src/com/controllers/DisplayIndex.js | 65 ----- .../dash/src/com/controllers/DisplayWork.js | 130 ---------- themes/dash/src/com/controllers/PostIndex.js | 1 - themes/dash/src/styles/dash.styl | 16 -- themes/dash/src/styles/main/_fipamo.styl | 71 ----- themes/dash/src/styles/main/_folio.styl | 96 ------- themes/tim-duncan.js | 35 --- themes/workbox-sw.js | 3 - themes/workbox-sw.js.map | 1 - 39 files changed, 55 insertions(+), 2303 deletions(-) delete mode 100644 brain/api/content/bookmarks.js delete mode 100644 brain/api/content/folio.js delete mode 100644 brain/api/content/project.js delete mode 100644 brain/models/Bookmark.js delete mode 100644 brain/models/FolioProject.js delete mode 100644 brain/models/Post.js delete mode 100644 themes/dash/fipamo-edit.pug delete mode 100644 themes/dash/fipamo-index.pug delete mode 100644 themes/dash/partials/folio-hub.pug delete mode 100644 themes/dash/partials/folio-project-display.pug delete mode 100644 themes/dash/partials/project-panel.pug delete mode 100644 themes/dash/partials/signup-form.pug delete mode 100644 themes/dash/src/com/actions/ProjectFolio.js delete mode 100644 themes/dash/src/com/actions/TaskFipamo.js delete mode 100644 themes/dash/src/com/actions/UserAuthentication.js delete mode 100644 themes/dash/src/com/controllers/DisplayAdminFipamo.js delete mode 100644 themes/dash/src/com/controllers/DisplayAdminFolio.js delete mode 100644 themes/dash/src/com/controllers/DisplayBlog.js delete mode 100644 themes/dash/src/com/controllers/DisplayClient.js delete mode 100644 themes/dash/src/com/controllers/DisplayFi.js delete mode 100644 themes/dash/src/com/controllers/DisplayIndex.js delete mode 100644 themes/dash/src/com/controllers/DisplayWork.js delete mode 100644 themes/dash/src/styles/main/_fipamo.styl delete mode 100644 themes/dash/src/styles/main/_folio.styl delete mode 100644 themes/tim-duncan.js delete mode 100644 themes/workbox-sw.js delete mode 100644 themes/workbox-sw.js.map diff --git a/brain/api/content/bookmarks.js b/brain/api/content/bookmarks.js deleted file mode 100644 index e18acdf..0000000 --- a/brain/api/content/bookmarks.js +++ /dev/null @@ -1,168 +0,0 @@ -import StringUtils from '../../tools/utilities/StringUtils'; -import RightsManager, { - - TASK_CREATE, - TASK_UPDATE, - TASK_READ, - TASK_DELETE, - OBJECT_CLIENT_ADMIN, - OBJECT_CLIENT_USER, - OBJECT_PROJECT_CLIENT, - OBJECT_PROJECT_FOLIO, - OBJECT_BOOKMARK, - OBJECT_POST - -} from '../../tools/utilities/RightsManager'; - -var express = require('express'); -var router = express.Router(); -var Models = require('../../models'); - -var Models = require('../../models'); -const scrape = require('scrape-metadata') - -/* - - -Get Bookmark Listzz - -*/ - -router.get('/archive', function (req, res, next) { - BMArchive.find() - .then((bookmarks) => { - console.log(bookmarks[1]) - res.json(bookmarks) - }) - .catch((err) => { - console.log(err) - }) -}); - -/* - - -Get Bookmark List - -*/ -router.get('/', function (req, res, next) { - Bookmark.find().sort({ - created: -1 - }) - .then((bookmarks) => { - res.json(bookmarks) - }) - .catch((err) => { - console.log(err) - }) -}); - -/* - - Get Bookmark by ID - -*/ -router.get('/:id', function (req, res, next) { - -}); - - - -/* - - Create New BookMark - -*/ -router.post('/add', function (req, res, next) { - if (!req.session.user) - return res.json({ - message: "You need to be logged in, champ." - }); - - var link = req.body.url; - Models.User.findById(req.session.user.id).then((user) => { - if (rightsManager.check(user.role, OBJECT_BOOKMARK, TASK_CREATE)) { - scrape(link, (err, meta) => { - var urlPieces = link.split("/"); - Models.Bookmark.sync().then(f => { - Models.Bookmark.create({ - source: urlPieces[0] + urlPieces[1] + '//' + urlPieces[2], - url: link, - image: meta.ogImage, - title: meta.title, - author: user.id, - listed: true - }).then(saved => { - - res.json({ - message: "link added" - }); - }).catch(err => { - res.json({ - message: "post error", - error: err - }); - }) - }) - }) - } else { - res.json({ - message: "Nah. You can't do that. Talk to the admin, sport." - }); - } - }); - -}); - -/* - - Update Bookmark by ID - -*/ -router.post('/update/:id', function (req, res, next) { - if (!req.session.user) - return res.json({ - message: "You need to be logged in, champ." - }); - console.log("ID: "+req.params.id); - let title = req.body.title; - let tags = req.body.tags; - let image = req.body.image; - - Models.User.findById(req.session.user.id).then((user) => { - if (rightsManager.check(user.role, OBJECT_BOOKMARK, TASK_UPDATE)) { - Models.Bookmark.findOne({ - where: { - id: req.params.id - } - }).then(saved => { - console.log('SAVED: '+req.body.title); - saved.update({ - title: title, - image: image - }).then(updated => { - res.json({ - message: "bookmark updated" - }); - }).catch(err => { - console.log(err) - }) - }).catch(err => { - console.log(err) - }) - } else { - res.json({ - message: "Nah. You can't do that. Talk to the admin, sport." - }); - } - }); -}); -/* - - Delete Bookmark by ID - -*/ -router.delete('/:id', function (req, res, next) { - -}); -module.exports = router; diff --git a/brain/api/content/folio.js b/brain/api/content/folio.js deleted file mode 100644 index 418dd1a..0000000 --- a/brain/api/content/folio.js +++ /dev/null @@ -1,235 +0,0 @@ - -import DateUtils from '../../tools/utilities/DateUtils'; -import RightsManager, { - - TASK_CREATE, - TASK_UPDATE, - TASK_READ, - TASK_DELETE, - OBJECT_CLIENT_ADMIN, - OBJECT_CLIENT_USER, - OBJECT_PROJECT_CLIENT, - OBJECT_PROJECT_FOLIO, - OBJECT_BOOKMARK, - OBJECT_POST - -} from '../../tools/utilities/RightsManager'; -var express = require('express'); -var router = express.Router(); -var multer = require('multer'); -var fs = require('fs-extra'); -var Models = require('../../models'); -var User = require('../../models/User.js'); - -const dateUtil = new DateUtils() -var uploadPath = "./content/folio-images/" + dateUtil.getDate('year', new Date()) + "/" + dateUtil.getDate('month', new Date()); -fs.ensureDir(uploadPath, function (err) { - //console.log(err) // => null - // dir has now been created, including the directory it is to be placed in -}) -var storage = multer.diskStorage({ - destination: function (req, file, cb) { - cb(null, uploadPath) - }, - filename: function (req, file, cb) { - var splice = file.originalname.split(':'); - cb(null, splice[0]); - } -}); -var upload = multer({ - storage: storage -}).array('folioImages'); -/* - - Create New Folio Project - -*/ -router.post('/add', function (req, res, next) { - if (!req.user) - return res.json({ - message: "You need to be logged in, champ." - }) - User.findById(req.user._id).then((user) => { - upload(req, res, function (err) { - if (err) { - //console.log('Error in Saving Entry: ' + err); - res.json({ - message: err - }); - throw err; - } else { - if (RightsManager.check(user.role, [RightsManager.OBJECT_PROJECT_FOLIO], RightsManager.TASK_CREATE)) { - var project = new Project(req.body); - if (req.files != "") { - project.images = req.files; - } else { - console.log("NOTHING TO SAVE"); - } - project.save().then((project) => { - res.json({ - message: "new client project added" - }); - }).catch((err) => { - console.log(err); - }) - } else { - res.json({ - message: "Nah. You can't do that. Talk to the admin, sport." - }); - } - } - }); - }).catch((err) => { - console.log(err); - }) -}); -/* - - Get Folio Project List - -*/ -router.get('/', function (req, res, next) { - Project.find({}).then((projects) => { - var folioArray = []; - for (var i = 0; i < projects.length; i++) { - var imgURL = null; - if (projects[i].images.length != 0) - imgURL = String(projects[i].images[0].path).substring(8, String(projects[i].images[0].path).length); - var folioItem = { - id: projects[i]._id, - title: projects[i].title, - url: projects[i].url, - tools: projects[i].tools, - description: projects[i].description, - type: projects[i].type, - img_url: imgURL, - img_full_url: "http://formless.local/" + imgURL - } - folioArray[i] = folioItem; - } - res.json(folioArray); - }) -}); -/* - - Get Folio Project by ID - -*/ -router.get('/:id', function (req, res, next) { - Project.findById(req.params.id).then((project) => { - res.json(project); - }).catch((err) => { - console.log(err); - }); -}); -/* - - Update Folio Project by ID - -*/ -router.post('/update/:id', function (req, res, next) { - if (!req.session.user) - return res.json({ - message: "You need to be logged in, champ." - }); - Models.User.findById(req.session.user.id).then((user) => { - if (RightsManager.check(user.role, [RightsManager.OBJECT_PROJECT_FOLIO], RightsManager.TASK_UPDATE)) { - upload(req, res, function (err) { - if (err) { - //console.log('Error in Saving Entry: ' + err); - res.json({ - message: err - }); - throw err; - } else { - Models.FolioProject.findOne({where:{id: req.params.id}}).then((project) => { - if (req.files != "") { - project.images = req.files; - } else { - console.log("NOTHING TO SAVE"); - } - - console.log(req.body); - - project.update(req.body).then(updated => { - res.json({ - message: "project updated" - }); - }).catch(err => { - console.log(err) - }); - - /** - project.save().then((saved) => { - res.json({ - message: "project updated" - }); - }).catch((err) => { - console.log(err); - }) - **/ - }).catch((err) => { - console.log(err); - }) - } - }); - } else { - res.json({ - message: "Nah. You can't do that. Talk to the admin, sport." - }); - } - }); -}); -/* - - Delete Folio Project by ID - -*/ -router.delete('/:id', function (req, res, next) { - if (!req.user) - return res.json({ - message: "users only, yo. you're not that" - }); - User.findById(req.user._id).then((user) => { - if (RightsManager.check(user.role, [RightsManager.OBJECT_PROJECT_FOLIO], RightsManager.TASK_DELETE)) { - Project.findByIdAndRemove(req.params.id).then((project) => { - res.json({ - message: 'project has been removed' - }); - }).catch((err) => { - console.log(err); - }) - } else { - res.json({ - message: "Nah. You can't do that. Talk to the admin, sport." - }); - } - }); -}); - -router.post('/sort', function (req, res, next) { - var sortList = req.body; - var self = this; - User.findById(req.user._id).then((user) => { - if (RightsManager.check(user.role, [RightsManager.OBJECT_PROJECT_FOLIO], RightsManager.TASK_UPDATE)) { - var clean = true; - for (var i = 0; i < sortList.length; i++) { - Project.findByIdAndUpdate(sortList[i].sortID, { - sortIndex: sortList[i].sortIndex - }).then((project) => { - //console.log("SORTED") - //res.json({message: "sorted"}) - }).catch((err) => { - //res.json({message: "sorted", error:err}) - }) - //res.json({message:'projects updated'}) - } - } else { - res.json({ - message: "Nah. You can't do that. Talk to the admin, sport." - }); - } - }); -}); - -module.exports = router; diff --git a/brain/api/content/posts.js b/brain/api/content/posts.js index fd99ba8..77271f2 100644 --- a/brain/api/content/posts.js +++ b/brain/api/content/posts.js @@ -72,7 +72,7 @@ router.post("/sync", (req, res, next) => { [Op.contains]: { - slug: item.post.slug + uuid: item.post.uuid } } } @@ -94,7 +94,7 @@ router.post("/sync", (req, res, next) => { html: true, xhtmlOut: true, - }) + }); if (!_.isEqual(item.post, found.post)) { found.update(item).then(updated => @@ -111,6 +111,7 @@ router.post("/sync", (req, res, next) => } }).catch(err => { + //console.log("***ERRRORZ****", err); Models.FreshPost.create(item).then(fresh => { //console.log(fresh) diff --git a/brain/api/content/project.js b/brain/api/content/project.js deleted file mode 100644 index b5cac9b..0000000 --- a/brain/api/content/project.js +++ /dev/null @@ -1,180 +0,0 @@ -import RightsManager, { - - TASK_CREATE, - TASK_UPDATE, - TASK_READ, - TASK_DELETE, - OBJECT_CLIENT_ADMIN, - OBJECT_CLIENT_USER, - OBJECT_PROJECT_CLIENT, - OBJECT_PROJECT_FOLIO, - OBJECT_BOOKMARK, - OBJECT_POST - -} from '../../tools/utilities/RightsManager'; - -var express = require('express'); -var router = express.Router(); -var multer = require('multer'); -var fs = require('fs-extra'); -var Models = require('../../models'); -var User = require('../../models/User.js'); -var uploadPath = "./content/client-images/"; -fs.ensureDir(uploadPath, function(err) { - //console.log(err) // => null - // dir has now been created, including the directory it is to be placed in -}) -var storage = multer.diskStorage({ - destination: function(req, file, cb) { - cb(null, uploadPath) - }, - filename: function(req, file, cb) { - var splice = file.originalname.split(':'); - cb(null, splice[0]); - } -}); -var upload = multer({storage: storage}).array('projectImages'); -var rightsManager = new RightsManager(); -/* - - Create New Client Project - -*/ -router.post('/add', function(req, res, next) { - if (!req.user) - return res.json({message: "You need to be logged in, champ."}) - User.findById(req.user._id).then((user) => { - upload(req, res, function(err) { - if (err) { - //console.log('Error in Saving Entry: ' + err); - res.json({message: err}); - throw err; - } else { - if (rightsManager.check(user.role, OBJECT_PROJECT_FOLIO, TASK_CREATE)) { - var project = new Project(req.body); - project.owner = user._id; - project.user = []; - project.comments = []; - project.tasks = []; - project.created = new Date().getTime(); - project.edited = new Date().getTime(); - if (req.files != "") { - project.images = req.files; - } else { - console.log("NOTHING TO SAVE"); - } - project.save().then((project) => { - res.json({message: "new client project added"}); - }).catch((err) => { - console.log(err); - }) - } else { - res.json({message: "Nah. You can't do that. Talk to the admin, sport."}); - } - } - }); - }).catch((err) => { - console.log(err); - }) -}); -/* - - Get Client Project List - -*/ -router.get('/', function(req, res, next) { - if (!req.user) - return res.json({message: "You need to be logged in, champ."}) - User.findById(req.user._id).then((user) => { - if ( rightsManager.check(user.role, OBJECT_POST, TASK_READ )) { - Project.find({}).then((projects) => { - res.json(projects); - }).then((users) => { - //res.json({message: "got user list"}); - }).catch((err) => { - console.log(err); - }); - } else { - res.json({message: "Nah. You can't do that. Talk to the admin, sport."}); - } - }).catch((err) => { - console.log(err); - }) -}); -/* - - Get Client Project by ID - -*/ -router.get('/:id', function(req, res, next) { - if (!req.user) - return res.json({message: "You need to be logged in, champ."}); - User.findById(req.user._id).then((user) => { - if (RightsManager.check(user.role, [RightsManager.OBJECT_PROJECT_CLIENT], RightsManager.TASK_READ)) { - Project.findById(req.params.id).then((project) => { - res.json(project); - }).catch((err) => { - console.log(err); - }); - } - }) -}); -/* - - Update Client Project by ID - -*/ -router.post('/update/:id', function(req, res, next) { - if (!req.user) - return res.json({message: "You need to be logged in, champ."}); - User.findById(req.user._id).then((user) => { - if ( rightsManager.check(user.role, OBJECT_POST, TASK_UPDATE) ) { - upload(req, res, function(err) { - if (err) { - //console.log('Error in Saving Entry: ' + err); - res.json({message: err}); - throw err; - } else { - Project.findByIdAndUpdate(req.params.id, req.body).then((project) => { - if (req.files != "") { - project.images = req.files; - } else { - console.log("NOTHING TO SAVE"); - } - project.edited = new Date().getTime(); - project.save().then((saved) => { - res.json({message: "project updated"}); - }).catch((err) => { - console.log(err); - }) - }).catch((err) => { - console.log(err); - }) - } - }); - } else { - res.json({message: "Nah. You can't do that. Talk to the admin, sport."}); - } - }); -}); -/* - - Delete Client Project by ID - -*/ -router.delete('/:id', function(req, res, next) { - if (!req.user) - return res.json({message: "users only, yo. you're not that"}); - User.findById(req.user._id).then((user) => { - if ( rightsManager.check(user.role, OBJECT_POST, TASK_DELETE) ) { - Project.findByIdAndRemove(req.params.id).then((project) => { - res.json({message: 'project has been removed'}); - }).catch((err) => { - console.log(err); - }) - } else { - res.json({message: "Nah. You can't do that. Talk to the admin, sport."}); - } - }); -}); -module.exports = router; diff --git a/brain/app.js b/brain/app.js index ce17a4f..5f70e65 100644 --- a/brain/app.js +++ b/brain/app.js @@ -16,25 +16,6 @@ app.set('view engine', 'pug'); app.use(express.static(__dirname + '../content/folio-images')); app.use(logger('dev')); -// wherever your db lives -var DATABASE_URL = 'http://are0h:pa$$@localhost:5984/forfipamo'; - -// middleware itself, preceding any parsers -app.use(function(req, res, next){ - var proxy_path = req.path.match(/^\/forfipamo(.*)$/); - if(proxy_path){ - var db_url = DATABASE_URL + proxy_path[1]; - console.log("YUP "+db_url); - console.log("METH: "+req) - req.pipe(request({ - uri: db_url, - method: req.method - })).pipe(res); - } else { - next(); - } -}); - app.use(bodyParser.json({limit: '50mb'})); app.use(bodyParser.urlencoded( { @@ -64,15 +45,10 @@ var front = require('./routes/front/index')(session); var back = require('./routes/back/index'); var postDashboard = require('./routes/back/dash_posts'); //api -var folioLibrary = require('./api/content/folio'); -var projectLibrary = require('./api/content/project'); -var bookmarkLibrary = require('./api/content/bookmarks'); var postLibrary = require('./api/content/posts'); var mailer = require('./api/content/mailer'); // API PATHS -app.use('/api/folio', folioLibrary); -app.use('/api/projects', projectLibrary); -app.use('/api/bookmarks', bookmarkLibrary); + app.use('/api/post', postLibrary); // PAGES app.use('/', front); diff --git a/brain/models/Bookmark.js b/brain/models/Bookmark.js deleted file mode 100644 index 8d8b26a..0000000 --- a/brain/models/Bookmark.js +++ /dev/null @@ -1,101 +0,0 @@ -module.exports = function (sequelize, DataTypes) { - var Bookmark = sequelize.define('Bookmark', { - id: { - type: DataTypes.INTEGER, - unique: true, - allowNull: false, - autoIncrement: true, - primaryKey: true - }, - url: { - type: DataTypes.STRING(500), - unique: false, - allowNull: true - }, - source: { - type: DataTypes.STRING(500), - allowNull: true - }, - title: { - type: DataTypes.STRING(500), - unique: false, - allowNull: true - }, - image: { - type: DataTypes.STRING(500), - unique: false, - allowNull: true - }, - comments: { - type: DataTypes.STRING, - unique: false, - allowNull: true - }, - author: { - type: DataTypes.STRING, - unique: false, - allowNull: true - }, - tags: { - type: DataTypes.ARRAY(DataTypes.TEXT), - unique: false, - allowNull: true - }, - listed: { - type: DataTypes.BOOLEAN, - unique: false, - allowNull: true - } - }, { - timestamps: true, - - // don't delete database entries but set the newly added attribute deletedAt - // to the current date (when deletion was done). paranoid will only work if - // timestamps are enabled - paranoid: true, - - // don't use camelcase for automatically added attributes but underscore style - // so updatedAt will be updated_at - underscored: true, - - // disable the modification of table names; By default, sequelize will automatically - // transform all passed model names (first parameter of define) into plural. - // if you don't want that, set the following - freezeTableName: false, - - // define the table's name - tableName: 'Bookmarks', - - // Enable optimistic locking. When enabled, sequelize will add a version count attriubte - // to the model and throw an OptimisticLockingError error when stale instances are saved. - // Set to true or a string with the attribute name you want to use to enable. - version: true - }); - - return Bookmark; -}; - -/** -var mongoose = require('mongoose'); -mongoose.Promise = require('bluebird'); - -var Bookmark = new mongoose.Schema({ - url: String, - source:String, - title:String, - image: String, - comments:Array, - created: String, - edited: String, - author:Object, - tags:Array, - listed:Boolean -}, { - collection: 'bookmarks' -}); - -module.exports = mongoose.model('Bookmark', Bookmark); - - - -**/ diff --git a/brain/models/FolioProject.js b/brain/models/FolioProject.js deleted file mode 100644 index d4f27c4..0000000 --- a/brain/models/FolioProject.js +++ /dev/null @@ -1,94 +0,0 @@ -module.exports = function (sequelize, DataTypes) { - var FolioProject = sequelize.define('FolioProject', { - type: { - type: DataTypes.STRING(500), - unique: false, - allowNull: true - }, - description: { - type: DataTypes.STRING(500), - allowNull: true - }, - url: { - type: DataTypes.STRING(500), - unique: false, - allowNull: true - }, - tools: { - type: DataTypes.STRING(500), - unique: false, - allowNull: true - }, - title: { - type: DataTypes.STRING, - unique: false, - allowNull: true - }, - slug: { - type: DataTypes.STRING, - unique: false, - allowNull: true - }, - images: { - type: DataTypes.STRING(2000), - unique: false, - allowNull: true - }, - sortIndex: { - type: DataTypes.INTEGER, - unique: false, - allowNull: true - } - }, { - timestamps: true, - - // don't delete database entries but set the newly added attribute deletedAt - // to the current date (when deletion was done). paranoid will only work if - // timestamps are enabled - paranoid: true, - - // don't use camelcase for automatically added attributes but underscore style - // so updatedAt will be updated_at - underscored: true, - - // disable the modification of table names; By default, sequelize will automatically - // transform all passed model names (first parameter of define) into plural. - // if you don't want that, set the following - freezeTableName: false, - - // define the table's name - tableName: 'Folio', - - // Enable optimistic locking. When enabled, sequelize will add a version count attriubte - // to the model and throw an OptimisticLockingError error when stale instances are saved. - // Set to true or a string with the attribute name you want to use to enable. - version: true - }); - - return FolioProject; -}; - -/** -var mongoose = require('mongoose'); -mongoose.Promise = require('bluebird'); - -var Bookmark = new mongoose.Schema({ - url: String, - source:String, - title:String, - image: String, - comments:Array, - created: String, - edited: String, - author:Object, - tags:Array, - listed:Boolean -}, { - collection: 'bookmarks' -}); - -module.exports = mongoose.model('Bookmark', Bookmark); - - - -**/ diff --git a/brain/models/Post.js b/brain/models/Post.js deleted file mode 100644 index 4967e53..0000000 --- a/brain/models/Post.js +++ /dev/null @@ -1,92 +0,0 @@ -module.exports = function (sequelize, DataTypes) { - var Post = sequelize.define('Post', { - uuid: { - type: DataTypes.STRING(50), - unique: true, - allowNull: false - }, - title: { - type: DataTypes.STRING(500), - allowNull: true - }, - slug: { - type: DataTypes.STRING(500), - unique: false, - allowNull: true - }, - tags: { - type: DataTypes.STRING(2000), - unique: false, - allowNull: true - }, - html: { - type: DataTypes.TEXT, - unique: false, - allowNull: true - }, - plaintext: { - type: DataTypes.TEXT, - unique: false, - allowNull: true - }, - feature_image: { - type: DataTypes.STRING, - unique: false, - allowNull: true - }, - page: { - type: DataTypes.BOOLEAN, - unique: false, - allowNull: true, - defaultValue: false - }, - author_id: { - type: DataTypes.INTEGER, - unique: false, - allowNull: true - }, - origin_date: { - type: DataTypes.DATE, - unique: false, - allowNull: true - }, - featured: { - type: DataTypes.BOOLEAN, - unique: false, - allowNull: true, - defaultValue: false - }, - published: { - type: DataTypes.BOOLEAN, - unique: false, - allowNull: true, - defaultValue: false - } - }, { - timestamps: true, - - // don't delete database entries but set the newly added attribute deletedAt - // to the current date (when deletion was done). paranoid will only work if - // timestamps are enabled - paranoid: true, - - // don't use camelcase for automatically added attributes but underscore style - // so updatedAt will be updated_at - underscored: true, - - // disable the modification of table names; By default, sequelize will automatically - // transform all passed model names (first parameter of define) into plural. - // if you don't want that, set the following - freezeTableName: false, - - // define the table's name - tableName: 'Posts', - - // Enable optimistic locking. When enabled, sequelize will add a version count attriubte - // to the model and throw an OptimisticLockingError error when stale instances are saved. - // Set to true or a string with the attribute name you want to use to enable. - version: true - }); - - return Post; -}; diff --git a/brain/routes/back/dash_posts.js b/brain/routes/back/dash_posts.js index 15b402e..a469961 100644 --- a/brain/routes/back/dash_posts.js +++ b/brain/routes/back/dash_posts.js @@ -40,7 +40,6 @@ router.get('/:page?', function(req, res) } var count = Math.round(filtered.length / 6); - //console.log("COUNT: "+count); var pageItems = []; var itemLimit = 6; var rangeStart = (pageNum * itemLimit) - itemLimit; @@ -48,14 +47,14 @@ router.get('/:page?', function(req, res) { try { - if (posts[i + rangeStart].id != null) + if (filtered[i + rangeStart].id != null) { pageItems.push(filtered[i + rangeStart]); } } catch (e) { - //console.log(e) + //console.log("NO POST", e) } } res.render('dash/posts-index', @@ -76,7 +75,6 @@ router.get('/:page?', function(req, res) } else { - console.log("REDIRECT") res.redirect('/@/dashboard'); } }); @@ -141,10 +139,10 @@ router.get('/edit/:id', function(req, res) }); }).then(function(value) { - console.log("VALUE: " + value); + //console.log("VALUE: " + value); }).catch(function(err) { - console.log(err); + //console.log(err); }) } else diff --git a/brain/routes/back/index.js b/brain/routes/back/index.js index 7b69af7..45727c4 100644 --- a/brain/routes/back/index.js +++ b/brain/routes/back/index.js @@ -1,11 +1,7 @@ -import DateUtils from '../../tools/utilities/DateUtils'; -var express = require('express'); -var router = express.Router(); -var Models = require('../../models'); -var hljs = require('highlight.js/lib/highlight'); -var hljs_md = require('highlight.js/lib/languages/markdown'); -hljs.registerLanguage('markdown', hljs_md); -const dateUtils = new DateUtils(); +const express = require('express'); +const router = express.Router(); +const Models = require('../../models'); +const bCrypt = require('bcrypt-nodejs'); //-------------------------- // Index //-------------------------- @@ -73,199 +69,50 @@ router.get('/settings/', function(req, res) } }); //-------------------------- -// POSTS +// Login //-------------------------- - -/** -//-------------------------- -// MAIN FIPAMO DISPLAY -//-------------------------- -router.get('/fipamo/', function (req, res) { - if (req.session.user) { - Models.Bookmark.findAll({ - order: [['id', 'DESC']] - }).then(function (saved) { - res.render('admin/admin-fipamo-index', { - title: 'Manage Saved', - mode: 'admin', - saved: saved - }); - }).then(function (value) { - //console.log(value); - }).catch(function (err) { - //next(err); - }) - } else { - res.redirect('/admin'); - } -}); - -router.get('/fipamo/edit/:id', function (req, res) { - if (req.session.user) { - Models.Bookmark.findOne({ - where: { - id: req.params.id - } - }).then(saved => { - res.render('admin/admin-fipamo-edit', { - title: 'FIPAMO | EDIT ' + saved.title, - mode: 'admin', - bookmark: saved, - edit: true - }); - }).then(function (value) { - console.log("VALUE: " + value); - }).catch(function (err) { - console.log(err); - }) - } else { - res.redirect('/admin'); - } -}); - - - -//-------------------------- -// MAIN FOLIO DISPLAY -//-------------------------- -router.get('/folio/', function (req, res) { - if (req.session.user) { - Models.FolioProject.findAll().then(function (projects) { - res.render('folio-hub', { - title: 'manage folio', - mode: 'admin', - projects: projects - }); - }).then(function (value) { - //console.log(value); - }).catch(function (err) { - //next(err); - }) - } else { - res.redirect('/admin'); - } -}); - -//-------------------------- -// PROJECT DISPLAY -//-------------------------- - -router.get('/folio/:id', function (req, res) { - if (req.session.user) { - console.log(req.params.id) - Models.FolioProject.findOne({ - where: { - slug: req.params.id - } - }).then(function (project) { - //var item = project[0] - res.render('folio-project-display', { - title: project.title, - project: project, - edit: true, - mode: 'admin' - }); - }).then(function (value) { - //console.log(value); - }).catch(function (err) { - //next(err); - }); - } else { - res.redirect('/admin'); - } -}); - -router.get('/folio/task/add', function (req, res) { - if (req.user) { - res.render('folio-project-display', { - title: 'Add New Project', - edit: false, - mode: 'admin' - }); - } else { - res.redirect('/admin'); - } -}); - - - -//-------------------------- -// ADMIN PAGE -//-------------------------- -router.get('/admin/:include/:id?', function (req, res) { - if (req.user) { - if (req.user.role == 2) { - switch (req.params.include) { - case "edit-project": - FolioProject.findById(req.params.id).exec().then(function (project) { - res.render('includes/folio-project', { - formTitle: "EDIT " + project.title, - project: project, - mode: req.params.include - }); - }).catch(function (err) { - //console.log(err) - }); - break - case "add-project": - res.render('includes/folio-project', { - formTitle: 'Fo r mle ss ADMIN | Add New Project', - mode: req.params.include - }); - break - case "folio-hub": - FolioProject.find().exec().then(function (entries) { - //res.json(entries); - res.render('content/folio-hub', { - title: 'Fo r mle ss ADMIN | Folio Manager', - entries: entries - }); - }).then(function (value) { - //console.log(value); - }).catch(function (err) { - next(err); - }); - break - } +/* Handle Login POST */ +router.post('/login', function(req, res, next) +{ + Models.User.findOne( + { + where: + { + handle: req.body.handle } - } else { - res.json({ - message: 'NOT AUTHORIZED' - }); - } -}); -router.get('/includes/admin-menu/', function (req, res) { - if (req.user) { - if (req.user == 1) { - res.render('client-panel') - } else { - res.render('includes/admin-menu', { - title: 'Fo r mle ss | Admin', - user_status: "What up, random entity", - name: "What up, " + req.user.firstname - }) + }).then(user => + { + if (!isValidPassword(user, req.body.password)) + { + return res.json( + { + message: 'CHECK YOUR PASSWORD' + }); } - } else { - res.render('index', { - title: 'Fo r mle ss', - user_status: "What up, random entity" + let session = req.session; + session.user = user; + res.redirect('/@/dashboard'); + }).catch(err => + { + return res.json( + { + message: 'NOT FOUND, HAWS' }); - } + }) }); -router.get('/content/admin/', function (req, res) { - if (req.user) { - if (req.user == 1) { - res.render('client-panel') - } else { - res.render('content/admin', { - title: 'Fo r mle ss | Admin' - }) - } - } else { - res.render('content/index', { - title: 'Fo r mle ss' - }); - } +//-------------------------- +// Logout +//-------------------------- +router.post('/logout', function(req, res, next) +{ + req.logout(); + return res.json( + { + message: 'LOGGED OUT' + }); }); -*/ -module.exports = router; \ No newline at end of file +module.exports = router; +var isValidPassword = function(user, password) +{ + return bCrypt.compareSync(password, user.password); +} \ No newline at end of file diff --git a/brain/routes/front/index.js b/brain/routes/front/index.js index f8a138a..2f09f7d 100644 --- a/brain/routes/front/index.js +++ b/brain/routes/front/index.js @@ -1,7 +1,6 @@ var express = require('express'); var router = express.Router(); var Models = require('../../models'); -var bCrypt = require('bcrypt-nodejs'); var config = require('../../../config.json'); module.exports = function (session) { //-------------------------- @@ -63,50 +62,5 @@ module.exports = function (session) { }); - - //-------------------------- - // Login - //-------------------------- - /* Handle Login POST */ - router.post('/login', function (req, res, next) { - - Models.User.findOne({ - where: { - handle: req.body.handle - } - }).then(user => { - if (!isValidPassword(user, req.body.password)) { - console.log('Invalid Password'); - //return done(null, false, req.flash('message', 'Invalid Password')); // redirect back to login page - return res.json({ - message: 'CHECK YOUR PASSWORD' - }); - } - let session = req.session; - session.user = user; - res.redirect('/@/dashboard'); - //return done(null, user); - - }).catch(err => { - console.log(err); - return res.json({ - message: 'NOT FOUND BOSS' - }); - }) - }); - - //-------------------------- - // Logout - //-------------------------- - router.post('/logout', function (req, res, next) { - req.logout(); - return res.json({ - message: 'LOGGED OUT' - }); - }); return router; -} - -var isValidPassword = function (user, password) { - return bCrypt.compareSync(password, user.password); } \ No newline at end of file diff --git a/brain/tools/utilities/RightsManager.js b/brain/tools/utilities/RightsManager.js index ecf43fb..0493929 100644 --- a/brain/tools/utilities/RightsManager.js +++ b/brain/tools/utilities/RightsManager.js @@ -145,7 +145,7 @@ export default class RightsManager //-------------------------- check(role, object, task) { - console.log(role + " *** " + object + " *** " + task); + //console.log(role + " *** " + object + " *** " + task); return roles[role][object][task]; } //-------------------------- diff --git a/themes/dash/fipamo-edit.pug b/themes/dash/fipamo-edit.pug deleted file mode 100644 index fd0d309..0000000 --- a/themes/dash/fipamo-edit.pug +++ /dev/null @@ -1,28 +0,0 @@ -extends frame -block main-content - section#saved-index-content - header.columns#header - //#float-bg - img(src='/base-assets/images/eye-beamz.png') - #header-one.column - #header-two.column - label#the-title - a(href="/") thetwelfthhouse - #the-intro - //| Twelfth House Admin - #saved-hub-display.columns - #saved-hub-title.column - label EDIT BOOKMARK - #saved-hub-main.column - a(href=bookmark.url target='_blank') SOURCE - br - input(id='saved_title' type='text', name='saved_title' class='form-control', value=bookmark.title, placeholder='saved title', autofocus) - br - input(id='saved_tags' type='text', name='saved_tags' class='form-control', value=bookmark.tags, placeholder='tags [comma seperated]', autofocus) - br - input(id='saved_image' type='text', name='saved_image' class='form-control', value=bookmark.image, placeholder='image url [comma seperated]', autofocus) - br - br - button(id="saved-sumbit-btn", class='saved-sumbit-btn', data-action='saved-edit' data-id=bookmark.id type='submit') UPDATE LINK - - diff --git a/themes/dash/fipamo-index.pug b/themes/dash/fipamo-index.pug deleted file mode 100644 index 413a7f2..0000000 --- a/themes/dash/fipamo-index.pug +++ /dev/null @@ -1,32 +0,0 @@ -extends frame -block main-content - section#saved-index-content - header.columns#header - //#float-bg - img(src='/base-assets/images/eye-beamz.png') - #header-one.column - #header-two.column - label#the-title - a(href="/") thetwelfthhouse - #the-intro - //| Twelfth House Admin - #saved-hub-display.columns - #saved-hub-title.column - label ADD NEW LINK - br - textarea(id="saved_text" name='saved_text' class='post-edit', placeholder='enter link to save', required, autofocus) - button(id="saved-sumbit-btn", class='saved-sumbit-btn', data-action='saved-add' type='submit') SAVE LINK - //a(href='/admin/fipamo/add') - i.fa.fa-plus SAVE NEW LINK - #saved-hub-main.column - label SAVED ENTRIES - br - -var index = 0; - -for (index; index { - resolve({ - response - }) - }).catch((err) => { - reject({ - err - }); - }) - }); - } - - addNewProject(uploadFiles) { - - var request = new XMLHttpRequest(); - request.open("POST", "/folio", true); - request.onload = function(oEvent) { - if (request.status == 200) { - let response = JSON.parse(request.response); - if (response.message == "New Content Entered") { - console.log("SET"); - project_form.reset(); - } else { - console.log(response.message); - } - } else { - //console.log(request); - } - }; - request.send(projectData); - } - validateForm() { - let valid = false; - if (this.entry_form.title.value == "" || this.entry_form.price.value == "" || this.entry_form.description == "") { - return valid; - } else { - valid = true; - return valid; - } - } -//-------------------------- -// event handlers -//-------------------------- -} -export { ProjectFolio as default } diff --git a/themes/dash/src/com/actions/TaskFipamo.js b/themes/dash/src/com/actions/TaskFipamo.js deleted file mode 100644 index 77aa197..0000000 --- a/themes/dash/src/com/actions/TaskFipamo.js +++ /dev/null @@ -1,72 +0,0 @@ -import DataUtils, { - REQUEST_TYPE_GET, - REQUEST_TYPE_PUT, - REQUEST_TYPE_POST, - REQUEST_TYPE_DELETE, - CONTENT_TYPE_JSON, - CONTENT_TYPE_FORM -} from '../tools/utilities/DataUtils.jsx'; -import * as DataEvent from '../tools/events/DataEvent.jsx'; -import StringUtils from '../tools/utilities/StringUtils.jsx'; -class TaskFipamo { - //-------------------------- - // constructor - //-------------------------- - constructor() { - var folio = []; - this.dataUtils = new DataUtils(); - } - //-------------------------- - // methods - //-------------------------- - start() {} - - submitLink(edit) { - let self = this; - return new Promise(function (resolve, reject) { - let link_data = ''; - let postURL; - let postEventType; - console.log('EDIT: '+edit); - if (edit) { - - //TODO: FIX TAGS,NEEDS TO BE SUBMITTED AS AN ARRAY - - link_data = { - "title": document.getElementById('saved_title').value, - "tags": document.getElementById('saved_tags').value, - "image": document.getElementById('saved_image').value - }; - let savedID = document.getElementById('saved-sumbit-btn').getAttribute('data-id'); - postURL = "/api/bookmarks/update/" + savedID; - postEventType = DataEvent.LINK_UPDATED; - console.log('url'+postURL); - } else { - link_data = { - "url": document.getElementById('saved_text').value - }; - - postURL = "/api/bookmarks/add"; - postEventType = DataEvent.LINK_ADDED; - } - console.log('POSTING'); - self.dataUtils.request(postURL, postEventType, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, link_data) - .then((response) => { - resolve({ - response - }) - }).catch((err) => { - reject({ - err - }); - }) - }); - } - //-------------------------- - // event handlers - //-------------------------- -} -export { - TaskFipamo as - default -} diff --git a/themes/dash/src/com/actions/UserAuthentication.js b/themes/dash/src/com/actions/UserAuthentication.js deleted file mode 100644 index a812c96..0000000 --- a/themes/dash/src/com/actions/UserAuthentication.js +++ /dev/null @@ -1,137 +0,0 @@ -class UserAuthentication { - //-------------------------- - // constructor - //-------------------------- - constructor() { - var self = this; - } - - //-------------------------- - // methods - //-------------------------- - start() - { - - } - - handleUserSignUp(userSignupForm) - { - //e.preventDefault(); - let signup_form = document.forms.namedItem(userSignupForm); - - let social_preferences = {"social":[ - {"service":"twitter", "url":""}, - {"service":"fb", "url":""}, - {"service":"instagram", "url":""}, - {"service":"pinterest", "url":""} - ]}; - - let mail_preferences = {"mail":[ - {"category":"video", "enabled":"false"}, - {"category":"books", "enabled":"false"}, - {"category":"graphic_novels", "enabled":"false"}, - {"category":"comics", "enabled":"false"} - ]}; - - //var oOutput = document.querySelector("div"), - let signup_handle = signup_form.handle.value; - let signup_firstname = signup_form.firstname.value; - let signup_lastname = signup_form.lastname.value; - let signup_email = signup_form.email.value; - let signup_password = signup_form.password.value; - let social = JSON.stringify(social_preferences); - let mail = JSON.stringify(mail_preferences); - - //oData.append("CustomField", "This is some extra data"); - var request = new XMLHttpRequest(); - request.open("POST", "/signup", true); - request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - request.setRequestHeader('Cache-Control', 'max-age=0'); - request.setRequestHeader('Upgrade-Insecure-Requests', '1'); - request.onload = function(oEvent) { - if (request.status == 200) { - let response = JSON.parse(request.response); - if(response.message == "USER ADDED") - { - document.body.dispatchEvent( new CustomEvent(USER_STATUS, - { - 'detail': - { - type:"USER_ADDED", - data:response.message - } - }) ); - }else{ - document.body.dispatchEvent( new CustomEvent(USER_STATUS, - { - 'detail': - { - type:"USER_NOT_ADDED", - data:response.message - } - }) ); - } - - } else { - console.log(request); - } - }; - - request.send('handle='+signup_handle+'&firstname='+signup_firstname+'&lastname='+signup_lastname+'&email='+signup_email+'&password='+signup_password+"&social="+social+"&preferences="+mail); - } - - handleUserLogin(userLoginForm) - { - //e.preventDefault(); - let login_form = document.forms.namedItem(userLoginForm); - - //var oOutput = document.querySelector("div"), - let login_handle = login_form.handle.value; - let login_password = login_form.password.value; - - //oData.append("CustomField", "This is some extra data"); - var request = new XMLHttpRequest(); - request.open("POST", "/login", true); - request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - request.setRequestHeader('Cache-Control', 'max-age=0'); - request.setRequestHeader('Upgrade-Insecure-Requests', '1'); - request.onload = function(oEvent) { - if (request.status == 200) { - let response = JSON.parse(request.response); - if(response.message == "USER FOUND") - { - document.body.dispatchEvent( new CustomEvent(USER_STATUS, - { - 'detail': - { - type:"USER_LOGIN_GOOD", - data:login_handle - } - }) ); - }else{ - document.body.dispatchEvent( new CustomEvent(USER_STATUS, - { - 'detail': - { - type:"USER_LOGIN_BAD", - data:response.message - } - }) ); - } - - } else { - console.log(request); - } - }; - - request.send('handle='+login_handle+'&password='+login_password); - } - - //-------------------------- - // event handlers - //-------------------------- - - -} -export {UserAuthentication as default} -export const USER_STATUS = "userStatus" diff --git a/themes/dash/src/com/controllers/DashManager.js b/themes/dash/src/com/controllers/DashManager.js index 1dae1c9..a1d5226 100644 --- a/themes/dash/src/com/controllers/DashManager.js +++ b/themes/dash/src/com/controllers/DashManager.js @@ -1,5 +1,3 @@ -import PostEditor from './PostEditor'; -import Animate from '../../../../../brain/tools/effects/Animate'; import PostIndex from './PostIndex'; export default class DashManager { diff --git a/themes/dash/src/com/controllers/DisplayAdminFipamo.js b/themes/dash/src/com/controllers/DisplayAdminFipamo.js deleted file mode 100644 index fff2b61..0000000 --- a/themes/dash/src/com/controllers/DisplayAdminFipamo.js +++ /dev/null @@ -1,25 +0,0 @@ - -class DisplayAdminFipamo { - //-------------------------- - // constructor - //-------------------------- - constructor() { - this.start(); - } - //-------------------------- - // methods - //-------------------------- - - start() { - - } - - //-------------------------- - // event handlers - //-------------------------- -} - -export { - DisplayAdminFipamo as - default -} diff --git a/themes/dash/src/com/controllers/DisplayAdminFolio.js b/themes/dash/src/com/controllers/DisplayAdminFolio.js deleted file mode 100644 index 36dc716..0000000 --- a/themes/dash/src/com/controllers/DisplayAdminFolio.js +++ /dev/null @@ -1,75 +0,0 @@ -import DataUtils, { - REQUEST_TYPE_GET, - REQUEST_TYPE_PUT, - REQUEST_TYPE_POST, - REQUEST_TYPE_DELETE, - CONTENT_TYPE_JSON, - CONTENT_TYPE_FORM -} from '../tools/utilities/DataUtils.jsx'; -import * as DataEvent from '../tools/events/DataEvent.jsx'; -import ProjectFolio from '../tasks/ProjectFolio.jsx'; -import Animate from '../tools/effects/Animate.jsx'; -import * as Ease from '../tools/effects/Animate.jsx'; -class DisplayAdminFolio { - //-------------------------- - // constructor - //-------------------------- - constructor() { - var self = this; - this.uploadFiles; - this.start(); - } - //-------------------------- - // methods - //-------------------------- - start() { - let self = this; - new Animate().object({ - targets: document.getElementById('loader'), - duration: 300, - opacity: 0, - easing: 'easeInOutQuad', - complete: function () { - document.getElementById('loader').style.display = 'none'; - document.getElementById('loader').style.visibility = 'hidden'; - if (document.getElementById('project-list')) { - sortable('.project-list', { - handle: '.drag-handle' - })[0].addEventListener('sortupdate', function (e) { - let sortList = []; - let sortItems = document.getElementById('project-list').children; - for (var i = 0; i < sortItems.length; i++) { - sortList.push({ - 'sortIndex': i, - 'sortID': sortItems[i].getAttribute('data-id') - }); - } - new DataUtils().request('/api/folio/sort', DataEvent.PROJECTS_SORTED, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, sortList) - .then((response) => { - console.log(JSON.parse(response.request)) - }).catch((err) => { - console.log(err) - }) - }); - } - new Animate().object({ - targets: document.getElementById('header'), - duration: 10, - opacity: 1, - easing: 'easeInOutQuad', - complete: function () {} - }); - } - }); - - } - //-------------------------- - // event handlers - //-------------------------- - -} -DisplayAdminFolio.uploadFiles = []; -export { - DisplayAdminFolio as - default -} diff --git a/themes/dash/src/com/controllers/DisplayBlog.js b/themes/dash/src/com/controllers/DisplayBlog.js deleted file mode 100644 index 72f8a3a..0000000 --- a/themes/dash/src/com/controllers/DisplayBlog.js +++ /dev/null @@ -1,36 +0,0 @@ -//TOOLS -import DataUtils, { - REQUEST_TYPE_GET, - REQUEST_TYPE_PUT, - REQUEST_TYPE_POST, - REQUEST_TYPE_DELETE, - CONTENT_TYPE_JSON, - CONTENT_TYPE_FORM -} from '../tools/utilities/DataUtils.jsx'; -import * as DataEvent from '../tools/events/DataEvent.jsx'; -import Animate from '../tools/effects/Animate.jsx'; -import * as Ease from '../tools/effects/Animate.jsx'; -import TextEffects from '../tools/effects/TextEffects.jsx'; -class DisplayBlog { - //-------------------------- - // constructor - //-------------------------- - constructor() { - reframe('iframe'); - this.start(); - } - //-------------------------- - // methods - //-------------------------- - start() { - console.log("START BLOG"); - } - //-------------------------- - // event handlers - //-------------------------- - -} -export { - DisplayBlog as - default -} diff --git a/themes/dash/src/com/controllers/DisplayClient.js b/themes/dash/src/com/controllers/DisplayClient.js deleted file mode 100644 index 50fae31..0000000 --- a/themes/dash/src/com/controllers/DisplayClient.js +++ /dev/null @@ -1,79 +0,0 @@ -//TOOLS -import DataUtils, { - REQUEST_TYPE_GET, - REQUEST_TYPE_PUT, - REQUEST_TYPE_POST, - REQUEST_TYPE_DELETE, - CONTENT_TYPE_JSON, - CONTENT_TYPE_FORM -} from '../tools/utilities/DataUtils.jsx'; -import * as DataEvent from '../tools/events/DataEvent.jsx'; -import Animate from '../tools/effects/Animate.jsx'; -import * as Ease from '../tools/effects/Animate.jsx'; -import TextEffects from '../tools/effects/TextEffects.jsx'; -//Client-side Pages -import DisplayIndex from './DisplayIndex.jsx'; -import DisplayWork from './DisplayWork.jsx'; -import DisplayBlog from './DisplayBlog.jsx'; -import DisplayFi from './DisplayFi.jsx'; - -class DisplayClient { - //-------------------------- - // constructor - //-------------------------- - constructor(section, page) { - this.section = section; - this.page = page; - this.current = null; - this.start(); - } - //-------------------------- - // methods - //-------------------------- - start() { - let self = this; - new Animate().object({ - targets: document.getElementById('loader'), - duration: 300, - opacity: 0, - easing: 'easeInOutQuad', - complete: function () { - document.getElementById('loader').style.display = 'none'; - document.getElementById('loader').style.visibility = 'hidden'; - new Animate().object({ - targets: document.getElementById('header'), - duration: 10, - opacity: 1, - easing: 'easeInOutQuad', - complete: function () { - new TextEffects().scramble(document.getElementById('the-title'), 50, function () { - switch(self.section){ - case "blog": - self.current = new DisplayBlog(); - break - case "work": - self.current = new DisplayWork(); - break - case "fipamo": - self.current = new DisplayFi(); - break - default: - self.current = new DisplayIndex(); - break - } - - }); - } - }); - } - }); - } - //-------------------------- - // event handlers - //-------------------------- - -} -export { - DisplayClient as - default -} diff --git a/themes/dash/src/com/controllers/DisplayFi.js b/themes/dash/src/com/controllers/DisplayFi.js deleted file mode 100644 index ae309cb..0000000 --- a/themes/dash/src/com/controllers/DisplayFi.js +++ /dev/null @@ -1,35 +0,0 @@ -export const DisplayID = "Display-Fi"; -import DataUtils, { REQUEST_TYPE_GET, REQUEST_TYPE_PUT, REQUEST_TYPE_POST, REQUEST_TYPE_DELETE, CONTENT_TYPE_JSON, CONTENT_TYPE_FORM } from '../tools/utilities/DataUtils.jsx'; -import * as DataEvent from '../tools/events/DataEvent.jsx'; -import Animate from '../tools/effects/Animate.jsx'; -import * as Ease from '../tools/effects/Animate.jsx'; -import TextEffects from '../tools/effects/TextEffects.jsx'; -class DisplayFi { - //-------------------------- - // constructor - //-------------------------- - constructor() { - this.dataUtils = new DataUtils(); - //this.mailer = new Mailer(); - this.start(); - } - //-------------------------- - // methods - //-------------------------- - start() { - let self = this; - console.log("START BOOKMARKS"); - - } - - //-------------------------- - // event handlers - //-------------------------- - - - - - -} -export { DisplayFi as default } - diff --git a/themes/dash/src/com/controllers/DisplayIndex.js b/themes/dash/src/com/controllers/DisplayIndex.js deleted file mode 100644 index 0bc5f26..0000000 --- a/themes/dash/src/com/controllers/DisplayIndex.js +++ /dev/null @@ -1,65 +0,0 @@ -//TOOLS -import DataUtils, { - REQUEST_TYPE_GET, - REQUEST_TYPE_PUT, - REQUEST_TYPE_POST, - REQUEST_TYPE_DELETE, - CONTENT_TYPE_JSON, - CONTENT_TYPE_FORM -} from '../tools/utilities/DataUtils.jsx'; -import * as DataEvent from '../tools/events/DataEvent.jsx'; -import Animate from '../tools/effects/Animate.jsx'; -import * as Ease from '../tools/effects/Animate.jsx'; -import TextEffects from '../tools/effects/TextEffects.jsx'; -class DisplayIndex { - //-------------------------- - // constructor - //-------------------------- - constructor() { - this.start(); - } - //-------------------------- - // methods - //-------------------------- - start() { - document.getElementById('the-intro').style.opacity = 1; - - new Animate().object({ - targets: document.getElementById('recent-work'), - duration: 200, - opacity: 1, - easing: 'easeInOutQuad', - complete: function () { - - } - }); - - new Animate().object({ - targets: document.getElementById('recent-blog'), - duration: 500, - opacity: 1, - easing: 'easeInOutQuad', - complete: function () { - - } - }); - - new Animate().object({ - targets: document.getElementById('float-bg'), - duration: 2000, - opacity: 1, - easing: 'easeInQuad', - complete: function () { - - } - }); - } - //-------------------------- - // event handlers - //-------------------------- - -} -export { - DisplayIndex as - default -} diff --git a/themes/dash/src/com/controllers/DisplayWork.js b/themes/dash/src/com/controllers/DisplayWork.js deleted file mode 100644 index 4ebb95f..0000000 --- a/themes/dash/src/com/controllers/DisplayWork.js +++ /dev/null @@ -1,130 +0,0 @@ -export const DisplayID = "Display-Work"; -import DataUtils, { - REQUEST_TYPE_GET, - REQUEST_TYPE_PUT, - REQUEST_TYPE_POST, - REQUEST_TYPE_DELETE, - CONTENT_TYPE_JSON, - CONTENT_TYPE_FORM -} from '../tools/utilities/DataUtils.jsx'; -import * as DataEvent from '../tools/events/DataEvent.jsx'; -import Animate from '../tools/effects/Animate.jsx'; -import * as Ease from '../tools/effects/Animate.jsx'; -import TextEffects from '../tools/effects/TextEffects.jsx'; -import Mailer from '../tasks/Mailer.jsx' -class DisplayWork { - //-------------------------- - // constructor - //-------------------------- - constructor() { - this.dataUtils = new DataUtils(); - this.mailer = new Mailer(); - this.start(); - } - //-------------------------- - // methods - //-------------------------- - start() { - let self = this; - if (document.getElementById('work-display')) { - new Animate().object({ - targets: document.getElementById('work-display'), - duration: 500, - opacity: 1, - easing: 'easeInOutQuad', - complete: function () { - self.sortItemList(); - new Animate().object({ - targets: document.getElementById('float-bg'), - duration: 2000, - opacity: 1, - easing: 'easeInQuad', - complete: function () { - - } - }); - } - }); - - new Animate().object({ - targets: document.getElementById('work-header'), - duration: 500, - opacity: 1, - easing: 'easeInOutQuad', - complete: function () { - - } - }); - } else { - new Animate().object({ - targets: document.getElementById('folio-header'), - duration: 500, - opacity: 1, - easing: 'easeInOutQuad', - complete: function () { - self.showFolioImages(); - } - }); - } - } - sortItemList() { - let workItems = document.getElementById('work-list').children; - let trans = 300; - let self = this; - for (var i = 0; i < workItems.length; i++) { - //item.addEventListener('click', f => this.handleWorkList(f)) - - new Animate().object({ - targets: workItems[i], - duration: trans, - opacity: 1, - easing: 'easeInOutQuad', - complete: function () { - //self.showFolioImages(); - } - }); - - trans = trans + 200; - if (i == workItems.length - 1) { - - new Animate().object({ - targets: document.getElementById('contact'), - duration: 300, - opacity: 1, - easing: 'easeInOutQuad', - complete: function () { - //self.showFolioImages(); - } - }); - - } - } - } - - showFolioImages() { - let images = document.getElementById('project-images').children; - let trans = 300; - let self = this; - for (var i = 0; i < images.length; i++) { - //item.addEventListener('click', f => this.handleWorkList(f)) - - new Animate().object({ - targets: images[i], - duration: trans, - opacity: 1, - easing: 'easeInOutQuad', - complete: function () { - //self.showFolioImages(); - } - }); - trans = trans + 200 - } - } - //-------------------------- - // event handlers - //-------------------------- -} -export { - DisplayWork as - default -} diff --git a/themes/dash/src/com/controllers/PostIndex.js b/themes/dash/src/com/controllers/PostIndex.js index 23e5301..6af6afc 100644 --- a/themes/dash/src/com/controllers/PostIndex.js +++ b/themes/dash/src/com/controllers/PostIndex.js @@ -1,4 +1,3 @@ -import Animate from '../../../../../brain/tools/effects/Animate'; import PostEditor from './PostEditor'; export default class PostIndex { diff --git a/themes/dash/src/styles/dash.styl b/themes/dash/src/styles/dash.styl index 6b673d3..53055b5 100644 --- a/themes/dash/src/styles/dash.styl +++ b/themes/dash/src/styles/dash.styl @@ -63,22 +63,6 @@ @import "main/_settings" -/** -------------------------------- --- Fipamo -------------------------------- -**/ - -@import "main/_fipamo" - -/** -------------------------------- --- Folio -------------------------------- -**/ - -@import 'main/_folio' - /** ------------------------------- -- Forms diff --git a/themes/dash/src/styles/main/_fipamo.styl b/themes/dash/src/styles/main/_fipamo.styl deleted file mode 100644 index 085bbb9..0000000 --- a/themes/dash/src/styles/main/_fipamo.styl +++ /dev/null @@ -1,71 +0,0 @@ -#bm-content - width 100% - max-width 1024px - margin 0 auto - #header-one, #header-two - label#the-title - a(href="/") thetwelfthhouse - #header-two - font 400 1.5em $bodyType - #bookmark-display - padding 0 - .bookmark-list - .bookmark-entry - background lightness($primary, 15%) - width 50% - height 500px - background-size cover - overflow hidden - display inline-block - vertical-align top - //border-radius 3px - padding 10px - .bookmark-info - display flex - align-items center - justify-content center - width 100% - height 100% - label - display block - font-size .5em - padding 10px - background $primary - border-radius 5px - #paginate-control - width 100% - height 300px - background lightness($primary, 30%) - display: flex; - align-items: center; - justify-content: center; - - #paginate - - margin 0 auto - a, label - display inline-block - vertical-align top - label - padding 5px - color $tertiary - font-size 2.2em - a - padding 20px - margin-top 4px - - -/** -------------------------------- --- Responsive -------------------------------- -**/ - -@media only screen and (max-width: 768px) - #bm-content - #bookmark-display - .bookmark-list - .bookmark-entry - width 100% - - diff --git a/themes/dash/src/styles/main/_folio.styl b/themes/dash/src/styles/main/_folio.styl deleted file mode 100644 index 446311b..0000000 --- a/themes/dash/src/styles/main/_folio.styl +++ /dev/null @@ -1,96 +0,0 @@ -#work-content - width 100% - max-width 1024px - margin 0 auto - #header - #header-two - p - font 400 1.5em $bodyType - span - color $secondary - #work-display - padding 0 - margin 0 0 40px 0 - opacity 0 - - - #work-list - - .work-item - width 50% - height 300px - display inline-block - vertical-align top - background-size cover - background-color $tertiary - color $tertiary - span - font 600 .7em $titleType - - #work-contact - #contact-form - opacity 1 - label - font 600 .8em $titleType - color $highlight - margin 0 0 15px 0 - display block - #request-form - input[type=email], input[type=password], input[type=text] - width 100% - margin 0 10px 10px 0 - - select - width 100% - margin-bottom: 10px; - - textarea - width: 100% - #contact-info - label#request-status - font 600 .8em $titleType - color $highlight - margin 0 0 15px 0 - display block - text-transform uppercase - p - font 400 1em $bodyType - color $tertiary - i - color $highlight - - -#project-content - width 100% - max-width 1024px - margin 0 auto - #project-display - padding: 0 20px 20px 20px - - #project-info - span - font 400 2em $titleType - color $white - #project-desc - font 300 1.2em $bodyType - color $tertiary - #project-images - margin 10px 0 0 0 - opacity 1 - .folio-image - width 100% - margin 0 0 50px 0 - opacity 0 - -/** -------------------------------- --- Responsive -------------------------------- -**/ - -@media screen and (max-width: 768px) - #work-content - #work-list - .work-item - width 100% - diff --git a/themes/tim-duncan.js b/themes/tim-duncan.js deleted file mode 100644 index 182eef0..0000000 --- a/themes/tim-duncan.js +++ /dev/null @@ -1,35 +0,0 @@ -importScripts('./workbox-sw.js'); - -if (workbox) { - //console.log(`Yay! Workbox is loaded 🎉`); -} else { - //console.log(`Boo! Workbox didn't load 😬`); -} - -workbox.routing.registerRoute( - new RegExp('.*\.js'), - workbox.strategies.networkFirst({ - cacheName: 'script' -}) -); - -workbox.routing.registerRoute( - new RegExp('.*\.css'), - workbox.strategies.networkFirst({ - cacheName: 'style' -}) -); - -workbox.routing.registerRoute( - new RegExp('.*\.(?:png|jpg|jpeg|svg|gif)'), - workbox.strategies.networkFirst({ - cacheName: 'images' -}) -); - -workbox.routing.registerRoute( - new RegExp('/@/dashboard'), - workbox.strategies.networkFirst({ - cacheName: 'pages' -})); - diff --git a/themes/workbox-sw.js b/themes/workbox-sw.js deleted file mode 100644 index b03e1c4..0000000 --- a/themes/workbox-sw.js +++ /dev/null @@ -1,3 +0,0 @@ -var workbox=function(){"use strict";try{self.workbox.v["workbox:sw:3.6.3"]=1}catch(t){}const t="https://storage.googleapis.com/workbox-cdn/releases/3.6.3",e={backgroundSync:"background-sync",broadcastUpdate:"broadcast-cache-update",cacheableResponse:"cacheable-response",core:"core",expiration:"cache-expiration",googleAnalytics:"google-analytics",navigationPreload:"navigation-preload",precaching:"precaching",rangeRequests:"range-requests",routing:"routing",strategies:"strategies",streams:"streams"};return new class{constructor(){return this.v={},this.t={debug:"localhost"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?"dev":"prod",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error("Config must be set before accessing workbox.* modules");Object.assign(this.t,t),this.e=this.t.debug?"dev":"prod"}skipWaiting(){self.addEventListener("install",()=>self.skipWaiting())}clientsClaim(){self.addEventListener("activate",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&""===(s=r.split("/"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join("/")}}}(); - -//# sourceMappingURL=workbox-sw.js.map diff --git a/themes/workbox-sw.js.map b/themes/workbox-sw.js.map deleted file mode 100644 index c5b3a6c..0000000 --- a/themes/workbox-sw.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"mappings":"","sources":["packages/workbox-sw/browser.mjs"],"sourcesContent":["var workbox=function(){\"use strict\";try{self.workbox.v[\"workbox:sw:3.6.3\"]=1}catch(t){}const t=\"https://storage.googleapis.com/workbox-cdn/releases/3.6.3\",e={backgroundSync:\"background-sync\",broadcastUpdate:\"broadcast-cache-update\",cacheableResponse:\"cacheable-response\",core:\"core\",expiration:\"cache-expiration\",googleAnalytics:\"google-analytics\",navigationPreload:\"navigation-preload\",precaching:\"precaching\",rangeRequests:\"range-requests\",routing:\"routing\",strategies:\"strategies\",streams:\"streams\"};return new class{constructor(){return this.v={},this.t={debug:\"localhost\"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?\"dev\":\"prod\",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error(\"Config must be set before accessing workbox.* modules\");Object.assign(this.t,t),this.e=this.t.debug?\"dev\":\"prod\"}skipWaiting(){self.addEventListener(\"install\",()=>self.skipWaiting())}clientsClaim(){self.addEventListener(\"activate\",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&\"\"===(s=r.split(\"/\"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join(\"/\")}}}();\n"],"file":"workbox-sw.js"} \ No newline at end of file