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>
</div> </div>
{{#if myClasses}} {{#if myClasses}}
<div id="classFilterHolder">
<h3>Filters</h3>
{{#each types}}
{{> sideTypeFilter}}
{{/each}}
</div>
<div id="classListHolder"> <div id="classListHolder">
<h3>Enrolled</h3> <h3>By Class </h3>
{{#if calCreWork}} {{#if calCreWork}}
<h3 id="calCreWork">-- Pick a class</h3> <h3 id="calCreWork">-- Pick a class</h3>
{{else}} {{else}}
@ -46,13 +52,6 @@
{{> sidebarClasses}} {{> sidebarClasses}}
{{/each}} {{/each}}
</div> </div>
</div>
<div id="classFilterHolder">
<h3>Filters</h3>
{{#each types}}
{{> sideTypeFilter}}
{{/each}}
</div> </div>
{{/if}} {{/if}}
</div> </div>
@ -102,6 +101,16 @@
<p class="prefOptionText" style="background-color:{{divColor 'header'}}">No</p> <p class="prefOptionText" style="background-color:{{divColor 'header'}}">No</p>
</div> </div>
</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>
</div> </div>
<img id="bg" src={{bgSrc}} style="min-width:{{screen}}"> <img id="bg" src={{bgSrc}} style="min-width:{{screen}}">

View File

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

View File

@ -89,6 +89,17 @@
<p class="profOptionText" style="background-color:{{divColor 'header'}}">No</p> <p class="profOptionText" style="background-color:{{divColor 'header'}}">No</p>
</div> </div>
</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> </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(), "theme":document.getElementById("prefTheme").childNodes[0].nodeValue.toLowerCase(),
"mode":document.getElementById("prefMode").childNodes[0].nodeValue.toLowerCase(), "mode":document.getElementById("prefMode").childNodes[0].nodeValue.toLowerCase(),
"timeHide":ref[document.getElementById("prefHide").childNodes[0].nodeValue], "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; return profile;
} }

View File

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