small fixes
This commit is contained in:
parent
0ca99c7680
commit
dd9b82749c
@ -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">
|
||||||
|
|||||||
@ -80,7 +80,7 @@ Template.classesMode.rendered = function() {
|
|||||||
|
|
||||||
area.on({
|
area.on({
|
||||||
'mousemove': function(e) {
|
'mousemove': function(e) {
|
||||||
if(clicked && !dragging) area.scrollLeft(area.scrollLeft() + (clickX - e.pageX)/55);
|
if(clicked && !dragging) area.scrollLeft(area.scrollLeft() + (clickX - e.pageX)/70);
|
||||||
},
|
},
|
||||||
'mousedown': function(e) {
|
'mousedown': function(e) {
|
||||||
clicked = true;
|
clicked = true;
|
||||||
@ -992,7 +992,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;});
|
if(found.teacher !== undefined) found.teachershort = 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";
|
||||||
|
|||||||
@ -345,6 +345,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);
|
||||||
@ -360,9 +361,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#copyHolder {
|
#copyHolder {
|
||||||
visibility: hidden;
|
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
||||||
|
right: -500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#changeAdminWrapper {
|
#changeAdminWrapper {
|
||||||
|
|||||||
@ -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>
|
||||||
|
|||||||
@ -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":
|
||||||
@ -547,13 +544,14 @@ Template.createClass.events({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
values.privacy = (values.privacy === "Public") ? false : true;
|
values.privacy = (values.privacy === "Public") ? false : true;
|
||||||
values.status = false;
|
values.status = false;
|
||||||
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 +568,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 +643,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);
|
||||||
|
|||||||
@ -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]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user