minor bug fixes, visual issues

This commit is contained in:
Kenneth Jao 2017-05-02 20:51:30 -04:00
parent d5fbaf950d
commit 134fc05b7e
7 changed files with 72 additions and 33 deletions

View File

@ -32,7 +32,7 @@ Session.set("confirmText", ""); // Stores text for confirmations.
// On render actions // On render actions
Meteor.autorun(function () { Meteor.autorun(function () { // Disconnect checking
if (Meteor.status().status !== "connected" && Meteor.status().status !== "connecting" && !disconnect) { if (Meteor.status().status !== "connected" && Meteor.status().status !== "connecting" && !disconnect) {
disconnect = true; disconnect = true;
var div = document.createElement("div"); var div = document.createElement("div");
@ -51,6 +51,16 @@ Meteor.autorun(function () {
div.appendChild(h5); div.appendChild(h5);
document.getElementsByTagName("body")[0].appendChild(div); document.getElementsByTagName("body")[0].appendChild(div);
$("#disconnect").velocity("fadeIn", 150); $("#disconnect").velocity("fadeIn", 150);
} else if(Meteor.status().status === "connected" && disconnect) {
disconnect = false;
$("#disconnect").velocity("fadeOut", 150, function() {
document.getElementsByTagName("body")[0].removeChild(document.getElementById("disconnect"));
sAlert.success("You're back!", {
effect: 'stackslide',
position: 'bottom-right',
timeout: 1500
});
});
} }
}); });
@ -220,6 +230,7 @@ Template.registerHelper('work', (value) => {// Returns the specified work value.
switch(value) { switch(value) {
case "class": case "class":
var id = thisWork["class"]; var id = thisWork["class"];
if(!id) return;
return (id === Meteor.userId()) ? "Personal" : classes.findOne({_id: id}).name; return (id === Meteor.userId()) ? "Personal" : classes.findOne({_id: id}).name;
case "dueDate": case "dueDate":
return getReadableDate(thisWork.dueDate); return getReadableDate(thisWork.dueDate);
@ -432,8 +443,8 @@ Template.main.helpers({
if (jsEvent.target.className.includes("fc-past")) return; if (jsEvent.target.className.includes("fc-past")) return;
var realDate = date; var realDate = date;
date.startOf("day"); date.startOf("day");
date.hour(12);
realDate = realDate._d; realDate = realDate._d;
Session.set("newWork", true);
Session.set("currentWork", {dueDate: realDate, type: "normal"}); Session.set("currentWork", {dueDate: realDate, type: "normal"});
if(!Session.equals("sidebarMode", "create")) toggleToSidebar("create"); if(!Session.equals("sidebarMode", "create")) toggleToSidebar("create");
} }
@ -480,7 +491,8 @@ Template.main.helpers({
if (Meteor.userId() === thisWork.creator || if (Meteor.userId() === thisWork.creator ||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
currClass.moderators.indexOf(Meteor.userId()) !== -1 || currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
currClass.banned.indexOf(Meteor.userId()) !== -1 currClass.banned.indexOf(Meteor.userId()) !== -1 ||
currClass.admin === Meteor.userId()
) return true; ) return true;
} }
} catch(err) {} } catch(err) {}
@ -736,7 +748,6 @@ Template.main.events({
return names.alias === option; return names.alias === option;
})[0].val; })[0].val;
Session.set("currentWork", newSetting); Session.set("currentWork", newSetting);
console.log(newSetting);
closeInput(); closeInput();
toggleOptionMenu(false, modifyingInput); toggleOptionMenu(false, modifyingInput);
modifyingInput = null; modifyingInput = null;
@ -963,7 +974,7 @@ toDate = function(date) { // Turns formatted date back to Date constructor.
month = months.indexOf(date.substring(0, date.search(" "))); month = months.indexOf(date.substring(0, date.search(" ")));
day = date.substring(date.search(" ") + 1, date.search(",")); day = date.substring(date.search(" ") + 1, date.search(","));
year = date.substring(date.search(",") + 2, date.length); year = date.substring(date.search(",") + 2, date.length);
return new Date(year, month, day, 0,0,0); return new Date(year, month, day, 12,0,0);
} }
checkComplete = function(required, inputs) { checkComplete = function(required, inputs) {
@ -1182,6 +1193,11 @@ filterWork = function() {
} }
}); });
Session.set("myWork", displayWork.sort(function(a,b) { // Display work. Session.set("myWork", displayWork.sort(function(a,b) { // Display work.
if(Date.parse(a.dueDate) === Date.parse(b.dueDate)) {
var x = a.name.toLowerCase();
var y = b.name.toLowerCase();
return (x < y) ? -1 : (x > y) ? 1 : 0;
}
return Date.parse(a.dueDate) - Date.parse(b.dueDate); return Date.parse(a.dueDate) - Date.parse(b.dueDate);
})); }));
Session.set("filterWork", hideWork); // Not displayed Session.set("filterWork", hideWork); // Not displayed
@ -1203,7 +1219,8 @@ function calendarEvents() {
Meteor.userId() === work.creator || Meteor.userId() === work.creator ||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
currClass.moderators.indexOf(Meteor.userId()) !== -1 || currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
currClass.banned.indexOf(Meteor.userId()) !== -1 currClass.banned.indexOf(Meteor.userId()) !== -1 ||
currClass.admin === Meteor.userId()
) inRole = true; ) inRole = true;
events.push({ events.push({

View File

@ -196,8 +196,9 @@ Template.sidebarCreatePlate.events({
var classid = event.target.getAttribute("classid"); var classid = event.target.getAttribute("classid");
var newSetting = Session.get("currentWork"); var newSetting = Session.get("currentWork");
newSetting.class = classid; newSetting.class = classid;
Session.set("newWork", true);
Session.set("currentWork", newSetting); Session.set("currentWork", newSetting);
$(".overlay").fadeIn(250); $(".overlay").velocity("fadeIn", 150);
} }
}); });
@ -477,7 +478,7 @@ Template.joinClass.events({
serverData = [event.target.parentNode.getAttribute("classid"), ""]; serverData = [event.target.parentNode.getAttribute("classid"), ""];
confirm = "joinClass"; confirm = "joinClass";
Session.set("confirmText", "Join this class?"); Session.set("confirmText", "Join this class?");
$("#confirmOverlay").fadeIn(250); $("#confirmOverlay").velocity("fadeIn", 150);
}, },
'click #private' () { 'click #private' () {
$("#privateCode").css('display', 'inline-block'); $("#privateCode").css('display', 'inline-block');
@ -692,17 +693,17 @@ toggleToSidebar = function(sidebar) {
}; };
toggleToClassInfo = function(classId) { toggleToClassInfo = function(classId) {
$("#changeAdminWrapper").fadeOut(150); $("#changeAdminWrapper").velocity("fadeOut", 150);
$("#infoClassCont").fadeOut(150, function() { $("#infoClassCont").velocity("fadeOut", 150, function() {
Session.set("classInfo", classId); Session.set("classInfo", classId);
Session.set("classInfoMode", "general"); Session.set("classInfoMode", "general");
$(this).fadeIn(150); $(this).velocity("fadeIn", 150);
}); });
}; };
toggleToClassInfoMode = function(mode) { toggleToClassInfoMode = function(mode) {
$("#infoClassCont").fadeOut(150, function() { $("#infoClassCont").velocity("fadeOut", 150, function() {
Session.set("classInfoMode", mode); Session.set("classInfoMode", mode);
$(this).fadeIn(150); $(this).velocity("fadeIn",150);
}); });
}; };

View File

@ -311,7 +311,8 @@ Template.mobileClass.rendered = function() {
if (Meteor.userId() === thisWork.creator || if (Meteor.userId() === thisWork.creator ||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
currClass.moderators.indexOf(Meteor.userId()) !== -1 || currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
currClass.banned.indexOf(Meteor.userId()) !== -1 currClass.banned.indexOf(Meteor.userId()) !== -1 ||
currClass.admin === Meteor.userId()
) { ) {
inRole = true; inRole = true;
} }
@ -353,7 +354,8 @@ Template.mobileClass.helpers({
if (Meteor.userId() === thisWork.creator || if (Meteor.userId() === thisWork.creator ||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
currClass.moderators.indexOf(Meteor.userId()) !== -1 || currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
currClass.banned.indexOf(Meteor.userId()) !== -1 currClass.banned.indexOf(Meteor.userId()) !== -1 ||
currClass.admin === Meteor.userId()
) return true; ) return true;
} catch(err) {} } catch(err) {}

View File

@ -5,6 +5,8 @@
background-color: #282933; background-color: #282933;
color: #FCF0F0 !important; color: #FCF0F0 !important;
position: absolute; position: absolute;
overflow-y: auto;
overflow-x: hidden;
} }
.mSelect { .mSelect {
@ -166,13 +168,12 @@
#mProfSubmit { #mProfSubmit {
font-size: 4vw; font-size: 4vw;
width: 15vw; width: 15vw;
margin: auto; margin: 5vh auto 5vh auto;
padding: 3%; padding: 3%;
background-color: rgba(255,255,255,0.2); background-color: rgba(255,255,255,0.2);
text-align: center; text-align: center;
position: absolute; position: absolute;
bottom: 3vh;
left: 42.5vw; left: 42.5vw;
} }

