diff --git a/README.md b/README.md index 512f846..1ca66b0 100644 --- a/README.md +++ b/README.md @@ -162,9 +162,10 @@ server { proxy_cache_bypass $http_upgrade; } } +``` - -#admin.jrtechs.net.con +``` +#admin.jrtechs.net.conf server { listen 80; server_name www.admin.jrtechs.net admin.jrtechs.net; diff --git a/admin/admin.js b/admin/admin.js index 9599f4f..57fe199 100644 --- a/admin/admin.js +++ b/admin/admin.js @@ -1,16 +1,20 @@ +/** + * Renders the admin page contents + */ + +//file IO const utils = require('../utils/utils.js'); -const Promise = require('promise'); + module.exports= { /** * Method calls the admin widgets it correct order * - * @param fileName * @param request * @return {*|Promise} */ - main: function(fileName, request) + main: function(request) { return new Promise(function(resolve, reject) { @@ -18,10 +22,10 @@ module.exports= { utils.getPostData(request).then(function (postData) { - Promise.all([require("../admin/newPost.js").main(postData), - require("../admin/addCategory.js").main(postData), - require("../admin/editPost.js").main(postData), - require("./manageDownloads.js").main(postData)]) + Promise.all([require("./posts/newPost.js").main(postData), + require("./category/addCategory.js").main(postData), + require("./posts/editPost.js").main(postData), + require("./downloads/manageDownloads.js").main(postData)]) .then(function(content) { resolve(content.join('')); @@ -33,14 +37,13 @@ module.exports= } else { - //login page - console.log("login page"); - require("../admin/login.js").main(request).then(function(html) + require("./login/login.js").main(request).then(function(html) { resolve(html); }).catch(function(err) { console.log(err); + reject(err); }) } }); diff --git a/admin/analytics/analytics.js b/admin/analytics/analytics.js new file mode 100644 index 0000000..d52eaf3 --- /dev/null +++ b/admin/analytics/analytics.js @@ -0,0 +1,24 @@ + + + +module.exports= + { + main: function(postData) + { + return new Promise(function(resolve, reject) + { + Promise.all([utils.include("./admin/addCategory.html"), + printCategories(), + processPost(postData)]).then(function(html) + { + resolve("