upgrade theme structure

This commit is contained in:
Yaman Qalieh 2016-09-29 23:39:34 -04:00
parent a6756158a3
commit 6acb02aa7d
5 changed files with 62 additions and 36 deletions

View File

@ -13,12 +13,12 @@ babel-compiler@6.9.1
babel-runtime@0.1.11
base64@1.0.9
binary-heap@1.0.9
blaze@2.1.8
blaze-html-templates@1.0.4
blaze-tools@1.0.9
boilerplate-generator@1.0.9
blaze@2.1.9
blaze-html-templates@1.0.5
blaze-tools@1.0.10
boilerplate-generator@1.0.10
caching-compiler@1.1.7
caching-html-compiler@1.0.6
caching-html-compiler@1.0.7
callback-hook@1.0.9
check@1.2.3
coffeescript@1.2.4_1
@ -46,8 +46,8 @@ google@1.1.14
harrison:papa-parse@1.1.1
hot-code-push@1.0.4
houston:admin@2.0.7
html-tools@1.0.10
htmljs@1.0.10
html-tools@1.0.11
htmljs@1.0.11
http@1.2.9
id-map@1.0.8
iron:controller@1.0.12
@ -76,7 +76,7 @@ mobile-experience@1.0.4
mobile-status-bar@1.0.12
modules@0.7.6
modules-runtime@0.7.6
momentjs:moment@2.14.4
momentjs:moment@2.15.1
mongo@1.1.12
mongo-id@1.0.5
natestrauser:select2@4.0.3
@ -88,7 +88,7 @@ observe-sequence@1.0.12
ongoworks:security@2.0.1
ordered-dict@1.0.8
pfafman:filesaver@1.3.2
promise@0.8.4
promise@0.8.7
proyk:meteor-cookies@0.0.1
random@1.0.10
rate-limit@1.0.5
@ -102,16 +102,18 @@ service-configuration@1.0.10
session@1.1.6
sha@1.0.8
shell-server@0.2.1
spacebars@1.0.12
spacebars-compiler@1.0.12
spacebars@1.0.13
spacebars-compiler@1.0.13
srp@1.0.9
standard-minifier-css@1.2.0
standard-minifier-css@1.2.1
standard-minifier-js@1.2.0
templating@1.2.14
templating-tools@1.0.4
templating@1.2.15
templating-compiler@1.2.15
templating-runtime@1.2.15
templating-tools@1.0.5
tmeasday:paginated-subscription@0.2.4
tracker@1.1.0
ui@1.0.11
ui@1.0.12
underscore@1.0.9
url@1.0.10
webapp@1.3.11

View File

@ -66,7 +66,7 @@
<div>
<div class="inputRadioPref">
<p class="prefTitle">Theme:</p>
<span class="change radio" re="readonly" id="prefTheme">{{pref 'theme'}}</span>
<span class="change radio" re="readonly" id="prefTheme">{{themeName}}</span>
</div>
<div class="prefOptions">
<p class="prefOptionText" style="background-color:{{divColor 'mainColor'}}">Light</p>

View File