View File

@ -1,5 +1,5 @@
<template name="mProfile"> <template name="mProfile">
<div class="noScroll"> <div class="noScroll mProfCont">
<div id="mProfWrapper"> <div id="mProfWrapper">
<div id="mProfMain"> <div id="mProfMain">
<div id="schoolCont"> <div id="schoolCont">

View File

@ -27,7 +27,7 @@ themeColors = {
"background": "RedBlack.jpg", "background": "RedBlack.jpg",
"mainColor": "#302C36", "mainColor": "#302C36",
"secondaryColor": "#B93A3A", "secondaryColor": "#B93A3A",
"sidebarColor": "#327C5A", "sidebarColor": "#302C36",
"userDropdownColor": "#CC3333", "userDropdownColor": "#CC3333",
"iconHighlight": "#CBDF58", "iconHighlight": "#CBDF58",
"modeHighlight": "#C9FE62", "modeHighlight": "#C9FE62",

View File

@ -589,18 +589,36 @@ Meteor.methods({
var security = securityCheck([[16, 9, false], 23, true], var security = securityCheck([[16, 9, false], 23, true],
Object.assign({}, workobject, currentclass || {}, {userId: Meteor.userId(), toggle: input[1]})); Object.assign({}, workobject, currentclass || {}, {userId: Meteor.userId(), toggle: input[1]}));
if (!security) { if (!security) {
var userindex = workobject[input[1]].indexOf(Meteor.userId()); var type = input[1];
if (userindex === -1) { var index = workobject[type].indexOf(Meteor.userId());
workobject[input[1]] = workobject[input[1]].concat(Meteor.userId()); var cIndex = workobject["confirmations"].indexOf(Meteor.userId());
if (input[1] === "confirmations" && var rIndex = workobject["reports"].indexOf(Meteor.userId());
_.contains(workobject.reports, Meteor.userId())) { var dIndex = workobject["done"].indexOf(Meteor.userId());
workobject.reports.splice(userindex, 1); switch(type) {
} else if (input[1] === "reports" && case "confirmations":
_.contains(workobject.confirmations, Meteor.userId())) { if(index === -1) { // User hasn't confirmed.
workobject.confirmations.splice(userindex, 1); workobject[type] = workobject[type].concat(Meteor.userId());
if(rIndex !== -1) workobject["reports"].splice(rIndex, 1);
} else { // Used has confirmed.
workobject[type].splice(index, 1);
} }
} else { break;
workobject[input[1]].splice(userindex, 1); case "reports":
if(index === -1) { // User hasn't reported.
workobject[type] = workobject[type].concat(Meteor.userId());
if(cIndex !== -1) workobject["confirmations"].splice(cIndex, 1);
} else { // Used has reported.
workobject[type].splice(index, 1);
}
break;
case "done":
if(index === -1) { // User isn't done.
workobject[type] = workobject[type].concat(Meteor.userId());
if(cIndex === -1) workobject["confirmations"] = workobject["confirmations"].concat(Meteor.userId());
} else { // User is done
workobject[type].splice(index, 1);
}
break;
} }
work.update({ work.update({
_id: input[0] _id: input[0]