Fixed minor bugs

This commit is contained in:
Kenneth Jao 2016-08-28 23:25:43 -04:00
parent 79dd0c2c0e
commit 81ebc744d8
3 changed files with 70 additions and 68 deletions

View File

@ -123,7 +123,7 @@
</div> </div>
<div> <div>
<span class="workTitle">Description:</span><br> <span class="workTitle">Description:</span><br>
<span class="change req" type="textarea" id="workDesc">{{work 'description'}}</span> <span class="change" type="textarea" id="workDesc">{{work 'description'}}</span>
</div> </div>
<div> <div>
<div class="inputRadio"> <div class="inputRadio">
@ -163,27 +163,29 @@
{{/unless}} {{/unless}}
</div> </div>
</div> </div>
<div id="workToggle"> {{#unless newWork}}
<div id="done"> <div id="workToggle">
{{#each work 'done'}} <div id="done">
{{> doneUsers}} {{#each work 'done'}}
{{/each}} {{> doneUsers}}
</div> {{/each}}
<div id="toggleButtons">
<div id="markDone" style="background-color:{{work 'doneCol'}}">
<i class="fa fa-check-square-o" aria-hidden="true"></i>
<p>{{work 'doneText'}}</p>
</div> </div>
<div id="markConfirm" style="color:{{work 'userConfirm'}}"> <div id="toggleButtons">
<i class="fa fa-thumbs-up" aria-hidden="true"></i> <div id="markDone" style="background-color:{{work 'doneCol'}}">
<p>{{work 'confirmations'}}</p> <i class="fa fa-check-square-o" aria-hidden="true"></i>
</div> <p>{{work 'doneText'}}</p>
<div id="markReport" style="color:{{work 'userReport'}}"> </div>
<i class="fa fa-thumbs-down" aria-hidden="true"></i> <div id="markConfirm" style="color:{{work 'userConfirm'}}">
<p>{{work 'reports'}}</p> <i class="fa fa-thumbs-up" aria-hidden="true"></i>
<p>{{work 'confirmations'}}</p>
</div>
<div id="markReport" style="color:{{work 'userReport'}}">
<i class="fa fa-thumbs-down" aria-hidden="true"></i>
<p>{{work 'reports'}}</p>
</div>
</div> </div>
</div> </div>
</div> {{/unless}}
{{#if newWork}} {{#if newWork}}
{{#if inRole}} {{#if inRole}}
<div id="workSubmit">Save</div> <div id="workSubmit">Save</div>

View File

@ -65,7 +65,7 @@ var ref = {
}; };
// Reactive variables. // Reactive variables.
Session.set("calendarclasses", null); Session.set("calendarclasses", null); //
Session.set("sidebar", null); Session.set("sidebar", null);
Session.set("newWork",null); Session.set("newWork",null);
Session.set("currentWork",null); Session.set("currentWork",null);
@ -79,16 +79,16 @@ Session.set("classDisp",[]);
Session.set("classDispHover",null); Session.set("classDispHover",null);
Session.set("commentRestrict",null); Session.set("commentRestrict",null);
Template.registerHelper('divColor', (div) => { Template.registerHelper('divColor', (div) => { // Reactive color changing based on preferences. Colors stored in Session.get("themeColors").
return Session.get("themeColors")[Meteor.user().profile.preferences.theme][div]; return Session.get("themeColors")[Meteor.user().profile.preferences.theme][div];
}); });
Template.registerHelper('textColor', () => { Template.registerHelper('textColor', () => { // Reactive color for text.
document.getElementsByTagName("body")[0].style.color = Session.get("themeColors")[Meteor.user().profile.preferences.theme].text; document.getElementsByTagName("body")[0].style.color = Session.get("themeColors")[Meteor.user().profile.preferences.theme].text;
return; return;
}); });
Template.registerHelper('overlayDim', (part) => { Template.registerHelper('overlayDim', (part) => { // Gets size of the overlay container.
var dim = [window.innerWidth * 0.25, window.innerHeight * 0.2]; var dim = [window.innerWidth * 0.25, window.innerHeight * 0.2];
var width = "width:" + dim[0].toString() + "px;"; var width = "width:" + dim[0].toString() + "px;";
var height = "height:" + dim[1].toString() + "px;"; var height = "height:" + dim[1].toString() + "px;";
@ -505,6 +505,9 @@ Template.main.events({
document.getElementById("workComment").value = ""; document.getElementById("workComment").value = "";
} }
Session.set("newWork",null); Session.set("newWork",null);
Session.set("currentWork",null);
Session.set("currentReadableWork",null);
$('.req').css("color","")
Session.set("commentRestrict",null); Session.set("commentRestrict",null);
} }
@ -890,12 +893,6 @@ function getHomeworkFormData() {
stop = true; stop = true;
} }
} }
var desc = document.getElementById("workDesc");
if(desc.childNodes[0].nodeValue.includes("Click here to edit")) {
desc.childNodes[0].nodeValue = "Missing field";
desc.style.color = "#FF1A1A";
stop = true;
}
if(stop) return null; if(stop) return null;
var data = Session.get("currentWork"); var data = Session.get("currentWork");
@ -940,43 +937,45 @@ function formReadable(input) {
input.dueDate = getReadableDate(input.dueDate); input.dueDate = getReadableDate(input.dueDate);
input.type = input.type[0].toUpperCase() + input.type.slice(1); input.type = input.type[0].toUpperCase() + input.type.slice(1);
if(input.done.indexOf(Meteor.userId()) !== -1) {
input.doneCol = "#27A127";
input.doneText = "Done!";
} else {
input.doneCol = "";
input.doneText = "Mark done";
}
for(var i = 0; i < input.done.length; i++) {
input.done[i] = {"user":Meteor.users.findOne({_id:input.done[i]}).profile.name};
}
if(input.confirmations.indexOf(Meteor.userId()) !== -1) {
input.userConfirm = "#27A127";
} else {
input.userConfirm = "";
}
if(input.reports.indexOf(Meteor.userId()) !== -1) {
input.userReport = "#FF1A1A";
} else {
input.userReport = "";
}
input.confirmations = input.confirmations.length;
input.reports = input.reports.length;
var comments = input.comments;
var resort = [];
if(!Session.get("newWork")) { if(!Session.get("newWork")) {
for(var k = 0; k < comments.length; k++) { if(input.done.indexOf(Meteor.userId()) !== -1) {
var re = comments.length-k-1; input.doneCol = "#27A127";
resort[re] = {"comment":comments[k].comment,"date":null,"user":null}; input.doneText = "Done!";
resort[re].user = Meteor.users.findOne({_id:comments[k].user}).profile.name; } else {
resort[re].date = moment(comments[k].date).fromNow(); input.doneCol = "";
input.doneText = "Mark done";
}
for(var i = 0; i < input.done.length; i++) {
input.done[i] = {"user":Meteor.users.findOne({_id:input.done[i]}).profile.name};
}
if(input.confirmations.indexOf(Meteor.userId()) !== -1) {
input.userConfirm = "#27A127";
} else {
input.userConfirm = "";
}
if(input.reports.indexOf(Meteor.userId()) !== -1) {
input.userReport = "#FF1A1A";
} else {
input.userReport = "";
}
input.confirmations = input.confirmations.length;
input.reports = input.reports.length;
var comments = input.comments;
var resort = [];
if(!Session.get("newWork")) {
for(var k = 0; k < comments.length; k++) {
var re = comments.length-k-1;
resort[re] = {"comment":comments[k].comment,"date":null,"user":null};
resort[re].user = Meteor.users.findOne({_id:comments[k].user}).profile.name;
resort[re].date = moment(comments[k].date).fromNow();
}
input.comments = resort;
} }
input.comments = resort;
} }
return input; return input;
} }

View File

@ -264,6 +264,7 @@
margin-bottom: 3%; margin-bottom: 3%;
padding: 2%; padding: 2%;
background-color: #19B3B3;
box-shadow: 2px 2px 5px 3px #666; box-shadow: 2px 2px 5px 3px #666;
display: table; display: table;
cursor: pointer; cursor: pointer;
@ -275,7 +276,7 @@
} }
.classBox:hover { .classBox:hover {
background-color: rgba(0,0,0,0.1); background-color: #138686;
} }
#private { #private {