From 416eafcd4c98eb124f6faba2ac275630d21dc2f1 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 27 Aug 2016 18:53:47 -0400 Subject: [PATCH] Lots of tiny bug fixes, such as display, naming, and functionality --- hourglass/client/login/login.css | 1 + hourglass/client/main/main.css | 32 ++++++------ hourglass/client/main/main.html | 10 ++-- hourglass/client/main/main.js | 86 +++++++++++++++++++++----------- hourglass/server/main.js | 2 +- 5 files changed, 80 insertions(+), 51 deletions(-) diff --git a/hourglass/client/login/login.css b/hourglass/client/login/login.css index 4e12108..d18e05d 100644 --- a/hourglass/client/login/login.css +++ b/hourglass/client/login/login.css @@ -27,6 +27,7 @@ #loginTitle { font-size: 255%; + color: #000 !important; padding: 1.4%; padding-left: 1%; } diff --git a/hourglass/client/main/main.css b/hourglass/client/main/main.css index 856be02..8342946 100644 --- a/hourglass/client/main/main.css +++ b/hourglass/client/main/main.css @@ -286,7 +286,6 @@ input, textarea { #classListHolder { max-height: 48%; width: 100%; - margin-bottom: 30%; padding-right: 50%; position: absolute; @@ -325,7 +324,7 @@ input, textarea { .sideClassHour { font-weight: 400; - color: #444; + color: #CCC; margin: 0; display: table-row; } @@ -402,20 +401,18 @@ input, textarea { width: 100%; margin-right: 0; margin-bottom: 5%; - background-color: rgba(255,255,255,0.3); - box-shadow: 2px 2px 5px 3px #666; cursor: pointer; - -webkit-transition: background-color 0.4s ease, transform 0.3s ease; - -moz-transition: background-color 0.4s ease, transform 0.3s ease; - -ms-transition: background-color 0.4s ease, transform 0.3s ease; - transition: background-color 0.4s ease, transform 0.3s ease; + -webkit-transition: box-shadow 0.4s ease, transform 0.3s ease; + -moz-transition: box-shadow 0.4s ease, transform 0.3s ease; + -ms-transition: box-shadow 0.4s ease, transform 0.3s ease; + transition: box-shadow 0.4s ease, transform 0.3s ease; } .workCard:hover { - background-color: rgba(0,0,0,0.05); + box-shadow: 2px 2px 5px 3px #666, inset 0 0 0 99999px rgba(0,0,0,0.09); } .cWorkCont { @@ -449,9 +446,8 @@ input, textarea { .workTitle, .prefTitle { font-size: 150%; font-weight: 400; - margin: 0; - margin-right: 3%; - margin-bottom: 1%; + margin: 0 3% 1% 0; + cursor: default; } .prefTitle { @@ -759,14 +755,16 @@ input, textarea { } .fc-day:not(.fc-past):not(.fc-other-month) { - -webkit-transition: background-color 0.4s ease; - -moz-transition: background-color 0.4s ease; - -ms-transition: background-color 0.4s ease; - transition: background-color 0.4s ease; + box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.1); + + -webkit-transition: box-shadow 0.4s ease; + -moz-transition: box-shadow 0.4s ease; + -ms-transition: box-shadow 0.4s ease; + transition: box-shadow 0.4s ease; } .fc-day:not(.fc-past):not(.fc-other-month):hover { - background-color: rgba(0,0,0,0.1); + box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.15); } #prefCont { diff --git a/hourglass/client/main/main.html b/hourglass/client/main/main.html index 2e6f7cc..0e544eb 100644 --- a/hourglass/client/main/main.html +++ b/hourglass/client/main/main.html @@ -71,9 +71,10 @@ {{pref 'timeHide'}}
-

A Day

-

A Week

-

A Month

+

1 Day

+

2 Days

+

1 Week

+

1 Month

Never

@@ -96,6 +97,7 @@ {{/if}} +
@@ -195,7 +197,7 @@

