removed service workers, removed a ton of legacy code
parent
3c410eb1b7
commit
3845ca9552
@ -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;
|
@ -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;
|
@ -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;
|
@ -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);
|
||||
|
||||
|
||||
|
||||
**/
|
@ -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);
|
||||
|
||||
|
||||
|
||||
**/
|
@ -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;
|
||||
};
|
@ -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
|
||||
|
||||
|
@ -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<saved.length; index++)
|
||||
-var saved_title = saved[index].title
|
||||
if(saved_title == null || saved_title == '')
|
||||
-saved_title = 'Saved Entry '+saved[index].id
|
||||
a(href='/admin/fipamo/edit/'+saved[index].id)
|
||||
span= saved_title
|
||||
br
|
||||
|
@ -1,21 +0,0 @@
|
||||
extends frame
|
||||
block main-content
|
||||
header.header#header
|
||||
//a(href='/')
|
||||
img(src='/base-assets/images/the-logo.svg')
|
||||
br
|
||||
.header-desc
|
||||
span#the-title
|
||||
a(href="/") thetwelfthhouse
|
||||
#the-intro
|
||||
| Work header
|
||||
.folio-hub#folio-hub
|
||||
a.btn-add-project(href="/admin/folio/task/add")
|
||||
i.fa.fa-plus-circle.fa-2x
|
||||
span Add New Project
|
||||
.project-list#project-list
|
||||
each project, index in projects
|
||||
.project-item(data-id=project._id)
|
||||
span.drag-handle
|
||||
i.fa.fa-arrows-v
|
||||
a.project-label#edit-project(href="/admin/folio/"+project.slug)= project.title
|
@ -1,39 +0,0 @@
|
||||
extends frame
|
||||
block main-content
|
||||
div.folio-project-form#folio-project-form
|
||||
form(class='folio-project', name="folio-project", enctype="multipart/form-data")
|
||||
//i.fa.fa-minus-circle.fa-spin.icon-loading#icon-loading
|
||||
span= formTitle
|
||||
br
|
||||
if edit
|
||||
-var title = project.title
|
||||
-var tools = project.tools
|
||||
-var url = project.url
|
||||
-var desc = project.description
|
||||
//-document.getElementById('type').selectedIndex = 1;
|
||||
input(type='text', name='title' class='', placeholder='Enter Project Title', value= title, required, autofocus)
|
||||
input(type='text', id="tools" name='tools' class='', placeholder='Tools Used', value= tools, required, autofocus)
|
||||
input(type='text', name='url' class='', placeholder='Project URL', required, value= url, autofocus)
|
||||
select#type(name="type", form="folio-type'")
|
||||
option(value="option00") Select Project Type
|
||||
option(value="option01") Design and Development
|
||||
option(value="option02") Web Design/Front End Development
|
||||
option(value="option03") Web Development
|
||||
option(value="option04") Logo/Branding
|
||||
br
|
||||
textarea(rows="9" cols="52" name='description' class='', placeholder='Description', required, autofocus) #{desc}
|
||||
br
|
||||
.upload-drop#upload-drop
|
||||
| Drag and Drop files to upload
|
||||
label(for="upload-click") or click to select
|
||||
|
||||
br
|
||||
if edit
|
||||
button(id="btn-submit", class='folio-btn-edit', type='submit', data-action='folio-update' data-id=project.id) UPDATE_PROJECT
|
||||
else
|
||||
button(id="btn-submit", class='folio-btn-add', type='submit', data-action='folio-add') ADD_PROJECT
|
||||
|
||||
.upload-list#upload-list
|
||||
span Files to Upload
|
||||
.thumb-list#thumb-list
|
||||
input(id="upload-click" type="file" name="uploaded" multiple)
|
@ -1,14 +0,0 @@
|
||||
div.project-display#project-display
|
||||
i.fa.fa-arrow-circle-left.fa-2x#return-home
|
||||
div.project-meta#project-meta
|
||||
p project_details
|
||||
label= project.title
|
||||
label= project.type
|
||||
label= project.tools
|
||||
label=project.url
|
||||
p= project.description
|
||||
ul.image-list#image-list
|
||||
each image, index in project.images
|
||||
-var path = String(project.images[index].path).substring(7, project.images[index].path.length)
|
||||
li.slide-holder(id="slide-holder-"+[index])
|
||||
img.slide(id="slide-"+[index], src=path)
|
@ -1,10 +0,0 @@
|
||||
div.user-form#user-form-signup
|
||||
form(class='signup', name="signup" action="/signup" method="POST")
|
||||
label ://apply_for_entry/
|
||||
br
|
||||
input(type='text', name='handle' class='form-control', placeholder='handle', required, autofocus)
|
||||
input(type='text', name='firstname' class='form-control', placeholder='firstname',required, autofocus)
|
||||
input(type='text', name='lastname' class='form-control', placeholder='lastname',required, autofocus)
|
||||
input(type='text', name='email' class='form-control', placeholder='email',required, autofocus)
|
||||
input(type='password', name='password' class='form-control', placeholder='password', required)
|
||||
button(id="signin-btn", class='signin-btn', type='submit') INIT_ACCOUNT
|
@ -1,101 +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 ProjectFolio {
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {
|
||||
var folio = [];
|
||||
this.dataUtils = new DataUtils();
|
||||
}
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
start() {}
|
||||
|
||||
submitProject(edit, uploadFiles) {
|
||||
let self = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
//collect form data
|
||||
//if(!this.validateForm())
|
||||
var projectData = new FormData();
|
||||
//let projectImages = document.getElementById('projectImages');
|
||||
//var fileSelect = projectImages;
|
||||
var files = uploadFiles;
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var file = files[i];
|
||||
// Check the file type.
|
||||
if (!file.type.match('image.*')) {
|
||||
continue;
|
||||
}
|
||||
// Add the file to the request.
|
||||
projectData.append('folioImages', file, file.name);
|
||||
}
|
||||
var category = document.getElementById("content_category");
|
||||
let project_form = document.forms.namedItem("folio-project");
|
||||
projectData.append("title", project_form.title.value);
|
||||
projectData.append('slug', new StringUtils().cleanString(project_form.title.value));
|
||||
projectData.append("tools", project_form.tools.value);
|
||||
projectData.append("url", project_form.url.value);
|
||||
projectData.append("description", project_form.description.value);
|
||||
projectData.append("type", type.options[type.selectedIndex].text);
|
||||
|
||||
let postURL
|
||||
let postEventType
|
||||
|
||||
if (edit) {
|
||||
let postID = document.getElementById('btn-submit').getAttribute('data-id');
|
||||
postURL = "/api/folio/update/" + postID;
|
||||
postEventType = DataEvent.PROJECT_UPDATED;
|
||||
} else {
|
||||
postURL = "/api/folio/add";
|
||||
postEventType = DataEvent.PROJECT_ADDED;
|
||||
}
|
||||
|
||||
self.dataUtils.request(postURL, postEventType, REQUEST_TYPE_POST, CONTENT_TYPE_FORM, projectData)
|
||||
.then((response) => {
|
||||
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 }
|
@ -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
|
||||
}
|
@ -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"
|
@ -1,25 +0,0 @@
|
||||
|
||||
class DisplayAdminFipamo {
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {
|
||||
this.start();
|
||||
}
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
|
||||
start() {
|
||||
|
||||
}
|
||||
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
}
|
||||
|
||||
export {
|
||||
DisplayAdminFipamo as
|
||||
default
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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 }
|
||||
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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%
|
||||
|
||||
|
@ -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%
|
||||
|
@ -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'
|
||||
}));
|
||||
|
@ -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
|
@ -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"}
|
Loading…
Reference in New Issue