@ -88,11 +88,11 @@ Template.registerHelper('screen', (multiplier, fraction) => {
});
Template.registerHelper('divColor', (div) => { // Reactive color changing based on preferences. Colors stored in themeColors.
return themeColors[Session.get("user").preferences.theme][div];
return Session.get("user").preferences.theme[div];
});
Template.registerHelper('textColor', () => { // Reactive color for text.
document.getElementsByTagName("body")[0].style.color = themeColors[Session.get("user").preferences.theme].textColor;
document.getElementsByTagName("body")[0].style.color = Session.get("user").preferences.theme.textColor;
return;
});
@ -101,7 +101,7 @@ Template.registerHelper('overlayDim', (part) => { // Gets size of the overlay co
var width = "width:" + dim[0].toString() + "px;";
var height = "height:" + dim[1].toString() + "px;";
var margin = "margin-left:" + (-dim[0] / 2).toString() + "px;";
var bg = "background-color:" + themeColors[Session.get("user").preferences.theme].header + ";";
var bg = "background-color:" + Session.get("user").preferences.theme.header + ";";
return width + height + margin + bg;
});
@ -201,7 +201,7 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective
var conf = thisWork[j].confirmations.length;
var repo = thisWork[j].reports.length;
var ratio = conf / repo;
var normalColor = themeColors[Session.get("user").preferences.theme]["text"];
var normalColor = Session.get("user").preferences.theme["text"];
if (Math.abs(conf - repo)) {
if ((conf+repo) <= 1) {
thisWork[j].doneRatio = normalColor;
@ -259,15 +259,26 @@ function startDragula() {
}
Template.main.helpers({
themeName() {
var vals = _.values(themeColors);
var curtheme = Session.get("user").preferences.theme;
for(var i = 0; i < vals.length; i++) {
if (_.isEqual(vals[i], curtheme)) {
var name = _.keys(themeColors)[i];
return name.charAt(0).toUpperCase() + name.slice(1);
}
}
return "Custom";
},
schoolName() { // Finds the name of the user's school.
if(Session.get("user").school === undefined || Session.get("user").school === null) return;
return " - " + Session.get("user").school;
},
iconColor(icon) { // Sidebar status color
if (Session.equals("sidebar",icon + "Container")) {
return themeColors[Session.get("user").preferences.theme].statusIcons;
return Session.get("user").preferences.theme.statusIcons;
} else if (Session.equals("sidebar","both")) {
return themeColors[Session.get("user").preferences.theme].statusIcons;
return Session.get("user").preferences.theme.statusIcons;
} else {
return;
}
@ -284,7 +295,7 @@ Template.main.helpers({
return;
},
bgSrc() { // Returns background.
return "Backgrounds/"+ themeColors[Session.get("user").preferences.theme].background;
return "Backgrounds/"+ Session.get("user").preferences.theme.background;
},
menuStatus() { // Status of of menu sidebar.
if (Session.equals("sidebar", "menuContainer")) {
@ -310,7 +321,7 @@ Template.main.helpers({
},
modeStatus(status) { // Color status of display modes.
if (!Session.equals("mode",status)) return;
return themeColors[Session.get("user").preferences.theme].modeHighlight;
return Session.get("user").preferences.theme.modeHighlight;
},
currMode(name) { // Status of display mode.
return Session.equals("mode",name);
@ -393,7 +404,7 @@ Template.main.helpers({
return "width:" + width.toString() + "px;margin-left:" + (0.5 * window.innerWidth - 0.5 * width).toString() + "px;";
},
calColor() { // Sets the color of the calendar according to theme
return "color:"+themeColors[Session.get("user").preferences.theme].calendar;
return "color:" + Session.get("user").preferences.theme.calendar;
},
calCreWork() { // Display instructions for creating a work.
if (Session.get("calCreWork")) return true;
@ -1035,7 +1046,7 @@ function getHomeworkFormData() { // Get all data relating to work creation.
function getPreferencesData() { // Get all data relating to preferences.
var profile = Session.get("user");
var options = {
"theme": document.getElementById("prefTheme").childNodes[0].nodeValue.toLowerCase(),
"theme": themeColors[document.getElementById("prefTheme").childNodes[0].nodeValue.toLowerCase()],
"mode": document.getElementById("prefMode").childNodes[0].nodeValue.toLowerCase(),
"timeHide": ref[document.getElementById("prefHide").childNodes[0].nodeValue],
"done": ref[document.getElementById("prefDone").childNodes[0].nodeValue],

View File

@ -46,7 +46,7 @@
<div class="radioContainer">
<div class="inputRadio">
<p class="profTitle">Theme:</p>
<span class="change radio" re="readonly" id="prefTheme">{{pref 'theme'}}</span>
<span class="change radio" re="readonly" id="prefTheme">{{themeName}}</span>
</div>
<div class="profOptions">
<p class="profOptionText" style="background-color:{{divColor 'mainColor'}}">Light</p>

View File

@ -25,6 +25,17 @@ Session.set("noclass",null); // If user doesn't have classes.
Session.set("notfound",null); // If no results for autocomplete.
Template.profile.helpers({
themeName() {
var vals = _.values(themeColors);
var curtheme = Session.get("user").preferences.theme;
for(var i = 0; i < vals.length; i++) {
if (_.isEqual(vals[i], curtheme)) {
var name = _.keys(themeColors)[i];
return name.charAt(0).toUpperCase() + name.slice(1);
}
}
return "Custom";
},
classSettings() { // Returns autocomplete array for classes.
return {
position: "bottom",
@ -76,7 +87,7 @@ Template.profile.helpers({
return Session.get("user").name;
},
motd() { // Returns the current user's description
if (Session.get("user").description !== undefined && Session.get("user").description !== null) return Session.get("user").description;
if (Session.get("user").description !== undefined && Session.get("user").description !== null && Session.get("user").description !== "") return Session.get("user").description;
return "Say something about yourself!";
},
school() { // Returns the current user's school's name
@ -84,7 +95,7 @@ Template.profile.helpers({
return "Click here to edit...";
},
grade() { // Returns the current user's grade
if (Session.get("user").grade !== undefined && Session.get("user").grade !== null) return Session.get("user").grade + "th";
if (Session.get("user").grade !== undefined && Session.get("user").grade !== null && Session.get("user").grade !== "") return Session.get("user").grade + "th";
return "Click here to edit...";
},
classes() { // Loads all of the possible classes ( Limit of twenty shown ) ( Sorts by class size )
@ -117,11 +128,11 @@ Template.profile.helpers({
return "0px";
},
profClassTabColor(status) { // Change this [Supposed to show the current mode that's selected via color]    
if (Session.equals("profClassTab",status)) {            
return themeColors[Meteor.user().profile.preferences.theme].modeHighlight;        
} else {            
return;        
}    
if (Session.equals("profClassTab",status)) {
return Meteor.user().profile.preferences.theme.modeHighlight;
} else {
return;
}
},
profClassTab(tab) { // Tells current class
if (Session.equals("profClassTab",tab)) {
@ -611,7 +622,7 @@ function getProfileData() { // Gets all data related to profile.
if(profile.description.includes("Say something about yourself!")) profile.description = "";
profile.school = document.getElementById("school").childNodes[0].nodeValue;
if(profile.school.includes("Click here to edit...")) school = "";
if(profile.school === "Click here to edit...") school = "";
var gradein = document.getElementById("grade").childNodes[0].nodeValue;
profile.grade = parseInt(gradein.substring(gradein.length - 2, gradein));
@ -620,8 +631,10 @@ function getProfileData() { // Gets all data related to profile.
profile.avatar = document.getElementById("profAvatar").src;
profile.banner = document.getElementById("profBanner").src;
var themename = document.getElementById("prefTheme").childNodes[0].nodeValue.toLowerCase();
var themeobj = themeColors[themename];
profile.preferences = {
"theme":document.getElementById("prefTheme").childNodes[0].nodeValue.toLowerCase(),
"theme": themeobj,
"mode":document.getElementById("prefMode").childNodes[0].nodeValue.toLowerCase(),
"timeHide":ref[document.getElementById("prefHide").childNodes[0].nodeValue],
"done":ref[document.getElementById("prefDone").childNodes[0].nodeValue],