This commit is contained in:
Kenneth Jao 2017-04-18 12:13:02 -04:00
commit c7cdd30cf5
9 changed files with 305 additions and 95 deletions

View File

@ -30,6 +30,13 @@ Every piece of work has a confirmed to reported ratio. This is the ratio of the
In the left sidebar, you find options for filtering. These include filtering by class or type of assignment. In the left sidebar, you find options for filtering. These include filtering by class or type of assignment.
## Changelog ## Changelog
### 0.2.3
- Mobile sidebar closes on tap from the side
- Mobile sign-up bug fixed
- Calendar date bug fixed
- Fixed visual issues
- Class code bug fixes
### 0.2.2 ### 0.2.2
- Fixed visual issues in mobile - Fixed visual issues in mobile
- Drag scrolling for classes mode on desktop version - Drag scrolling for classes mode on desktop version

View File

@ -432,7 +432,7 @@ input {
} }
.classWrapper { .classWrapper {
width: 20vw; width: 35vh;
height: 95%; height: 95%;
margin: 10px; margin: 10px;
margin-top: 20px; margin-top: 20px;
@ -450,13 +450,13 @@ input {
} }
.classInfo { .classInfo {
padding: 6%; padding: 3vh;
background-color: rgba(255,255,255,0.3); /* remove when class color */ background-color: rgba(255,255,255,0.3); /* remove when class color */
cursor: pointer; cursor: pointer;
} }
.mainClassName { .mainClassName {
font-size: 2vw; font-size: 3.7vh;
white-space: normal; white-space: normal;
-webkit-filter: none !important; -webkit-filter: none !important;
@ -465,18 +465,18 @@ input {
} }
.mainClassHour { .mainClassHour {
font-size: 1.1vw; font-size: 1.7vh;
margin-top: 0; margin-top: 0;
pointer-events: none; pointer-events: none;
} }
.mainClassTeacher { .mainClassTeacher {
font-size: 1.1vw; font-size: 1.7vh;
pointer-events: none; pointer-events: none;
} }
.creWork { .creWork {
font-size: 1.1vw; font-size: 1.7vh;
cursor: pointer; cursor: pointer;
box-shadow: 0px 5px 5px -2px #666; box-shadow: 0px 5px 5px -2px #666;
@ -548,12 +548,12 @@ input {
} }
.cWorkCont { .cWorkCont {
font-size: .97vw; font-size: 1.7vh;
padding: 5%; padding: 5%;
} }
.cWorkType { .cWorkType {
height: .3vw; height: .8vh;
} }
.cWorkName { .cWorkName {
@ -1089,6 +1089,11 @@ textarea.clickModify {
pointer-events: auto; pointer-events: auto;
} }
.fc-day {
max-height: 11vh;
overflow-y: auto;
}
#workComment { #workComment {
width: 99%; width: 99%;
margin-bottom: 3%; margin-bottom: 3%;

View File

@ -122,7 +122,7 @@
<img src="{{work 'avatar'}}" style="width:{{screen '3' '140'}};height:{{screen '3' '140'}}"> <img src="{{work 'avatar'}}" style="width:{{screen '3' '140'}};height:{{screen '3' '140'}}">
</div> </div>
<div style="display:inline-block;margin-left:0.3vw"> <div style="display:inline-block;margin-left:0.3vw">
<span>{{work 'creatorname'}}</span> <span>{{work 'creator'}}</span>
</div> </div>
</div> </div>
</div> </div>
@ -264,6 +264,9 @@
<span id="wName" class="info">{{work 'name'}}</span> <span id="wName" class="info">{{work 'name'}}</span>
</div> </div>
<div id="workInfo1"> <div id="workInfo1">
<div>
<span class="workTitle">Class:</span><span style="font-size:2.2vh">{{work 'class'}}</span>
</div>
<div> <div>
<span class="workTitle">Due Date:</span><br> <span class="workTitle">Due Date:</span><br>
<span id="wDescription" class="info">{{work 'dueDate'}}</span> <span id="wDescription" class="info">{{work 'dueDate'}}</span>
@ -291,6 +294,9 @@
<span class="resText">{{restrict 'wName'}}</span> <span class="resText">{{restrict 'wName'}}</span>
</div> </div>
<div id="workInfo1"> <div id="workInfo1">
<div>
<span class="workTitle">Class:</span><span style="font-size:2.2vh">{{work 'class'}}</span>
</div>
<div> <div>
<span class="workTitle">Due Date:</span><br> <span class="workTitle">Due Date:</span><br>
<input id="wDueDate" class="clickModify" style="color:{{divColor 'textColor'}}" value="{{work 'dueDate'}}" tabindex="11" readonly="readonly"> <input id="wDueDate" class="clickModify" style="color:{{divColor 'textColor'}}" value="{{work 'dueDate'}}" tabindex="11" readonly="readonly">

View File

@ -8,6 +8,9 @@ import './main.html';
var load = true; var load = true;
var calWorkOpen = null; var calWorkOpen = null;
var calWorkDate = null; var calWorkDate = null;
var dragging = false;
var clicked = false;
var defaultWork = { var defaultWork = {
name: "Name | Click here to edit...", name: "Name | Click here to edit...",
@ -20,6 +23,7 @@ var defaultWork = {
Session.set("user", {}); // Stores user preferences. Session.set("user", {}); // Stores user preferences.
Session.set("calendarEvents", []); // Stores calendar classes. Session.set("calendarEvents", []); // Stores calendar classes.
Session.set("myClasses", []); // Stores user classes. Session.set("myClasses", []); // Stores user classes.
Session.set("myWork", []); // Stores user related work.
Session.set("requests", false); // Status of requests. Session.set("requests", false); // Status of requests.
Session.set("sidebarMode", ""); // Status of sidebars. Session.set("sidebarMode", ""); // Status of sidebars.
Session.set("newWork", null); // If user creating new work. Session.set("newWork", null); // If user creating new work.
@ -31,8 +35,6 @@ Session.set("classDispHover", null); // Stores current hovered class filter.
Session.set("restrictText", {}); // Stores text for comment character restriction. Session.set("restrictText", {}); // Stores text for comment character restriction.
Session.set("confirmText", ""); // Stores text for confirmations. Session.set("confirmText", ""); // Stores text for confirmations.
var dragging = false;
// On render actions // On render actions
Template.login.rendered = function() { Template.login.rendered = function() {
@ -47,6 +49,18 @@ Template.main.created = function() {
$(".overlay").fadeOut(150); $(".overlay").fadeOut(150);
} }
}); });
getClasses();
work.find().observeChanges({
added: function (id, fields) {
updateWork(id, fields, "added");
},
changed: function (id, fields) {
updateWork(id, fields, "changed");
},
removed: function (id) {
updateWork(id, null, "remove");
}
});
/*if (Notification.permission !== "granted") { /*if (Notification.permission !== "granted") {
Notification.requestPermission().then(function(result) { Notification.requestPermission().then(function(result) {
@ -75,12 +89,11 @@ Template.classesMode.rendered = function() {
$(".mainClass .slimScrollBar").css("display", "none"); $(".mainClass .slimScrollBar").css("display", "none");
var area = $("#classesMode"); var area = $("#classesMode");
var clicked = false;
var clickX = 0; var clickX = 0;
area.on({ area.on({
'mousemove': function(e) { 'mousemove': function(e) {
if(clicked) area.scrollLeft(area.scrollLeft() + (clickX - e.pageX)/25); if(clicked && !dragging) area.scrollLeft(area.scrollLeft() + (clickX - e.pageX)/70);
}, },
'mousedown': function(e) { 'mousedown': function(e) {
clicked = true; clicked = true;
@ -130,19 +143,171 @@ 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. /*var myClasses = Session.get("user").classes;
var classDisp = Session.get("classDisp");
if (myClasses.length === 0) { // Null checking.
return []; return [];
} else { } else {
var array = myClasses(); var array = [];
for(var i = 0; i < myClasses.length; i++) {
var classObj;
if(myClasses[i] === Meteor.userId()) {
classObj.name = "Personal";
classObj.box = " owned";
classObj.mine = false; // Actual value is reversed.
classObj.subscribers = 1;
} else {
classObj = classes.findOne({_id: myClasses[i]});
if(classObj === undefined) return;
var isAdmin = classObj.admin === Meteor.userId();
classObj.box = (isAdmin) ? " owned" : "";
classObj.mine = (isAdmin) ? false : true; // Actual value is reversed
classObj.subscribers = classObj.subscribers.length;
classObj.teachershort = (found.teacher === undefined) ? "" : found.teacher.split(" ").slice(1).reduce(function(a,b) { return a+ " " + b;});
}
classObj.selected = ((classDisp.indexOf(myClasses[i]) !== -1)) ? Session.get("user").preferences.theme.modeHighlight : "rgba(0,0,0,0)"; // Filter selected.
array.push(classObj);
}*/
/* var array = myClasses();
if(Meteor.Device.isPhone()) mobileWork(); if(Meteor.Device.isPhone()) mobileWork();
Session.set("myClasses", array); Session.set("myClasses", array);
calendarEvents(array); calendarEvents(array);
$("#fullcalendar").fullCalendar("removeEvents"); $("#fullcalendar").fullCalendar("removeEvents");
$("#fullcalendar").fullCalendar("addEventSource", Session.get("calendarEvents")) $("#fullcalendar").fullCalendar("addEventSource", Session.get("calendarEvents"))*/
return array; return Session.get("myClasses");
}
}); });
Template.registerHelper('myWork', () => {
return Session.get("myWork");
});
getClasses = function() {
var array = [];
var myClasses = Session.get("user").classes;
var classDisp = Session.get("classDisp");
for(var i = 0; i < myClasses.length; i++) {
var classObj = {};
if(myClasses[i] === Meteor.userId()) {
classObj.name = "Personal";
classObj.box = " owned";
classObj.mine = false; // Actual value is reversed.
classObj.subscribers = 1;
classObj.admin = Meteor.userId();
classObj._id = Meteor.userId();
} else {
classObj = classes.findOne({_id: myClasses[i]});
if(classObj === undefined) return;
var isAdmin = classObj.admin === Meteor.userId();
classObj.box = (isAdmin) ? " owned" : "";
classObj.mine = (isAdmin) ? false : true; // Actual value is reversed
classObj.subscribers = classObj.subscribers.length;
classObj.teachershort = (classObj.teacher === undefined) ? "" : classObj.teacher.split(" ").slice(1).reduce(function(a,b) { return a+ " " + b;});
}
classObj.selected = ((classDisp.indexOf(myClasses[i]) !== -1)) ? Session.get("user").preferences.theme.modeHighlight : "rgba(0,0,0,0)"; // Filter selected.
array.push(classObj);
}
Session.set("myClasses", array);
}
updateWork = function(id, fields, type) {
if(type === "remove" && Session.get("myWork").filter(function(work) { // Removed work and exists in user data.
return work._id === id;
}).length !== 0) {
Session.set("myWork", Session.get("myWork").filter(function(work) {
return work._id !== id;
}));
return;
}
var classDisp = Session.get("classDisp");
var sideFilter = Session.get("typeFilter"); // Get sidebar type filter.
var hideTime = Session.get("user").preferences.timeHide;
var workObj;
if(type === "added") {
workObj = Object.assign({}, fields, {_id: id})
} else if(type === "changed") {
workObj = Object.assign(Session.get("myWork").filter(function(work) {
return work._id === id;
}), fields);
}
workObj.classid = workObj.class;
workObj.realDate = workObj.dueDate;
workObj.dueDate = moment(workObj.dueDate).calendar(null, {
sameDay: '[Today]',
nextDay: '[Tomorrow]',
nextWeek: 'dddd',
lastDay: '[Yesterday]',
lastWeek: '[Last] dddd',
sameElse: 'MMMM Do'
});
if (workObj.dueDate === "Today") { // Font weight based on date proximity.
workObj.cardDate = "600";
} else if (workObj.dueDate === "Tomorrow") {
workObj.cardDate = "400";
}
workObj.typeColor = workColors[workObj.type];
workObj.confirmationLength = workObj.confirmations.length; // Counts the number of confirmations and reports for a particular work.
workObj.reportLength = workObj.reports.length;
workObj.creatorname = Meteor.users.findOne({
_id: workObj.creator
}).profile.name;
workObj.hide = false;
//Filters
var notInClassFilter = classDisp.length !== 0 && !_.contains(classDisp, workObj.classid);
var pastHideDate = hideTime !== 0 && (moment().subtract(hideTime, 'days'))._d > (moment(workObj.realDate))._d;
var markedDone = Session.get("user").preferences.done && !Meteor.Device.isPhone() && _.contains(workObj.done, Meteor.userId());
var reported = (workObj.reportLength / (workObj.reportLength + workObj.confirmationLength)) > 0.7; // Over 70% are reports
if(notInClassFilter || pastHideDate || markedDone) workObj.hide = true;
var normalColor = Session.get("user").preferences.theme.text;
// Ratio color handling
/*var conf = workObj.confirmations.length;
var repo = workObj.reports.length;
var ratio = conf / repo;
if (Math.abs(conf - repo)) {
if ((conf + repo) <= 1) {
thisWork[j].doneRatio = normalColor;
} else {
thisWork[j].doneRatio = "#F9F906";
}
} else if (ratio >= 2) {
thisWork[j].doneRatio = "#33DD33";
} else if (ratio <= 0.9) {
thisWork[j].doneRatio = "#FF1A1A";
}*/
workObj.doneRatio = normalColor;
var myWork;
if(type === "added") {
myWork = Session.get("myWork");
} else if(type === "changed") {
myWork = Session.get("myWork").filter(function(work) {
return work._id !== id;
});
}
myWork.push(workObj);
Session.set("myWork", myWork.sort(function(a,b) {
return Date.parse(a.realDate) - Date.parse(b.realDate);
}));
calendarEvents();
$("#fullcalendar").fullCalendar("removeEvents");
$("#fullcalendar").fullCalendar("addEventSource", Session.get("calendarEvents"));
}
Template.registerHelper('pref', (val) => { // Obtains all user preferences. Template.registerHelper('pref', (val) => { // Obtains all user preferences.
try { try {
if(val === "school") return Session.get("user").school; if(val === "school") return Session.get("user").school;
@ -215,7 +380,9 @@ Template.main.helpers({
return " - " + Session.get("user").school; return " - " + Session.get("user").school;
}, },
avatar() { // Returns avatar. avatar() { // Returns avatar.
return Meteor.user().services.google.picture; try {
return Meteor.user().services.google.picture;
} catch(err) {}
}, },
username() { // Returns user name. username() { // Returns user name.
return Session.get("user").name; return Session.get("user").name;
@ -681,11 +848,11 @@ Template.main.events({
}, },
'click .cWorkBottom .fa-thumbs-up' (event) { 'click .cWorkBottom .fa-thumbs-up' (event) {
serverData = [event.target.parentNode.parentNode.parentNode.parentNode.getAttribute("workid"), "confirmations"] serverData = [event.target.parentNode.parentNode.parentNode.parentNode.getAttribute("workid"), "confirmations"]
sendData("toggleWork") sendData("toggleWork");
}, },
'click .cWorkBottom .fa-exclamation-triangle' (event) { 'click .cWorkBottom .fa-exclamation-triangle' (event) {
serverData = [event.target.parentNode.parentNode.parentNode.parentNode.getAttribute("workid"), "reports"] serverData = [event.target.parentNode.parentNode.parentNode.parentNode.getAttribute("workid"), "reports"]
sendData("toggleWork") sendData("toggleWork");
}, },
'click #signout' () { 'click #signout' () {
$(".noScroll").velocity("fadeOut", 50); $(".noScroll").velocity("fadeOut", 50);
@ -694,6 +861,15 @@ Template.main.events({
} }
}); });
Template.classesMode.helpers({
thisClassWork() {
var id = this._id;
return Session.get("myWork").filter(function(work) {
return work.classid === id;
});
}
});
// Other Functions // Other Functions
toggleOptionMenu = function(toggle, menu) { toggleOptionMenu = function(toggle, menu) {
@ -960,6 +1136,7 @@ startDragula = function() {
var els = document.getElementsByClassName("classWrapper"); var els = document.getElementsByClassName("classWrapper");
if($(els[0]).hasClass("gu-transit")) return; if($(els[0]).hasClass("gu-transit")) return;
dragging = false; dragging = false;
clicked = false;
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");
@ -991,7 +1168,7 @@ myClasses = function() {
}); });
if(found === undefined) return; if(found === undefined) return;
found.subscribers = found.subscribers.length; found.subscribers = found.subscribers.length;
found.teachershort = found.teacher.split(" ").slice(1).reduce(function(a,b) { return a+ " " + b;}); found.teachershort = (found.teacher === undefined) ? "" : found.teacher.split(" ").slice(1).reduce(function(a,b) { return a+ " " + b;});
found.mine = true; found.mine = true;
if (found.admin === Meteor.userId()) { // If user owns this class. if (found.admin === Meteor.userId()) { // If user owns this class.
found.box = " owned"; found.box = " owned";
@ -1089,35 +1266,30 @@ myClasses = function() {
return array; return array;
} }
function calendarEvents(array) { function calendarEvents() {
var events = []; var events = [];
var userClasses = array; var myWork = Session.get("myWork");
if(userClasses === undefined) return; for(var i = 0; i < myWork.length; i++) {
for (var i = 0; i < userClasses.length; i++) { var work = myWork[i];
var works = userClasses[i].thisClassWork; var currClass = classes.findOne({ _id: work.classid});
for (var j = 0; j < works.length; j++) { var inRole = false;
var work = works[j];
var currClass = classes.findOne({
_id: work.class
});
var inRole = false;
if (work.class === Meteor.userId() || if (work.class === Meteor.userId() ||
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
) inRole = true; ) inRole = true;
events.push({
id: work._id, events.push({
start: work.realDate.toISOString().slice(0, 10), id: work._id,
title: work.name, start: work.realDate.toISOString().slice(0, 10),
backgroundColor: workColors[work.type], title: work.name,
borderColor: "#444", backgroundColor: workColors[work.type],
startEditable: inRole, borderColor: "#444",
className: work.type + " workevent " + work.class startEditable: inRole,
}); className: work.type + " workevent " + work.class
} });
} }
Session.set("calendarEvents", events); Session.set("calendarEvents", events);
} }

View File

@ -346,6 +346,7 @@
#code { #code {
margin: 0; margin: 0;
padding: 2%;
width: auto; width: auto;
background-color: rgba(255,255,255,0.3); background-color: rgba(255,255,255,0.3);
@ -361,9 +362,10 @@
} }
#copyHolder { #copyHolder {
visibility: hidden;
pointer-events: none; pointer-events: none;
position: absolute; position: absolute;
right: -500px;
} }
#changeAdminWrapper { #changeAdminWrapper {

