From 134fc05b7e181f78ce2feb3edc061ddad69ba4e2 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Tue, 2 May 2017 20:51:30 -0400 Subject: [PATCH] minor bug fixes, visual issues --- hourglass/client/main/main.js | 33 +++++++++++++++----- hourglass/client/menus/menus.js | 15 ++++----- hourglass/client/mobile/mobile.js | 6 ++-- hourglass/client/profile/mProfile.css | 5 +-- hourglass/client/profile/mProfile.html | 2 +- hourglass/lib/constants.js | 2 +- hourglass/server/main.js | 42 ++++++++++++++++++-------- 7 files changed, 72 insertions(+), 33 deletions(-) diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index be41ab0..6bd6212 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -11,7 +11,7 @@ var calWorkDate = null; var dragging = false; var clicked = false; var workChanger = false; -var disconnect= false; +var disconnect = false; // Reactive variables. Session.set("user", {}); // Stores user preferences. @@ -32,7 +32,7 @@ Session.set("confirmText", ""); // Stores text for confirmations. // On render actions -Meteor.autorun(function () { +Meteor.autorun(function () { // Disconnect checking if (Meteor.status().status !== "connected" && Meteor.status().status !== "connecting" && !disconnect) { disconnect = true; var div = document.createElement("div"); @@ -51,7 +51,17 @@ Meteor.autorun(function () { div.appendChild(h5); document.getElementsByTagName("body")[0].appendChild(div); $("#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 + }); + }); + } }); Template.login.rendered = function() { @@ -220,6 +230,7 @@ Template.registerHelper('work', (value) => {// Returns the specified work value. switch(value) { case "class": var id = thisWork["class"]; + if(!id) return; return (id === Meteor.userId()) ? "Personal" : classes.findOne({_id: id}).name; case "dueDate": return getReadableDate(thisWork.dueDate); @@ -432,8 +443,8 @@ Template.main.helpers({ if (jsEvent.target.className.includes("fc-past")) return; var realDate = date; date.startOf("day"); + date.hour(12); realDate = realDate._d; - Session.set("newWork", true); Session.set("currentWork", {dueDate: realDate, type: "normal"}); if(!Session.equals("sidebarMode", "create")) toggleToSidebar("create"); } @@ -480,7 +491,8 @@ Template.main.helpers({ if (Meteor.userId() === thisWork.creator || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || currClass.moderators.indexOf(Meteor.userId()) !== -1 || - currClass.banned.indexOf(Meteor.userId()) !== -1 + currClass.banned.indexOf(Meteor.userId()) !== -1 || + currClass.admin === Meteor.userId() ) return true; } } catch(err) {} @@ -736,7 +748,6 @@ Template.main.events({ return names.alias === option; })[0].val; Session.set("currentWork", newSetting); - console.log(newSetting); closeInput(); toggleOptionMenu(false, modifyingInput); modifyingInput = null; @@ -963,7 +974,7 @@ toDate = function(date) { // Turns formatted date back to Date constructor. month = months.indexOf(date.substring(0, date.search(" "))); day = date.substring(date.search(" ") + 1, date.search(",")); 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) { @@ -1182,6 +1193,11 @@ filterWork = function() { } }); 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); })); Session.set("filterWork", hideWork); // Not displayed @@ -1203,7 +1219,8 @@ function calendarEvents() { Meteor.userId() === work.creator || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || currClass.moderators.indexOf(Meteor.userId()) !== -1 || - currClass.banned.indexOf(Meteor.userId()) !== -1 + currClass.banned.indexOf(Meteor.userId()) !== -1 || + currClass.admin === Meteor.userId() ) inRole = true; events.push({ diff --git a/hourglass/client/menus/menus.js b/hourglass/client/menus/menus.js index e84ba2c..f408640 100644 --- a/hourglass/client/menus/menus.js +++ b/hourglass/client/menus/menus.js @@ -196,8 +196,9 @@ Template.sidebarCreatePlate.events({ var classid = event.target.getAttribute("classid"); var newSetting = Session.get("currentWork"); newSetting.class = classid; + Session.set("newWork", true); Session.set("currentWork", newSetting); - $(".overlay").fadeIn(250); + $(".overlay").velocity("fadeIn", 150); } }); @@ -477,7 +478,7 @@ Template.joinClass.events({ serverData = [event.target.parentNode.getAttribute("classid"), ""]; confirm = "joinClass"; Session.set("confirmText", "Join this class?"); - $("#confirmOverlay").fadeIn(250); + $("#confirmOverlay").velocity("fadeIn", 150); }, 'click #private' () { $("#privateCode").css('display', 'inline-block'); @@ -692,17 +693,17 @@ toggleToSidebar = function(sidebar) { }; toggleToClassInfo = function(classId) { - $("#changeAdminWrapper").fadeOut(150); - $("#infoClassCont").fadeOut(150, function() { + $("#changeAdminWrapper").velocity("fadeOut", 150); + $("#infoClassCont").velocity("fadeOut", 150, function() { Session.set("classInfo", classId); Session.set("classInfoMode", "general"); - $(this).fadeIn(150); + $(this).velocity("fadeIn", 150); }); }; toggleToClassInfoMode = function(mode) { - $("#infoClassCont").fadeOut(150, function() { + $("#infoClassCont").velocity("fadeOut", 150, function() { Session.set("classInfoMode", mode); - $(this).fadeIn(150); + $(this).velocity("fadeIn",150); }); }; diff --git a/hourglass/client/mobile/mobile.js b/hourglass/client/mobile/mobile.js index 0484ead..a315f6d 100644 --- a/hourglass/client/mobile/mobile.js +++ b/hourglass/client/mobile/mobile.js @@ -311,7 +311,8 @@ Template.mobileClass.rendered = function() { if (Meteor.userId() === thisWork.creator || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || currClass.moderators.indexOf(Meteor.userId()) !== -1 || - currClass.banned.indexOf(Meteor.userId()) !== -1 + currClass.banned.indexOf(Meteor.userId()) !== -1 || + currClass.admin === Meteor.userId() ) { inRole = true; } @@ -353,7 +354,8 @@ Template.mobileClass.helpers({ if (Meteor.userId() === thisWork.creator || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || currClass.moderators.indexOf(Meteor.userId()) !== -1 || - currClass.banned.indexOf(Meteor.userId()) !== -1 + currClass.banned.indexOf(Meteor.userId()) !== -1 || + currClass.admin === Meteor.userId() ) return true; } catch(err) {} diff --git a/hourglass/client/profile/mProfile.css b/hourglass/client/profile/mProfile.css index 4c1ca94..94f48d6 100644 --- a/hourglass/client/profile/mProfile.css +++ b/hourglass/client/profile/mProfile.css @@ -5,6 +5,8 @@ background-color: #282933; color: #FCF0F0 !important; position: absolute; + overflow-y: auto; + overflow-x: hidden; } .mSelect { @@ -166,13 +168,12 @@ #mProfSubmit { font-size: 4vw; width: 15vw; - margin: auto; + margin: 5vh auto 5vh auto; padding: 3%; background-color: rgba(255,255,255,0.2); text-align: center; position: absolute; - bottom: 3vh; left: 42.5vw; } \ No newline at end of file diff --git a/hourglass/client/profile/mProfile.html b/hourglass/client/profile/mProfile.html index dfb5b3a..a360b52 100644 --- a/hourglass/client/profile/mProfile.html +++ b/hourglass/client/profile/mProfile.html @@ -1,5 +1,5 @@