web beautify filter
This commit is contained in:
parent
196976cc9f
commit
be716d982a
@ -44,19 +44,19 @@ var ref = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Reactive variables.
|
// Reactive variables.
|
||||||
Session.set("user",{}); // Stores user preferences.
|
Session.set("user", {}); // Stores user preferences.
|
||||||
Session.set("calendarClasses", []); // Stores calendar classes.
|
Session.set("calendarClasses", []); // Stores calendar classes.
|
||||||
Session.set("sidebar", null); // Status of sidebar.
|
Session.set("sidebar", null); // Status of sidebar.
|
||||||
Session.set("requests",false); // Status of requests.
|
Session.set("requests", false); // Status of requests.
|
||||||
Session.set("newWork", null); // If user creating new work.
|
Session.set("newWork", null); // If user creating new work.
|
||||||
Session.set("currentWorkId",null); // Stores current work Id.
|
Session.set("currentWorkId", null); // Stores current work Id.
|
||||||
Session.set("currentReadableWork", null); // Stores readable selected work info.
|
Session.set("currentReadableWork", null); // Stores readable selected work info.
|
||||||
Session.set("modifying", null); // Stores current open input.
|
Session.set("modifying", null); // Stores current open input.
|
||||||
Session.set("noclass", null); // If user does not have classes.
|
Session.set("noclass", null); // If user does not have classes.
|
||||||
Session.set("calCreWork", null); // If user is creating a work from calendar.
|
Session.set("calCreWork", null); // If user is creating a work from calendar.
|
||||||
Session.set("classDisp", []); // Stores current filter for classes.
|
Session.set("classDisp", []); // Stores current filter for classes.
|
||||||
Session.set("typeFilter", []); // Stores type filters for classes.
|
Session.set("typeFilter", []); // Stores type filters for classes.
|
||||||
Session.set("typeFilterHover",null); // Stores current hovered type filter.
|
Session.set("typeFilterHover", null); // Stores current hovered type filter.
|
||||||
Session.set("classDispHover", null); // Stores current hovered class filter.
|
Session.set("classDispHover", null); // Stores current hovered class filter.
|
||||||
Session.set("refetchEvents", null); // Stores whether to get calendar events again.
|
Session.set("refetchEvents", null); // Stores whether to get calendar events again.
|
||||||
Session.set("commentRestrict", ""); // Stores text for comment character restriction.
|
Session.set("commentRestrict", ""); // Stores text for comment character restriction.
|
||||||
@ -76,14 +76,14 @@ Template.profile.rendered = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Template.registerHelper('userProfile', () => {
|
Template.registerHelper('userProfile', () => {
|
||||||
if(Meteor.user() === undefined || Meteor.user() === null) return;
|
if (Meteor.user() === undefined || Meteor.user() === null) return;
|
||||||
Session.set("user", Meteor.user().profile);
|
Session.set("user", Meteor.user().profile);
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.registerHelper('screen', (multiplier, fraction) => {
|
Template.registerHelper('screen', (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";
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -106,8 +106,8 @@ Template.registerHelper('overlayDim', (part) => { // Gets size of the overlay co
|
|||||||
});
|
});
|
||||||
|
|
||||||
Template.registerHelper('myClasses', () => { // Gets all classes and respective works.
|
Template.registerHelper('myClasses', () => { // Gets all classes and respective works.
|
||||||
if(Session.get("user").classes.length === 0) { // Null checking.
|
if (Session.get("user").classes.length === 0) { // Null checking.
|
||||||
Session.set("noclass",true); // Makes sure to display nothing.
|
Session.set("noclass", true); // Makes sure to display nothing.
|
||||||
return [];
|
return [];
|
||||||
} else {
|
} else {
|
||||||
var array = [];
|
var array = [];
|
||||||
@ -168,7 +168,7 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective
|
|||||||
thisWork[j] = "no";
|
thisWork[j] = "no";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(thisWork[j] !== "no" && Session.get("user").preferences.hideReport && (thisWork[j].confirmations.length/thisWork[j].reports.length) <= 0.9) {
|
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";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,13 +197,15 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective
|
|||||||
thisWork[j].confirmationLength = thisWork[j].confirmations.length; // Counts the number of confirmations and reports for a particular work.
|
thisWork[j].confirmationLength = thisWork[j].confirmations.length; // Counts the number of confirmations and reports for a particular work.
|
||||||
thisWork[j].reportLength = thisWork[j].reports.length;
|
thisWork[j].reportLength = thisWork[j].reports.length;
|
||||||
|
|
||||||
thisWork[j].creator = Meteor.users.findOne({_id: thisWork[j].creator}).profile.name;
|
thisWork[j].creator = Meteor.users.findOne({
|
||||||
|
_id: thisWork[j].creator
|
||||||
|
}).profile.name;
|
||||||
var conf = thisWork[j].confirmations.length;
|
var conf = thisWork[j].confirmations.length;
|
||||||
var repo = thisWork[j].reports.length;
|
var repo = thisWork[j].reports.length;
|
||||||
var ratio = conf / repo;
|
var ratio = conf / repo;
|
||||||
var normalColor = Session.get("user").preferences.theme["text"];
|
var normalColor = Session.get("user").preferences.theme["text"];
|
||||||
if (Math.abs(conf - repo)) {
|
if (Math.abs(conf - repo)) {
|
||||||
if ((conf+repo) <= 1) {
|
if ((conf + repo) <= 1) {
|
||||||
thisWork[j].doneRatio = normalColor;
|
thisWork[j].doneRatio = normalColor;
|
||||||
} else {
|
} else {
|
||||||
thisWork[j].doneRatio = "#F9F906";
|
thisWork[j].doneRatio = "#F9F906";
|
||||||
@ -227,7 +229,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' || val == 'hideReport') {
|
if (val === 'timeHide' || val === 'done' || val == 'hideReport') {
|
||||||
var invert = _.invert(ref);
|
var invert = _.invert(ref);
|
||||||
return invert[preferences[val]];
|
return invert[preferences[val]];
|
||||||
}
|
}
|
||||||
@ -239,8 +241,7 @@ Template.registerHelper('commentLength', () => { // Returns characters left for
|
|||||||
});
|
});
|
||||||
|
|
||||||
function startDragula() {
|
function startDragula() {
|
||||||
dragula([document.querySelector('#classesMode'), document.querySelector('#nonexistant')],
|
dragula([document.querySelector('#classesMode'), document.querySelector('#nonexistant')], {
|
||||||
{
|
|
||||||
moves: function(el, container, handle) {
|
moves: function(el, container, handle) {
|
||||||
// return handle.classList.contains("classInfo") || handle.classList.contains("mainClassName");
|
// return handle.classList.contains("classInfo") || handle.classList.contains("mainClassName");
|
||||||
return _.intersection(["classInfo", "mainClassName", "mainClassHour", "mainClassTeacher"], handle.classList).length > 0;
|
return _.intersection(["classInfo", "mainClassName", "mainClassHour", "mainClassTeacher"], handle.classList).length > 0;
|
||||||
@ -249,7 +250,7 @@ function startDragula() {
|
|||||||
.on('out', function(el) {
|
.on('out', function(el) {
|
||||||
var els = document.getElementsByClassName("classWrapper");
|
var els = document.getElementsByClassName("classWrapper");
|
||||||
var final = [];
|
var final = [];
|
||||||
for(var i = 0; i < els.length; i++) {
|
for (var i = 0; i < els.length; i++) {
|
||||||
var classid = els[i].getElementsByClassName("creWork")[0].getAttribute("classid");
|
var classid = els[i].getElementsByClassName("creWork")[0].getAttribute("classid");
|
||||||
final.push(classid);
|
final.push(classid);
|
||||||
}
|
}
|
||||||
@ -262,7 +263,7 @@ Template.main.helpers({
|
|||||||
themeName() {
|
themeName() {
|
||||||
var vals = _.values(themeColors);
|
var vals = _.values(themeColors);
|
||||||
var curtheme = Session.get("user").preferences.theme;
|
var curtheme = Session.get("user").preferences.theme;
|
||||||
for(var i = 0; i < vals.length; i++) {
|
for (var i = 0; i < vals.length; i++) {
|
||||||
if (_.isEqual(vals[i], curtheme)) {
|
if (_.isEqual(vals[i], curtheme)) {
|
||||||
var name = _.keys(themeColors)[i];
|
var name = _.keys(themeColors)[i];
|
||||||
return name.charAt(0).toUpperCase() + name.slice(1);
|
return name.charAt(0).toUpperCase() + name.slice(1);
|
||||||
@ -271,13 +272,13 @@ Template.main.helpers({
|
|||||||
return "Custom";
|
return "Custom";
|
||||||
},
|
},
|
||||||
schoolName() { // Finds the name of the user's school.
|
schoolName() { // Finds the name of the user's school.
|
||||||
if(Session.get("user").school === undefined || Session.get("user").school === null) return;
|
if (Session.get("user").school === undefined || Session.get("user").school === null) return;
|
||||||
return " - " + Session.get("user").school;
|
return " - " + Session.get("user").school;
|
||||||
},
|
},
|
||||||
iconColor(icon) { // Sidebar status color
|
iconColor(icon) { // Sidebar status color
|
||||||
if (Session.equals("sidebar",icon + "Container")) {
|
if (Session.equals("sidebar", icon + "Container")) {
|
||||||
return Session.get("user").preferences.theme.statusIcons;
|
return Session.get("user").preferences.theme.statusIcons;
|
||||||
} else if (Session.equals("sidebar","both")) {
|
} else if (Session.equals("sidebar", "both")) {
|
||||||
return Session.get("user").preferences.theme.statusIcons;
|
return Session.get("user").preferences.theme.statusIcons;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@ -290,12 +291,12 @@ Template.main.helpers({
|
|||||||
return Session.get("user").name;
|
return Session.get("user").name;
|
||||||
},
|
},
|
||||||
defaultMode() { //Loads the default display mode for user.
|
defaultMode() { //Loads the default display mode for user.
|
||||||
if(load) Session.set("mode",Session.get("user").preferences.mode);
|
if (load) Session.set("mode", Session.get("user").preferences.mode);
|
||||||
load = false;
|
load = false;
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
bgSrc() { // Returns background.
|
bgSrc() { // Returns background.
|
||||||
return "Backgrounds/"+ Session.get("user").preferences.theme.background;
|
return "Backgrounds/" + Session.get("user").preferences.theme.background;
|
||||||
},
|
},
|
||||||
menuStatus() { // Status of of menu sidebar.
|
menuStatus() { // Status of of menu sidebar.
|
||||||
if (Session.equals("sidebar", "menuContainer")) {
|
if (Session.equals("sidebar", "menuContainer")) {
|
||||||
@ -320,11 +321,11 @@ Template.main.helpers({
|
|||||||
return openValues.requests;
|
return openValues.requests;
|
||||||
},
|
},
|
||||||
modeStatus(status) { // Color status of display modes.
|
modeStatus(status) { // Color status of display modes.
|
||||||
if (!Session.equals("mode",status)) return;
|
if (!Session.equals("mode", status)) return;
|
||||||
return Session.get("user").preferences.theme.modeHighlight;
|
return Session.get("user").preferences.theme.modeHighlight;
|
||||||
},
|
},
|
||||||
currMode(name) { // Status of display mode.
|
currMode(name) { // Status of display mode.
|
||||||
return Session.equals("mode",name);
|
return Session.equals("mode", name);
|
||||||
},
|
},
|
||||||
calendarOptions() { // Settings for the calendar, including work displaying.
|
calendarOptions() { // Settings for the calendar, including work displaying.
|
||||||
return {
|
return {
|
||||||
@ -383,10 +384,10 @@ Template.main.helpers({
|
|||||||
Session.set("currentWorkId", event.id);
|
Session.set("currentWorkId", event.id);
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||||
},
|
},
|
||||||
eventMouseover: function (event, jsEvent, view) {
|
eventMouseover: function(event, jsEvent, view) {
|
||||||
this.style.boxShadow = "inset 0 0 0 99999px rgba(255,255,255,0.2)";
|
this.style.boxShadow = "inset 0 0 0 99999px rgba(255,255,255,0.2)";
|
||||||
},
|
},
|
||||||
eventMouseout: function (event, jsEvent, view) {
|
eventMouseout: function(event, jsEvent, view) {
|
||||||
this.style.boxShadow = "";
|
this.style.boxShadow = "";
|
||||||
},
|
},
|
||||||
dayClick: function(date, jsEvent, view) { // On-click for each day.
|
dayClick: function(date, jsEvent, view) { // On-click for each day.
|
||||||
@ -414,18 +415,18 @@ Template.main.helpers({
|
|||||||
highlight() { // Calendar highlight/scale option.
|
highlight() { // Calendar highlight/scale option.
|
||||||
var hoverHighlight = Session.get("classDispHover");
|
var hoverHighlight = Session.get("classDispHover");
|
||||||
var typeHighlight = Session.get("typeFilterHover");
|
var typeHighlight = Session.get("typeFilterHover");
|
||||||
if(Session.equals("mode","classes")) {
|
if (Session.equals("mode", "classes")) {
|
||||||
$(".workCard").toggleClass("scaled",false);
|
$(".workCard").toggleClass("scaled", false);
|
||||||
try {
|
try {
|
||||||
$(".workCard[classid=\'"+hoverHighlight+"\']").toggleClass("scaled",true);
|
$(".workCard[classid=\'" + hoverHighlight + "\']").toggleClass("scaled", true);
|
||||||
$(".workCard[type=\'"+typeHighlight+"\']").toggleClass("scaled",true);
|
$(".workCard[type=\'" + typeHighlight + "\']").toggleClass("scaled", true);
|
||||||
} catch(err) {}
|
} catch (err) {}
|
||||||
} else {
|
} else {
|
||||||
$(".workevent").toggleClass("scaled",false);
|
$(".workevent").toggleClass("scaled", false);
|
||||||
try {
|
try {
|
||||||
$("."+hoverHighlight).toggleClass("scaled",true);
|
$("." + hoverHighlight).toggleClass("scaled", true);
|
||||||
$("."+typeHighlight).toggleClass("scaled",true);
|
$("." + typeHighlight).toggleClass("scaled", true);
|
||||||
} catch(err) {}
|
} catch (err) {}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
@ -434,8 +435,10 @@ Template.main.helpers({
|
|||||||
if (Session.get("newWork")) {
|
if (Session.get("newWork")) {
|
||||||
return defaultWork[value];
|
return defaultWork[value];
|
||||||
} else {
|
} else {
|
||||||
var thisWork = work.findOne({_id: Session.get("currentWorkId")});
|
var thisWork = work.findOne({
|
||||||
return formReadable(thisWork,value);
|
_id: Session.get("currentWorkId")
|
||||||
|
});
|
||||||
|
return formReadable(thisWork, value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
newWork() { // If user is creating a new work.
|
newWork() { // If user is creating a new work.
|
||||||
@ -444,7 +447,7 @@ Template.main.helpers({
|
|||||||
types() {
|
types() {
|
||||||
var types = Object.keys(workColors);
|
var types = Object.keys(workColors);
|
||||||
var array = [];
|
var array = [];
|
||||||
for(var i = 0; i < types.length; i++) {
|
for (var i = 0; i < types.length; i++) {
|
||||||
array.push({
|
array.push({
|
||||||
"type": types[i],
|
"type": types[i],
|
||||||
"typeName": types[i][0].toUpperCase() + types[i].slice(1),
|
"typeName": types[i][0].toUpperCase() + types[i].slice(1),
|
||||||
@ -538,8 +541,8 @@ Template.main.events({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!document.getElementById("userDropdown").contains(event.target)) closeDivFade(document.getElementById("userDropdown"));
|
if (!document.getElementById("userDropdown").contains(event.target)) closeDivFade(document.getElementById("userDropdown"));
|
||||||
if(!document.getElementById("requests").contains(event.target)) Session.set("requests",false);
|
if (!document.getElementById("requests").contains(event.target)) Session.set("requests", false);
|
||||||
},
|
},
|
||||||
// MAIN MENU BUTTONS
|
// MAIN MENU BUTTONS
|
||||||
'click .fa-bars' () { // Click menu button.
|
'click .fa-bars' () { // Click menu button.
|
||||||
@ -567,7 +570,7 @@ Template.main.events({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'click #requests .fa-question' () {
|
'click #requests .fa-question' () {
|
||||||
Session.set("requests",!Session.get("requests"));
|
Session.set("requests", !Session.get("requests"));
|
||||||
},
|
},
|
||||||
'click .classes' () { // Click classes mode button.
|
'click .classes' () { // Click classes mode button.
|
||||||
if (Session.equals("mode", "classes")) return;
|
if (Session.equals("mode", "classes")) return;
|
||||||
@ -600,11 +603,11 @@ Template.main.events({
|
|||||||
attr = event.target.getAttribute("classid");
|
attr = event.target.getAttribute("classid");
|
||||||
}
|
}
|
||||||
Session.set("newWork", true);
|
Session.set("newWork", true);
|
||||||
Session.set("currentWorkId",attr);
|
Session.set("currentWorkId", attr);
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||||
},
|
},
|
||||||
'click #dropdown' (event) {
|
'click #dropdown' (event) {
|
||||||
if(document.getElementById("userDropdown").style.display === "block") return;
|
if (document.getElementById("userDropdown").style.display === "block") return;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
openDivFade(document.getElementById("userDropdown"));
|
openDivFade(document.getElementById("userDropdown"));
|
||||||
}, 300);
|
}, 300);
|
||||||
@ -615,7 +618,7 @@ Template.main.events({
|
|||||||
workid = event.target.getAttribute("workid");
|
workid = event.target.getAttribute("workid");
|
||||||
|
|
||||||
Session.set("newWork", false);
|
Session.set("newWork", false);
|
||||||
Session.set("currentWorkId",workid);
|
Session.set("currentWorkId", workid);
|
||||||
var thisWork = work.findOne({
|
var thisWork = work.findOne({
|
||||||
_id: workid
|
_id: workid
|
||||||
});
|
});
|
||||||
@ -635,7 +638,7 @@ Template.main.events({
|
|||||||
},
|
},
|
||||||
'click #requestSubmit' () {
|
'click #requestSubmit' () {
|
||||||
var area = document.getElementById("requestArea");
|
var area = document.getElementById("requestArea");
|
||||||
if(area.value === "") return;
|
if (area.value === "") return;
|
||||||
var array = {};
|
var array = {};
|
||||||
array.content = area.value;
|
array.content = area.value;
|
||||||
array.info = {
|
array.info = {
|
||||||
@ -643,13 +646,13 @@ Template.main.events({
|
|||||||
"userInfo": Meteor.user(),
|
"userInfo": Meteor.user(),
|
||||||
"userClasses": Session.get("calendarClasses")
|
"userClasses": Session.get("calendarClasses")
|
||||||
};
|
};
|
||||||
Meteor.call("createRequest", array, function(err,result) {
|
Meteor.call("createRequest", array, function(err, result) {
|
||||||
area.value = "Request sent!";
|
area.value = "Request sent!";
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
document.getElementById("requests").style.marginBottom = "-15.5vw";
|
document.getElementById("requests").style.marginBottom = "-15.5vw";
|
||||||
area.value = "";
|
area.value = "";
|
||||||
Session.set("commentRestrict",null);
|
Session.set("commentRestrict", null);
|
||||||
},750);
|
}, 750);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// HANDLING INPUT CHANGING
|
// HANDLING INPUT CHANGING
|
||||||
@ -710,8 +713,8 @@ Template.main.events({
|
|||||||
if (restrict !== null) {
|
if (restrict !== null) {
|
||||||
input.maxLength = restrict;
|
input.maxLength = restrict;
|
||||||
input.className += " restrict";
|
input.className += " restrict";
|
||||||
Session.set("commentRestrict",restrict-input.value.length.toString() + " characters left");
|
Session.set("commentRestrict", restrict - input.value.length.toString() + " characters left");
|
||||||
var text = document.getElementById(Session.get("modifying")+"restrict");
|
var text = document.getElementById(Session.get("modifying") + "restrict");
|
||||||
text.style.display = "initial";
|
text.style.display = "initial";
|
||||||
text.style.color = "#7E7E7E";
|
text.style.color = "#7E7E7E";
|
||||||
}
|
}
|
||||||
@ -772,7 +775,7 @@ Template.main.events({
|
|||||||
},
|
},
|
||||||
'click #workComment' (event) {
|
'click #workComment' (event) {
|
||||||
var restrict = event.target.maxLength;
|
var restrict = event.target.maxLength;
|
||||||
Session.set("commentRestrict",restrict-event.target.value.length.toString() + " characters left");
|
Session.set("commentRestrict", restrict - event.target.value.length.toString() + " characters left");
|
||||||
var text = document.getElementById("commentrestrict");
|
var text = document.getElementById("commentrestrict");
|
||||||
text.style.display = "initial";
|
text.style.display = "initial";
|
||||||
text.style.color = "#7E7E7E";
|
text.style.color = "#7E7E7E";
|
||||||
@ -785,11 +788,15 @@ Template.main.events({
|
|||||||
var works = userClasses[i].thisClassWork;
|
var works = userClasses[i].thisClassWork;
|
||||||
for (var j = 0; j < works.length; j++) {
|
for (var j = 0; j < works.length; j++) {
|
||||||
var work = works[j];
|
var work = works[j];
|
||||||
var workclass = classes.findOne({_id: work.class});
|
var workclass = classes.findOne({
|
||||||
|
_id: work.class
|
||||||
|
});
|
||||||
if (work.description == defaultWork.description) work.description = "";
|
if (work.description == defaultWork.description) work.description = "";
|
||||||
if (work.dueDate == defaultWork.dueDate) continue;
|
if (work.dueDate == defaultWork.dueDate) continue;
|
||||||
if (work.name == defaultWork.name) work.name = "";
|
if (work.name == defaultWork.name) work.name = "";
|
||||||
if (workclass === undefined) workclass = {name: "Personal"};
|
if (workclass === undefined) workclass = {
|
||||||
|
name: "Personal"
|
||||||
|
};
|
||||||
events.push([
|
events.push([
|
||||||
workclass.name + ": " + work.name,
|
workclass.name + ": " + work.name,
|
||||||
work.realDate.toLocaleDateString(),
|
work.realDate.toLocaleDateString(),
|
||||||
@ -800,8 +807,13 @@ Template.main.events({
|
|||||||
}
|
}
|
||||||
|
|
||||||
var JSONevents = JSON.stringify(events);
|
var JSONevents = JSON.stringify(events);
|
||||||
var CSVevents = Papa.unparse({fields: ["Subject", "Start Date", "Description", "All Day Event"], data: JSONevents});
|
var CSVevents = Papa.unparse({
|
||||||
var eventBlob = new Blob([CSVevents], {type: "data:text/csv;charset=utf-8"});
|
fields: ["Subject", "Start Date", "Description", "All Day Event"],
|
||||||
|
data: JSONevents
|
||||||
|
});
|
||||||
|
var eventBlob = new Blob([CSVevents], {
|
||||||
|
type: "data:text/csv;charset=utf-8"
|
||||||
|
});
|
||||||
saveAs(eventBlob, "hourglass.csv");
|
saveAs(eventBlob, "hourglass.csv");
|
||||||
},
|
},
|
||||||
'keydown input' (event) { // Enter to close input.
|
'keydown input' (event) { // Enter to close input.
|
||||||
@ -816,12 +828,12 @@ Template.main.events({
|
|||||||
var restrict = event.target.maxLength;
|
var restrict = event.target.maxLength;
|
||||||
var chars = restrict - event.target.value.length;
|
var chars = restrict - event.target.value.length;
|
||||||
var text;
|
var text;
|
||||||
if(event.target.id === "workComment") {
|
if (event.target.id === "workComment") {
|
||||||
text = document.getElementById("commentrestrict");
|
text = document.getElementById("commentrestrict");
|
||||||
} else if(event.target.id === "requestArea") {
|
} else if (event.target.id === "requestArea") {
|
||||||
text = document.getElementById("requestrestrict");
|
text = document.getElementById("requestrestrict");
|
||||||
} else {
|
} else {
|
||||||
text = document.getElementById(Session.get("modifying")+"restrict");
|
text = document.getElementById(Session.get("modifying") + "restrict");
|
||||||
}
|
}
|
||||||
text.style.color = "#7E7E7E";
|
text.style.color = "#7E7E7E";
|
||||||
if (chars === restrict) { // Don't display if nothing in comment.
|
if (chars === restrict) { // Don't display if nothing in comment.
|
||||||
@ -891,7 +903,7 @@ Template.main.events({
|
|||||||
var date = calWorkDate.split("-");
|
var date = calWorkDate.split("-");
|
||||||
date = new Date(date[0], parseInt(date[1]) - 1, date[2], 11, 59, 59);
|
date = new Date(date[0], parseInt(date[1]) - 1, date[2], 11, 59, 59);
|
||||||
Session.set("newWork", true);
|
Session.set("newWork", true);
|
||||||
Session.get("currentWorkId",classid);
|
Session.get("currentWorkId", classid);
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||||
} else { // Normal clicking turns on filter.
|
} else { // Normal clicking turns on filter.
|
||||||
var array = Session.get("classDisp");
|
var array = Session.get("classDisp");
|
||||||
@ -986,10 +998,10 @@ function closeInput(modifyingInput) { // Close a changeable input and change it
|
|||||||
color = "#BEBEBE";
|
color = "#BEBEBE";
|
||||||
}
|
}
|
||||||
span.style.color = color;
|
span.style.color = color;
|
||||||
Session.set("commentRestrict","");
|
Session.set("commentRestrict", "");
|
||||||
try {
|
try {
|
||||||
input.parentNode.removeChild(input);
|
input.parentNode.removeChild(input);
|
||||||
document.getElementById(modifyingInput+"restrict").style.display = "none";
|
document.getElementById(modifyingInput + "restrict").style.display = "none";
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
if (input.value === "") { // If input has nothing.
|
if (input.value === "") { // If input has nothing.
|
||||||
span.childNodes[0].nodeValue = "Click here to edit...";
|
span.childNodes[0].nodeValue = "Click here to edit...";
|
||||||
@ -1069,12 +1081,17 @@ 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": return input.typeColor = workColors[input.type];
|
case "typeColor":
|
||||||
case "name": return input.name;
|
return input.typeColor = workColors[input.type];
|
||||||
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);
|
case "dueDate":
|
||||||
|
return getReadableDate(input.dueDate);
|
||||||
|
case "description":
|
||||||
|
return input.description;
|
||||||
|
case "type":
|
||||||
|
return input.type[0].toUpperCase() + input.type.slice(1);
|
||||||
case "comments":
|
case "comments":
|
||||||
var comments = input.comments;
|
var comments = input.comments;
|
||||||
var resort = [];
|
var resort = [];
|
||||||
@ -1086,7 +1103,7 @@ function formReadable(input, val) { // Makes work information readable by users.
|
|||||||
"date": null,
|
"date": null,
|
||||||
"user": null,
|
"user": null,
|
||||||
"avatar": null,
|
"avatar": null,
|
||||||
"email":null
|
"email": null
|
||||||
};
|
};
|
||||||
var user = Meteor.users.findOne({
|
var user = Meteor.users.findOne({
|
||||||
_id: comments[k].user
|
_id: comments[k].user
|
||||||
@ -1113,19 +1130,19 @@ function formReadable(input, val) { // Makes work information readable by users.
|
|||||||
return input.done;
|
return input.done;
|
||||||
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";
|
||||||
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!";
|
||||||
case "userConfirm":
|
case "userConfirm":
|
||||||
if(!_.contains(input.confirmations, Meteor.userId())) return "";
|
if (!_.contains(input.confirmations, Meteor.userId())) return "";
|
||||||
return "#27A127";
|
return "#27A127";
|
||||||
case "confirmations":
|
case "confirmations":
|
||||||
return input.confirmations.length;
|
return input.confirmations.length;
|
||||||
case "userReport":
|
case "userReport":
|
||||||
if(!_.contains(input.reports, Meteor.userId())) return "";
|
if (!_.contains(input.reports, Meteor.userId())) return "";
|
||||||
return "#FF1A1A";
|
return "#FF1A1A";
|
||||||
case "reports":
|
case "reports":
|
||||||
return input.reports.length;
|
return input.reports.length;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user