View File

@ -411,7 +411,8 @@
{{/if}} {{/if}}
{{/unless}} {{/unless}}
</div> </div>
{{> classInfoCode classInfo 'code'}}
{{> classInfoCode}}
<div id="changeAdminWrapper"> <div id="changeAdminWrapper">
<span>Change Admin: </span> <span>Change Admin: </span>
@ -484,13 +485,14 @@
</template> </template>
<template name="classInfoCode"> <template name="classInfoCode">
{{#if exists}} {{classInfo 'code'}}
<div id="code" class="infoCard" style="border:1px solid {{divColor 'textColor'}}"> {{#if code 'exists'}}
<div class="infoCard" style="border:1px solid {{divColor 'textColor'}}">
<h4 style="border-bottom:1px solid {{divColor 'textColor'}}">Code</h4> <h4 style="border-bottom:1px solid {{divColor 'textColor'}}">Code</h4>
<span>{{code}}</span> <span>{{code 'code'}}</span>
<input id="copyHolder" value="{{code}}"> <input id="copyHolder" value="{{code 'code'}}">
<i class="fa fa-files-o" aria-hidden="true" onmouseover="$(this).css('color','{{divColor 'iconHighlight'}}')" onmouseleave="$(this).css('color','{{divColor 'textColor'}}')"></i> <i class="fa fa-files-o" aria-hidden="true" onmouseover="$(this).css('color','{{divColor 'iconHighlight'}}')" onmouseleave="$(this).css('color','{{divColor 'textColor'}}')"></i>
<div>Copied!</div> <div id="code">Copied!</div>
</div> </div>
{{/if}} {{/if}}
</template> </template>

View File

@ -220,15 +220,12 @@ Template.registerHelper("classInfo", (info) => {
_id: (isYou) ? Meteor.userId() : thisClass.admin _id: (isYou) ? Meteor.userId() : thisClass.admin
}); });
case "code": case "code":
if (isYou) return { if(isYou || Meteor.userId() !== thisClass.admin) return false;
exists: false var exist;
}; Meteor.call('getCode', thisClass._id, function(err, result) {
return (isYou || Meteor.userId() !== this.admin) ? { Session.set("code", [(result === undefined || result === "") ? false : true, result]);
exists: false });
} : { break;
exists: true,
code: Meteor.call('getCode', thisClass._id)
};
case "mine": case "mine":
return (isYou) ? true : Meteor.userId() === thisClass.admin; return (isYou) ? true : Meteor.userId() === thisClass.admin;
case "moderators": case "moderators":
@ -376,7 +373,7 @@ Template.joinClass.helpers({
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {
array[i].join = true; array[i].join = true;
array[i].subscribers = array[i].subscribers.length; array[i].subscribers = array[i].subscribers.length;
array[i].teachershort = array[i].teacher.split(" ").slice(1).reduce(function(a, b) { if(array[i].teacher !== undefined) array[i].teachershort = array[i].teacher.split(" ").slice(1).reduce(function(a, b) {
return a + " " + b; return a + " " + b;
}); });
} }
@ -489,10 +486,11 @@ Template.joinClass.events({
Meteor.call("joinPrivateClass", input.value, function(error, result) { Meteor.call("joinPrivateClass", input.value, function(error, result) {
if (result) { if (result) {
sAlert.success("Joined!", { sAlert.success("Joined!", {
effect: 'genie', effect: 'stackslide',
position: 'bottom-right', position: 'bottom-right',
timeout: 1500 timeout: 1500
}); });
$("#privateCode").velocity("fadeOut",100);
} else { } else {
sAlert.error("Invalid code!", { sAlert.error("Invalid code!", {
effect: 'stackslide', effect: 'stackslide',
@ -500,7 +498,9 @@ Template.joinClass.events({
timeout: 1500 timeout: 1500
}); });
} }
}); });
} }
}); });
@ -551,9 +551,10 @@ Template.createClass.events({
values.category = values.category.toLowerCase(); values.category = values.category.toLowerCase();
values.code = ""; values.code = "";
serverData = values; serverData = values;
if (!teachers.findOne({ if (!teachers.findOne({
name: values.teacher name: values.teacher
})) { }) && values.teacher !== "") {
Meteor.call("createTeacher", values.teacher, values.school, function(error, result) { Meteor.call("createTeacher", values.teacher, values.school, function(error, result) {
if (error !== undefined) { if (error !== undefined) {
sAlert.error(error.message, { sAlert.error(error.message, {
@ -570,6 +571,30 @@ Template.createClass.events({
} }
}); });
Template.classInfoCode.events({
'click .fa' (event) {
document.getElementById("copyHolder").select();
document.execCommand("copy");
$(event.target.parentNode.childNodes[9]).fadeIn(100, function() {
setTimeout(function() {
$(event.target.parentNode.childNodes[9]).fadeOut(250);
}, 500);
});
}
});
Template.classInfoCode.helpers({
code(info) {
try {
if(info === "exists") {
return Session.get("code")[0];
} else {
return Session.get("code")[1];
}
} catch(err) {}
}
})
Template.classInfoUsers.events({ Template.classInfoUsers.events({
'click .userAdder .fa' (event) { 'click .userAdder .fa' (event) {
var type = event.target.getAttribute("user"); var type = event.target.getAttribute("user");
@ -621,18 +646,6 @@ Template.classInfoUsers.events({
} }
}); });
Template.classInfoCode.events({
'click .fa' (event) {
document.getElementById("copyHolder").select();
document.execCommand("copy");
$(event.target.parentNode.childNodes[9]).fadeIn(100, function() {
setTimeout(function() {
$(event.target.parentNode.childNodes[9]).fadeOut(250);
}, 500);
});
}
});
toggleToMode = function(mode) { toggleToMode = function(mode) {
$("#mainBody").fadeOut(250, function() { $("#mainBody").fadeOut(250, function() {
(Session.equals("sidebarMode", "option")) ? Session.set("settingMode", mode): Session.set("mode", mode); (Session.equals("sidebarMode", "option")) ? Session.set("settingMode", mode): Session.set("mode", mode);

View File

@ -7,6 +7,7 @@ Session.set("select", "none");
Session.set("options", null); Session.set("options", null);
var filterOpen = [false, true, true]; var filterOpen = [false, true, true];
var timeout;
Template.registerHelper('optionInfo', (type) => { Template.registerHelper('optionInfo', (type) => {
var op = Session.get("options") var op = Session.get("options")
@ -116,7 +117,7 @@ Template.mobile.rendered = function() {
Template.mobile.events({ Template.mobile.events({
'click #mOverlay' () { 'click #mOverlay' () {
toggleSidebar(false); if(timeout) toggleSidebar(false);
} }
}); });
@ -604,6 +605,10 @@ addMobileButton = function(element, lighten, animateType, completeFunction) {
ele.on('touchend', function(e) { ele.on('touchend', function(e) {
if(!care) return; if(!care) return;
ele.velocity("stop"); ele.velocity("stop");
timeout = false;
setTimeout(function() {
timeout = true;
}, 100);
switch(type) { switch(type) {
case "color": case "color":
ele.velocity( ele.velocity(

View File

@ -312,7 +312,7 @@ function securityCheck(checklist, input) {
break; break;
// Incorrect teacher format // Incorrect teacher format
case 28: case 28:
if (input.teachername.split(" ").length < 2) error = 20; if (input.teachername.split(" ").length < 2 && teachername !== "") error = 20;
break; break;
} }
results.push(error); results.push(error);
@ -373,17 +373,17 @@ Meteor.methods({
if (!security) { if (!security) {
input.status = Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']); input.status = Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']);
input.admin = Meteor.userId(); input.admin = Meteor.userId();
Meteor.call('genCode', function(error, result) { Meteor.call('genCode', input.privacy, function(error, result) {
input.code = result; input.code = result;
}); if (input.category != "class" && input.category != "club") {
if (input.category != "class" && input.category != "club") { input.category = "other";
input.category = "other"; }
} input.subscribers = [];
input.subscribers = []; input.moderators = [];
input.moderators = []; input.banned = [];
input.banned = []; classes.insert(input, function(err, result) {
classes.insert(input, function(err, result) { Meteor.call('joinClass', [result, input.code]);
Meteor.call('joinClass', [result, input.code]); });
}); });
} else { } else {
throw new Meteor.Error(errors[security]); throw new Meteor.Error(errors[security]);
@ -754,11 +754,9 @@ Meteor.methods({
var current = Meteor.user().profile; var current = Meteor.user().profile;
var index = current.classes.indexOf(change); var index = current.classes.indexOf(change);
if (index >= 0) { if (index >= 0) {
console.log("hi");
if (classes.findOne({ if (classes.findOne({
_id: change _id: change
}).admin != Meteor.userId()) { }).admin != Meteor.userId()) {
console.log("f");
current.classes.splice(index, 1); current.classes.splice(index, 1);
Meteor.users.update({ Meteor.users.update({
_id: Meteor.userId() _id: Meteor.userId()