Lots of tiny bug fixes, such as display, naming, and functionality

This commit is contained in:
Kenneth Jao 2016-08-27 18:53:47 -04:00
parent 96e413f005
commit 416eafcd4c
5 changed files with 80 additions and 51 deletions

View File

@ -27,6 +27,7 @@
#loginTitle { #loginTitle {
font-size: 255%; font-size: 255%;
color: #000 !important;
padding: 1.4%; padding: 1.4%;
padding-left: 1%; padding-left: 1%;
} }

View File

@ -286,7 +286,6 @@ input, textarea {
#classListHolder { #classListHolder {
max-height: 48%; max-height: 48%;
width: 100%; width: 100%;
margin-bottom: 30%;
padding-right: 50%; padding-right: 50%;
position: absolute; position: absolute;
@ -325,7 +324,7 @@ input, textarea {
.sideClassHour { .sideClassHour {
font-weight: 400; font-weight: 400;
color: #444; color: #CCC;
margin: 0; margin: 0;
display: table-row; display: table-row;
} }
@ -402,20 +401,18 @@ input, textarea {
width: 100%; width: 100%;
margin-right: 0; margin-right: 0;
margin-bottom: 5%; margin-bottom: 5%;
background-color: rgba(255,255,255,0.3); background-color: rgba(255,255,255,0.3);
box-shadow: 2px 2px 5px 3px #666; box-shadow: 2px 2px 5px 3px #666;
cursor: pointer; cursor: pointer;
-webkit-transition: background-color 0.4s ease, transform 0.3s ease; -webkit-transition: box-shadow 0.4s ease, transform 0.3s ease;
-moz-transition: background-color 0.4s ease, transform 0.3s ease; -moz-transition: box-shadow 0.4s ease, transform 0.3s ease;
-ms-transition: background-color 0.4s ease, transform 0.3s ease; -ms-transition: box-shadow 0.4s ease, transform 0.3s ease;
transition: background-color 0.4s ease, transform 0.3s ease; transition: box-shadow 0.4s ease, transform 0.3s ease;
} }
.workCard:hover { .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 { .cWorkCont {
@ -449,9 +446,8 @@ input, textarea {
.workTitle, .prefTitle { .workTitle, .prefTitle {
font-size: 150%; font-size: 150%;
font-weight: 400; font-weight: 400;
margin: 0; margin: 0 3% 1% 0;
margin-right: 3%; cursor: default;
margin-bottom: 1%;
} }
.prefTitle { .prefTitle {
@ -759,14 +755,16 @@ input, textarea {
} }
.fc-day:not(.fc-past):not(.fc-other-month) { .fc-day:not(.fc-past):not(.fc-other-month) {
-webkit-transition: background-color 0.4s ease; box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.1);
-moz-transition: background-color 0.4s ease;
-ms-transition: background-color 0.4s ease; -webkit-transition: box-shadow 0.4s ease;
transition: background-color 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 { .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 { #prefCont {

View File

@ -71,9 +71,10 @@
<span class="change radio" opc="2" op="2" re="readonly" id="prefHide">{{pref 'timeHide'}}</span> <span class="change radio" opc="2" op="2" re="readonly" id="prefHide">{{pref 'timeHide'}}</span>
</div> </div>
<div class="prefOptions" style="background-color:{{divColor 'header'}}"> <div class="prefOptions" style="background-color:{{divColor 'header'}}">
<p class="prefOptionText">A Day</p> <p class="prefOptionText">1 Day</p>
<p class="prefOptionText">A Week</p> <P class="prefOptionText">2 Days</p>
<p class="prefOptionText">A Month</p> <p class="prefOptionText">1 Week</p>
<p class="prefOptionText">1 Month</p>
<p class="prefOptionText">Never</p> <p class="prefOptionText">Never</p>
</div> </div>
</div> </div>
@ -96,6 +97,7 @@
</div> </div>
{{/if}} {{/if}}
</div> </div>
<div class="overlay"> <div class="overlay">
<div id="editWork"> <div id="editWork">
<div id="editWorkCont" style="{{workCenter}};background-color:{{divColor 'header'}}"> <div id="editWorkCont" style="{{workCenter}};background-color:{{divColor 'header'}}">
@ -195,7 +197,7 @@
<div class="cWorkType" style="background-color:{{typeColor}}"></div> <div class="cWorkType" style="background-color:{{typeColor}}"></div>
<div class="cWorkCont"> <div class="cWorkCont">
<p class="cWorkName">{{name}}</p> <p class="cWorkName">{{name}}</p>
<span class="cWorkDate">{{dueDate}}</span> <span class="cWorkDate" style="font-weight:{{cardDate}}">{{dueDate}}</span>
</div> </div>
</div> </div>
</template> </template>

View File

@ -50,13 +50,14 @@ var workColors = {
var defaults = { var defaults = {
"theme":"light", "theme":"light",
"mode":"classes", "mode":"classes",
"timeHide":"A Day" "timeHide":"1 Day"
}; };
var ref = { var ref = {
"A Day":1, "1 Day":1,
"A Week":7, "2 Days":2,
"A Month":30, "1 Week":7,
"1 Month":30,
"Never":0 "Never":0
}; };
@ -81,12 +82,12 @@ Template.registerHelper('divColor', (div) => {
}); });
Template.registerHelper("textColor", () => { 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; return;
}); });
Template.registerHelper('overlayDim', (part) => { 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 width = "width:" + dim[0].toString() + "px;";
var height = "height:" + dim[1].toString() + "px;"; var height = "height:" + dim[1].toString() + "px;";
var margin = "margin-left:" + (-dim[0] / 2).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]; var hide = ref[Meteor.user().profile.preferences.timeHide];
for(var i = 0; i < courses.length; i++) { for(var i = 0; i < courses.length; i++) {
found = classes.findOne({_id:courses[i]}); found = classes.findOne({_id:courses[i]});
found.subscribers = found.subscribers.length/17; found.subscribers = found.subscribers.length;
found.mine = true; found.mine = true;
if(found.admin === Meteor.userId()) { if(found.admin === Meteor.userId()) {
found.box = " owned"; found.box = " owned";
@ -146,6 +147,11 @@ Template.registerHelper('myClasses', () => {
lastWeek: '[Last] dddd', lastWeek: '[Last] dddd',
sameElse: 'MMMM Do' 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]; thisWork[j].typeColor = workColors[thisWork[j].type];
var hoverHighlight = Session.get("classDispHover"); var hoverHighlight = Session.get("classDispHover");
if(hoverHighlight !== null && hoverHighlight === found._id) { if(hoverHighlight !== null && hoverHighlight === found._id) {
@ -248,15 +254,18 @@ Template.main.helpers({
} }
var inRole = false; var inRole = false;
var currClass = classes.findOne({_id: current.class})
if(Meteor.userId() === current.creator || if(Meteor.userId() === current.creator ||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
classes.findOne({_id: current._id}).moderators.indexOf(Meteor.userId()) !== -1|| currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
classes.findOne({_id: current._id}).blockEdit.indexOf(Meteor.userId()) !== -1 || currClass.banned.indexOf(Meteor.userId()) !== -1
classes.findOne({_id: current._id}).banned.indexOf(Meteor.userId()) !== -1
) inRole = true; ) inRole = true;
backgroundColor = workColors[current.type]; backgroundColor = workColors[current.type];
title = current.name; title = current.name;
duedate = current.dueDate.toISOString().slice(0, 10); duedate = current.dueDate.toISOString().slice(0, 10);
if(disp) { if(disp) {
events.push({ events.push({
id: current._id, id: current._id,
@ -324,15 +333,15 @@ Template.main.helpers({
highlight() { highlight() {
var hoverHighlight = Session.get("classDispHover"); var hoverHighlight = Session.get("classDispHover");
var works = document.getElementsByClassName("workevent"); 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++) { 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 id = works[i].className;
var index = id.indexOf("workevent"); var index = id.indexOf("workevent");
id = id.substring(index+10,index+27); id = id.substring(index+10,index+27);
@ -341,11 +350,9 @@ Template.main.helpers({
works[i].style.msTransform = 'scale(1.12)'; works[i].style.msTransform = 'scale(1.12)';
works[i].style.transform = 'scale(1.12)'; works[i].style.transform = 'scale(1.12)';
} else { } else {
try { works[i].style.webkitTransform = '';
works[i].style.webkitTransform = ''; works[i].style.msTransform = '';
works[i].style.msTransform = ''; works[i].style.transform = '';
works[i].style.transform = '';
} catch(err) {}
} }
} }
return; return;
@ -376,11 +383,11 @@ Template.main.helpers({
if(Session.get("newWork")) { if(Session.get("newWork")) {
return true; return true;
} else { } else {
var currClass = classes.findOne({_id: Session.get("currentWork")["class"]})
if(Meteor.userId() === Session.get("currentWork").creator || if(Meteor.userId() === Session.get("currentWork").creator ||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
classes.findOne({_id: Session.get("currentWork")._id}).moderators.indexOf(Meteor.userId()) !== -1|| currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
classes.findOne({_id: Session.get("currentWork")._id}).blockEdit.indexOf(Meteor.userId()) !== -1 || currClass.banned.indexOf(Meteor.userId()) !== -1
classes.findOne({_id: Session.get("currentWork")._id}).banned.indexOf(Meteor.userId()) !== -1
) return true; ) return true;
} }
}, },
@ -517,11 +524,11 @@ Template.main.events({
}, },
'click .change' (event) { 'click .change' (event) {
if(!Session.get("newWork") && !document.getElementById("optionsContainer").contains(event.target)) { 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 || if(!(Meteor.userId() === Session.get("currentWork").creator ||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
classes.findOne({_id: Session.get("currentWork")._id}).moderators.indexOf(Meteor.userId()) !== -1 || currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
classes.findOne({_id: Session.get("currentWork")._id}).blockEdit.indexOf(Meteor.userId()) !== -1 || currClass.banned.indexOf(Meteor.userId()) !== -1
classes.findOne({_id: Session.get("currentWork")._id}).banned.indexOf(Meteor.userId()) !== -1
)) return; )) return;
} }
@ -578,6 +585,15 @@ Template.main.events({
} }
}, },
'click .radio' (event) { '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; var op = event.target;
Session.set("radioDiv", op.getAttribute("op")); Session.set("radioDiv", op.getAttribute("op"));
Session.set("radioOffset", op.getAttribute("opc")); Session.set("radioOffset", op.getAttribute("opc"));
@ -679,11 +695,23 @@ Template.main.events({
var dom = event.target; var dom = event.target;
while(event.target.className !== "workCard") event.target = event.target.parentNode; while(event.target.className !== "workCard") event.target = event.target.parentNode;
workid = event.target.getAttribute("workid"); workid = event.target.getAttribute("workid");
Session.set("newWork",false); Session.set("newWork",false);
var thisWork = work.findOne({_id:workid}); var thisWork = work.findOne({_id:workid});
Session.set("currentWork",thisWork); Session.set("currentWork",thisWork);
var thisReadWork = formReadable(thisWork); var thisReadWork = formReadable(thisWork);
Session.set("currentReadableWork",thisReadWork); 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]); openDivFade(document.getElementsByClassName("overlay")[0]);
}, },
'focus #workDatea' () { 'focus #workDatea' () {

View File

@ -538,7 +538,7 @@ Meteor.methods({
found !== null && found !== null &&
pass === found.code && pass === found.code &&
prof.classes.indexOf(change) === -1) { prof.classes.indexOf(change) === -1) {
foundsubs = found.subscribers + ''; foundsubs = found.subscribers;
classes.update({ classes.update({
_id: found._id _id: found._id
}, { }, {