This commit is contained in:
Yaman Qalieh 2016-08-31 23:22:08 -04:00
commit 2e80cdf2fb
4 changed files with 8 additions and 32 deletions

View File

@ -189,8 +189,9 @@
{{#if inRole}} {{#if inRole}}
{{#if newWork}} {{#if newWork}}
<div id="workSubmit">Save</div> <div id="workSubmit">Save</div>
{{else}}
<div id="workDelete">Delete</div>
{{/if}} {{/if}}
<div id="workDelete">Delete</div>
{{/if}} {{/if}}
</div> </div>
</div> </div>

View File

@ -150,22 +150,12 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective
}); });
Template.registerHelper('pref', (val) => { // Obtains all user preferences. Template.registerHelper('pref', (val) => { // Obtains all user preferences.
if(Meteor.user().profile.preferences === undefined) return; var preferences = Meteor.user().profile.preferences;
if(Object.keys(Meteor.user().profile.preferences).length !== Object.keys(defaults).length) { // Invalid preference checking. if(val === 'timeHide' || val === 'done') {
var array = Meteor.user().profile; var invert = _.invert(ref);
array.preferences = defaults; return invert[preferences[val]];
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);
return invert[preferences[val]];
}
return preferences[val].charAt(0).toUpperCase() + preferences[val].slice(1);
} }
return preferences[val].charAt(0).toUpperCase() + preferences[val].slice(1);
}); });
Template.main.helpers({ Template.main.helpers({
@ -376,6 +366,7 @@ Template.main.helpers({
return Session.get("newWork"); return Session.get("newWork");
}, },
inRole() { // Checks correct permissions. inRole() { // Checks correct permissions.
if(Session.get("currentWork") === null) return;
if(Session.get("newWork")) { if(Session.get("newWork")) {
return true; return true;
} else { } else {

View File

@ -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. mainCenter() { // Centers main div container.
var width = window.innerWidth * 1600 / 1920 + 10; var width = window.innerWidth * 1600 / 1920 + 10;
return "width:" + width.toString() + "px;margin-left:" + -0.5 * width.toString() + "px"; return "width:" + width.toString() + "px;margin-left:" + -0.5 * width.toString() + "px";

View File

@ -26,11 +26,4 @@ themeColors = {
} }
}; };
defaults = {
"theme":"light",
"mode":"classes",
"timeHide":1,
"done": true
};
serverData = null; serverData = null;