This commit is contained in:
Yaman Qalieh 2016-09-16 16:48:42 -04:00
commit f6cf5fdaf7
5 changed files with 44 additions and 18 deletions

View File

@ -32,8 +32,14 @@
</div>
</div>
{{#if myClasses}}
<div id="classFilterHolder">
<h3>Filters</h3>
{{#each types}}
{{> sideTypeFilter}}
{{/each}}
</div>
<div id="classListHolder">
<h3>Enrolled</h3>
<h3>By Class </h3>
{{#if calCreWork}}
<h3 id="calCreWork">-- Pick a class</h3>
{{else}}
@ -46,13 +52,6 @@
{{> sidebarClasses}}
{{/each}}
</div>
</div>
<div id="classFilterHolder">
<h3>Filters</h3>
{{#each types}}
{{> sideTypeFilter}}
{{/each}}
</div>
{{/if}}
</div>
@ -102,6 +101,16 @@
<p class="prefOptionText" style="background-color:{{divColor 'header'}}">No</p>
</div>
</div>
<div>
<div class="inputRadioPref">
<p class="prefTitle">Hide Reported:</p>
<span class="change radio" re="readonly" id="prefReport">{{pref 'hideReport'}}</span>
</div>
<div class="prefOptions">
<p class="prefOptionText" style="background-color:{{divColor 'header'}}">Yes</p>
<p class="prefOptionText" style="background-color:{{divColor 'header'}}">No</p>
</div>
</div>
</div>
</div>
<img id="bg" src={{bgSrc}} style="min-width:{{screen}}">

View File

@ -155,20 +155,21 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective
var offset = (moment().subtract(hide, 'days'))._d;
if (offset > due) { // If due is before hide days before today
thisWork[j] = "no";
j = 0;
}
}
if (thisWork[j] !== "no" && Session.get("user").preferences.done) { // If done filter is true
if (thisWork[j].done.indexOf(Meteor.userId()) !== -1) { // If user marked this work done.
thisWork[j] = "no";
j = 0;
}
}
if (thisWork[j] !== "no" && sideFilter.length !== 0 && !_.contains(sideFilter, thisWork[j].type)) {
thisWork[j] = "no"
}
if(thisWork[j] !== "no" && Session.get("user").preferences.hideReport && (thisWork[j].confirmations.length/thisWork[j].reports.length) <= 0.9) {
thisWork[j] = "no";
j = 0;
}
}
@ -213,7 +214,9 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective
thisWork[j].doneRatio = "#FF1A1A";
}
}
array[i].thisClassWork = thisWork;
array[i].thisClassWork = thisWork.sort(function(a, b) {
return Date.parse(a.realDate) - Date.parse(b.realDate);
});
}
Session.set("noclass", false);
Session.set("calendarClasses", array);
@ -224,7 +227,7 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective
Template.registerHelper('pref', (val) => { // Obtains all user preferences.
var preferences = Session.get("user").preferences;
if(val === 'timeHide' || val === 'done') {
if(val === 'timeHide' || val === 'done' || val == 'hideReport') {
var invert = _.invert(ref);
return invert[preferences[val]];
}
@ -987,7 +990,8 @@ function getPreferencesData() { // Get all data relating to preferences.
"theme": 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]
"done": ref[document.getElementById("prefDone").childNodes[0].nodeValue],
"hideReport": ref[document.getElementById("prefReport").childNodes[0].nodeValue]
};
profile.preferences = options;
return profile;

View File

@ -89,6 +89,17 @@
<p class="profOptionText" style="background-color:{{divColor 'header'}}">No</p>
</div>
</div>
<br>
<div class="radioContainer">
<div class="inputRadio">
<p class="profTitle">Hide Reported:</p>
<span class="change radio" re="readonly" id="prefReport">{{pref 'hideReport'}}</span>
</div>
<div class="profOptions">
<p class="profOptionText" style="background-color:{{divColor 'header'}}">Yes</p>
<p class="profOptionText" style="background-color:{{divColor 'header'}}">No</p>
</div>
</div>
</div>
</div>
</div>

View File

@ -624,7 +624,8 @@ function getProfileData() { // Gets all data related to profile.
"theme":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]
"done":ref[document.getElementById("prefDone").childNodes[0].nodeValue],
"hideReport":ref[document.getElementById("prefReport").childNodes[0].nodeValue]
};
return profile;
}

View File

@ -510,7 +510,8 @@ Meteor.methods({
"theme": "light",
"mode": "classes",
"timeHide": 1,
"done": true
"done": true,
"hideReport": true
};
Meteor.users.update({
_id: userId