From 2b96ce9d4fec1c510a1c842e1fdc0e2df810bf6f Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Wed, 31 Aug 2016 23:08:12 -0400 Subject: [PATCH] Removed defaults client side --- hourglass/client/main/main.html | 3 ++- hourglass/client/main/main.js | 10 +--------- hourglass/client/profile/profile.js | 9 --------- hourglass/lib/constants.js | 7 ------- 4 files changed, 3 insertions(+), 26 deletions(-) diff --git a/hourglass/client/main/main.html b/hourglass/client/main/main.html index b78f2b1..4b8478d 100644 --- a/hourglass/client/main/main.html +++ b/hourglass/client/main/main.html @@ -189,8 +189,9 @@ {{#if inRole}} {{#if newWork}}
Save
+ {{else}} +
Delete
{{/if}} -
Delete
{{/if}} diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 719526d..07929ed 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -150,15 +150,6 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective }); Template.registerHelper('pref', (val) => { // Obtains all user preferences. - if(Meteor.user().profile.preferences === undefined) return; - if(Object.keys(Meteor.user().profile.preferences).length !== Object.keys(defaults).length) { // Invalid preference checking. - var array = Meteor.user().profile; - array.preferences = defaults; - serverData = array; - sendData("editProfile"); - if(val === 'timeHide' || val === 'done') return defaults[val]; - return defaults[val].charAt(0).toUpperCase() + defaults[val].slice(1); - } else { var preferences = Meteor.user().profile.preferences; if(val === 'timeHide' || val === 'done') { var invert = _.invert(ref); @@ -376,6 +367,7 @@ Template.main.helpers({ return Session.get("newWork"); }, inRole() { // Checks correct permissions. + if(Session.get("currentWork") === null) return; if(Session.get("newWork")) { return true; } else { diff --git a/hourglass/client/profile/profile.js b/hourglass/client/profile/profile.js index c69c87c..3a8d6cd 100644 --- a/hourglass/client/profile/profile.js +++ b/hourglass/client/profile/profile.js @@ -58,15 +58,6 @@ Template.profile.helpers({ }] }; }, - loadNew() { - if(Meteor.user().profile.preferences === undefined) { - var profile = Meteor.user().profile; - profile.preferences = defaults; - serverData = profile; - sendData("editProfile"); - } - return; - }, mainCenter() { // Centers main div container. var width = window.innerWidth * 1600 / 1920 + 10; return "width:" + width.toString() + "px;margin-left:" + -0.5 * width.toString() + "px"; diff --git a/hourglass/lib/constants.js b/hourglass/lib/constants.js index adc90ad..0e9d36c 100644 --- a/hourglass/lib/constants.js +++ b/hourglass/lib/constants.js @@ -26,11 +26,4 @@ themeColors = { } }; -defaults = { - "theme":"light", - "mode":"classes", - "timeHide":1, - "done": true -}; - serverData = null;