cleaning up
This commit is contained in:
parent
1d6321a553
commit
010fac7e2b
@ -29,7 +29,7 @@ var defaultWork = {
|
|||||||
dueDate: "Click here to edit...",
|
dueDate: "Click here to edit...",
|
||||||
description: "Click here to edit...",
|
description: "Click here to edit...",
|
||||||
type: "Click here to edit..."
|
type: "Click here to edit..."
|
||||||
}
|
};
|
||||||
|
|
||||||
// Creates variables for due dates
|
// Creates variables for due dates
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ Template.registerHelper('userProfile', () => {
|
|||||||
Template.registerHelper('screen', (multiplier, fraction) => {
|
Template.registerHelper('screen', (multiplier, fraction) => {
|
||||||
console.log(multiplier,fraction);
|
console.log(multiplier,fraction);
|
||||||
if(typeof multiplier !== "string") return screen.width.toString() + "px";
|
if(typeof multiplier !== "string") return screen.width.toString() + "px";
|
||||||
if(typeof fraction !== "string") return (screen.width * parseFloat(multiplier)).toString() + "px"
|
if(typeof fraction !== "string") return (screen.width * parseFloat(multiplier)).toString() + "px";
|
||||||
return ((screen.width) * parseFloat(multiplier) / parseFloat(fraction)).toString() + "px";
|
return ((screen.width) * parseFloat(multiplier) / parseFloat(fraction)).toString() + "px";
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -746,14 +746,14 @@ Template.main.events({
|
|||||||
},
|
},
|
||||||
// WORK OVERLAY BUTTONS
|
// WORK OVERLAY BUTTONS
|
||||||
'click #commentSubmit' (event) { // Click to submit a comment.
|
'click #commentSubmit' (event) { // Click to submit a comment.
|
||||||
workId = Session.get("currentWorkId")
|
workId = Session.get("currentWorkId");
|
||||||
var input = document.getElementById('workComment');
|
var input = document.getElementById('workComment');
|
||||||
comment = input.value;
|
comment = input.value;
|
||||||
input.value = "";
|
input.value = "";
|
||||||
Session.set("commentRestrict", null);
|
Session.set("commentRestrict", null);
|
||||||
if (comment !== "") {
|
if (comment !== "") {
|
||||||
document.getElementById('workComment').value = "";
|
document.getElementById('workComment').value = "";
|
||||||
Meteor.call('addComment', [comment, workId])
|
Meteor.call('addComment', [comment, workId]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'click #workSubmit' () { // Click submit work to create a work.
|
'click #workSubmit' () { // Click submit work to create a work.
|
||||||
@ -893,13 +893,14 @@ function getHomeworkFormData() { // Get all data relating to work creation.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stop) return null;
|
if (stop) return null;
|
||||||
|
var data;
|
||||||
|
|
||||||
if (Session.get("newWork")) {
|
if (Session.get("newWork")) {
|
||||||
var data = {
|
data = {
|
||||||
"class": Session.get("currentWorkId")
|
"class": Session.get("currentWorkId")
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
var data = work.findOne({
|
data = work.findOne({
|
||||||
_id: Session.get("currentWorkId")
|
_id: Session.get("currentWorkId")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -940,21 +941,11 @@ function toDate(date) { // Turns formatted date back to Date constructor.
|
|||||||
|
|
||||||
function formReadable(input, val) { // Makes work information readable by users.
|
function formReadable(input, val) { // Makes work information readable by users.
|
||||||
switch(val) {
|
switch(val) {
|
||||||
case "typeColor":
|
case "typeColor": return input.typeColor = workColors[input.type];
|
||||||
return input.typeColor = workColors[input.type];
|
case "name": return input.name;
|
||||||
break;
|
case "dueDate": return getReadableDate(input.dueDate);
|
||||||
case "name":
|
case "description": return input.description;
|
||||||
return input.name;
|
case "type": return input.type[0].toUpperCase() + input.type.slice(1);
|
||||||
break;
|
|
||||||
case "dueDate":
|
|
||||||
return getReadableDate(input.dueDate);
|
|
||||||
break;
|
|
||||||
case "description":
|
|
||||||
return input.description;
|
|
||||||
break;
|
|
||||||
case "type":
|
|
||||||
return input.type[0].toUpperCase() + input.type.slice(1);
|
|
||||||
break;
|
|
||||||
case "comments":
|
case "comments":
|
||||||
var comments = input.comments;
|
var comments = input.comments;
|
||||||
var resort = [];
|
var resort = [];
|
||||||
@ -977,7 +968,6 @@ function formReadable(input, val) { // Makes work information readable by users.
|
|||||||
resort[re].email = user.services.google.email;
|
resort[re].email = user.services.google.email;
|
||||||
}
|
}
|
||||||
return resort;
|
return resort;
|
||||||
break;
|
|
||||||
case "done":
|
case "done":
|
||||||
if (Session.get("newWork")) return [];
|
if (Session.get("newWork")) return [];
|
||||||
for (var i = 0; i < input.done.length; i++) { // Display users who marked as done.
|
for (var i = 0; i < input.done.length; i++) { // Display users who marked as done.
|
||||||
@ -992,45 +982,35 @@ function formReadable(input, val) { // Makes work information readable by users.
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
return input.done;
|
return input.done;
|
||||||
break;
|
|
||||||
case "doneCol":
|
case "doneCol":
|
||||||
if (Session.get("newWork")) return "";
|
if (Session.get("newWork")) return "";
|
||||||
if (!_.contains(input.done,Meteor.userId())) return "";
|
if (!_.contains(input.done,Meteor.userId())) return "";
|
||||||
return "#27A127";
|
return "#27A127";
|
||||||
break;
|
|
||||||
case "doneText":
|
case "doneText":
|
||||||
if (Session.get("newWork")) return "";
|
if (Session.get("newWork")) return "";
|
||||||
if (!_.contains(input.done,Meteor.userId())) return "Mark done";
|
if (!_.contains(input.done,Meteor.userId())) return "Mark done";
|
||||||
return "Done!";
|
return "Done!";
|
||||||
break;
|
|
||||||
case "userConfirm":
|
case "userConfirm":
|
||||||
if(!_.contains(input.confirmations, Meteor.userId())) return "";
|
if(!_.contains(input.confirmations, Meteor.userId())) return "";
|
||||||
return "#27A127";
|
return "#27A127";
|
||||||
break;
|
|
||||||
case "confirmations":
|
case "confirmations":
|
||||||
return input.confirmations.length;
|
return input.confirmations.length;
|
||||||
break;
|
|
||||||
case "userReport":
|
case "userReport":
|
||||||
if(!_.contains(input.reports, Meteor.userId())) return "";
|
if(!_.contains(input.reports, Meteor.userId())) return "";
|
||||||
return "#FF1A1A";
|
return "#FF1A1A";
|
||||||
break;
|
|
||||||
case "reports":
|
case "reports":
|
||||||
return input.reports.length;
|
return input.reports.length;
|
||||||
break;
|
|
||||||
case "email":
|
case "email":
|
||||||
return Meteor.users.findOne({
|
return Meteor.users.findOne({
|
||||||
_id: input.creator
|
_id: input.creator
|
||||||
}).services.google.email;
|
}).services.google.email;
|
||||||
break;
|
|
||||||
case "avatar":
|
case "avatar":
|
||||||
return Meteor.users.findOne({
|
return Meteor.users.findOne({
|
||||||
_id: input.creator
|
_id: input.creator
|
||||||
}).profile.avatar;
|
}).profile.avatar;
|
||||||
break;
|
|
||||||
case "creator":
|
case "creator":
|
||||||
return Meteor.users.findOne({
|
return Meteor.users.findOne({
|
||||||
_id: input.creator
|
_id: input.creator
|
||||||
}).profile.name;
|
}).profile.name;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user