{{name}}

- {{dueDate}} + {{dueDate}}
diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 05cd8c7..6e869f2 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -50,13 +50,14 @@ var workColors = { var defaults = { "theme":"light", "mode":"classes", - "timeHide":"A Day" + "timeHide":"1 Day" }; var ref = { - "A Day":1, - "A Week":7, - "A Month":30, + "1 Day":1, + "2 Days":2, + "1 Week":7, + "1 Month":30, "Never":0 }; @@ -81,12 +82,12 @@ Template.registerHelper('divColor', (div) => { }); Template.registerHelper("textColor", () => { - document.getElementsByTagName("html")[0].style.color = themeColors[Meteor.user().profile.preferences.theme].text; + document.getElementsByTagName("body")[0].style.color = themeColors[Meteor.user().profile.preferences.theme].text; return; }); Template.registerHelper('overlayDim', (part) => { - var dim = [window.innerWidth * 0.2, window.innerHeight * 0.25]; + var dim = [window.innerWidth * 0.25, window.innerHeight * 0.2]; var width = "width:" + dim[0].toString() + "px;"; var height = "height:" + dim[1].toString() + "px;"; var margin = "margin-left:" + (-dim[0] / 2).toString() + "px;"; @@ -105,7 +106,7 @@ Template.registerHelper('myClasses', () => { var hide = ref[Meteor.user().profile.preferences.timeHide]; for(var i = 0; i < courses.length; i++) { found = classes.findOne({_id:courses[i]}); - found.subscribers = found.subscribers.length/17; + found.subscribers = found.subscribers.length; found.mine = true; if(found.admin === Meteor.userId()) { found.box = " owned"; @@ -146,6 +147,11 @@ Template.registerHelper('myClasses', () => { lastWeek: '[Last] dddd', sameElse: 'MMMM Do' }); + if(thisWork[j].dueDate === "Today") { + thisWork[j].cardDate = "600"; + } else if(thisWork[j].dueDate === "Tomorrow") { + thisWork[j].cardDate = "400"; + } thisWork[j].typeColor = workColors[thisWork[j].type]; var hoverHighlight = Session.get("classDispHover"); if(hoverHighlight !== null && hoverHighlight === found._id) { @@ -248,15 +254,18 @@ Template.main.helpers({ } var inRole = false; + var currClass = classes.findOne({_id: current.class}) + if(Meteor.userId() === current.creator || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || - classes.findOne({_id: current._id}).moderators.indexOf(Meteor.userId()) !== -1|| - classes.findOne({_id: current._id}).blockEdit.indexOf(Meteor.userId()) !== -1 || - classes.findOne({_id: current._id}).banned.indexOf(Meteor.userId()) !== -1 + currClass.moderators.indexOf(Meteor.userId()) !== -1 || + currClass.banned.indexOf(Meteor.userId()) !== -1 ) inRole = true; + backgroundColor = workColors[current.type]; title = current.name; duedate = current.dueDate.toISOString().slice(0, 10); + if(disp) { events.push({ id: current._id, @@ -324,15 +333,15 @@ Template.main.helpers({ highlight() { var hoverHighlight = Session.get("classDispHover"); var works = document.getElementsByClassName("workevent"); + var work = $('.workevent'); + if(hoverHighlight === null) { + work.css('-webkit-transform',''); + work.css('-ms-transform',''); + work.css('transform',''); + return; + } + for(var i = 0; i < works.length; i++) { - if(hoverHighlight === null) { - try { - works[i].style.webkitTransform = ''; - works[i].style.msTransform = ''; - works[i].style.transform = ''; - } catch(err) {} - return; - } var id = works[i].className; var index = id.indexOf("workevent"); id = id.substring(index+10,index+27); @@ -341,11 +350,9 @@ Template.main.helpers({ works[i].style.msTransform = 'scale(1.12)'; works[i].style.transform = 'scale(1.12)'; } else { - try { - works[i].style.webkitTransform = ''; - works[i].style.msTransform = ''; - works[i].style.transform = ''; - } catch(err) {} + works[i].style.webkitTransform = ''; + works[i].style.msTransform = ''; + works[i].style.transform = ''; } } return; @@ -376,11 +383,11 @@ Template.main.helpers({ if(Session.get("newWork")) { return true; } else { + var currClass = classes.findOne({_id: Session.get("currentWork")["class"]}) if(Meteor.userId() === Session.get("currentWork").creator || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || - classes.findOne({_id: Session.get("currentWork")._id}).moderators.indexOf(Meteor.userId()) !== -1|| - classes.findOne({_id: Session.get("currentWork")._id}).blockEdit.indexOf(Meteor.userId()) !== -1 || - classes.findOne({_id: Session.get("currentWork")._id}).banned.indexOf(Meteor.userId()) !== -1 + currClass.moderators.indexOf(Meteor.userId()) !== -1 || + currClass.banned.indexOf(Meteor.userId()) !== -1 ) return true; } }, @@ -517,11 +524,11 @@ Template.main.events({ }, 'click .change' (event) { if(!Session.get("newWork") && !document.getElementById("optionsContainer").contains(event.target)) { + var currClass = classes.findOne({_id: Session.get("currentWork")["class"]}); if(!(Meteor.userId() === Session.get("currentWork").creator || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || - classes.findOne({_id: Session.get("currentWork")._id}).moderators.indexOf(Meteor.userId()) !== -1 || - classes.findOne({_id: Session.get("currentWork")._id}).blockEdit.indexOf(Meteor.userId()) !== -1 || - classes.findOne({_id: Session.get("currentWork")._id}).banned.indexOf(Meteor.userId()) !== -1 + currClass.moderators.indexOf(Meteor.userId()) !== -1 || + currClass.banned.indexOf(Meteor.userId()) !== -1 )) return; } @@ -578,6 +585,15 @@ Template.main.events({ } }, 'click .radio' (event) { + if(!Session.get("newWork") && !document.getElementById("optionsContainer").contains(event.target)) { + var currClass = classes.findOne({_id: Session.get("currentWork")["class"]}); + if(!(Meteor.userId() === Session.get("currentWork").creator || + Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || + currClass.moderators.indexOf(Meteor.userId()) !== -1 || + currClass.banned.indexOf(Meteor.userId()) !== -1 + )) return; + } + var op = event.target; Session.set("radioDiv", op.getAttribute("op")); Session.set("radioOffset", op.getAttribute("opc")); @@ -679,11 +695,23 @@ Template.main.events({ var dom = event.target; while(event.target.className !== "workCard") event.target = event.target.parentNode; workid = event.target.getAttribute("workid"); + Session.set("newWork",false); var thisWork = work.findOne({_id:workid}); Session.set("currentWork",thisWork); var thisReadWork = formReadable(thisWork); Session.set("currentReadableWork",thisReadWork); + + if(!Session.get("newWork") && !document.getElementById("optionsContainer").contains(event.target)) { + var currClass = classes.findOne({_id: Session.get("currentWork")["class"]}); + if(!(Meteor.userId() === Session.get("currentWork").creator || + Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || + currClass.moderators.indexOf(Meteor.userId()) !== -1 || + currClass.banned.indexOf(Meteor.userId()) !== -1)) { + var inputs = $('#editWork .change').css("cursor","default"); + }; + } + openDivFade(document.getElementsByClassName("overlay")[0]); }, 'focus #workDatea' () { diff --git a/hourglass/server/main.js b/hourglass/server/main.js index b94db20..644dbae 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -538,7 +538,7 @@ Meteor.methods({ found !== null && pass === found.code && prof.classes.indexOf(change) === -1) { - foundsubs = found.subscribers + ''; + foundsubs = found.subscribers; classes.update({ _id: found._id }, {