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 newWork}}
<div id="workSubmit">Save</div>
{{else}}
<div id="workDelete">Delete</div>
{{/if}}
<div id="workDelete">Delete</div>
{{/if}}
</div>
</div>

View File

@ -150,22 +150,12 @@ 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);
return invert[preferences[val]];
}
return preferences[val].charAt(0).toUpperCase() + preferences[val].slice(1);
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);
});
Template.main.helpers({
@ -376,6 +366,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 {

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.
var width = window.innerWidth * 1600 / 1920 + 10;
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;