small fixes
This commit is contained in:
parent
0ca99c7680
commit
dd9b82749c
@ -264,6 +264,9 @@
|
||||
<span id="wName" class="info">{{work 'name'}}</span>
|
||||
</div>
|
||||
<div id="workInfo1">
|
||||
<div>
|
||||
<span class="workTitle">Class:</span><span style="font-size:2.2vh">{{work 'class'}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="workTitle">Due Date:</span><br>
|
||||
<span id="wDescription" class="info">{{work 'dueDate'}}</span>
|
||||
@ -291,6 +294,9 @@
|
||||
<span class="resText">{{restrict 'wName'}}</span>
|
||||
</div>
|
||||
<div id="workInfo1">
|
||||
<div>
|
||||
<span class="workTitle">Class:</span><span style="font-size:2.2vh">{{work 'class'}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="workTitle">Due Date:</span><br>
|
||||
<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({
|
||||
'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) {
|
||||
clicked = true;
|
||||
@ -992,7 +992,7 @@ myClasses = function() {
|
||||
});
|
||||
if(found === undefined) return;
|
||||
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;
|
||||
if (found.admin === Meteor.userId()) { // If user owns this class.
|
||||
found.box = " owned";
|
||||
|
||||
@ -345,6 +345,7 @@
|
||||
|
||||
#code {
|
||||
margin: 0;
|
||||
padding: 2%;
|
||||
width: auto;
|
||||
|
||||
background-color: rgba(255,255,255,0.3);
|
||||
@ -360,9 +361,10 @@
|
||||
}
|
||||
|
||||
#copyHolder {
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
|
||||
right: -500px;
|
||||
}
|
||||
|
||||
#changeAdminWrapper {
|
||||
|
||||
@ -411,7 +411,8 @@
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
</div>
|
||||
{{> classInfoCode classInfo 'code'}}
|
||||
|
||||
{{> classInfoCode}}
|
||||
|
||||
<div id="changeAdminWrapper">
|
||||
<span>Change Admin: </span>
|
||||
@ -484,13 +485,14 @@
|
||||
</template>
|
||||
|
||||
<template name="classInfoCode">
|
||||
{{#if exists}}
|
||||
<div id="code" class="infoCard" style="border:1px solid {{divColor 'textColor'}}">
|
||||
{{classInfo 'code'}}
|
||||
{{#if code 'exists'}}
|
||||
<div class="infoCard" style="border:1px solid {{divColor 'textColor'}}">
|
||||
<h4 style="border-bottom:1px solid {{divColor 'textColor'}}">Code</h4>
|
||||
<span>{{code}}</span>
|
||||
<input id="copyHolder" value="{{code}}">
|
||||
<span>{{code 'code'}}</span>
|
||||
<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>
|
||||
<div>Copied!</div>
|
||||
<div id="code">Copied!</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
|
||||
@ -220,15 +220,12 @@ Template.registerHelper("classInfo", (info) => {
|
||||
_id: (isYou) ? Meteor.userId() : thisClass.admin
|
||||
});
|
||||
case "code":
|
||||
if (isYou) return {
|
||||
exists: false
|
||||
};
|
||||
return (isYou || Meteor.userId() !== this.admin) ? {
|
||||
exists: false
|
||||
} : {
|
||||
exists: true,
|
||||
code: Meteor.call('getCode', thisClass._id)
|
||||
};
|
||||
if(isYou || Meteor.userId() !== thisClass.admin) return false;
|
||||
var exist;
|
||||
Meteor.call('getCode', thisClass._id, function(err, result) {
|
||||
Session.set("code", [(result === undefined || result === "") ? false : true, result]);
|
||||
});
|
||||
break;
|
||||
case "mine":
|
||||
return (isYou) ? true : Meteor.userId() === thisClass.admin;
|
||||
case "moderators":
|
||||
@ -547,13 +544,14 @@ Template.createClass.events({
|
||||
return;
|
||||
}
|
||||
values.privacy = (values.privacy === "Public") ? false : true;
|
||||
values.status = false;
|
||||
values.status = false;
|
||||
values.category = values.category.toLowerCase();
|
||||
values.code = "";
|
||||
serverData = values;
|
||||
|
||||
if (!teachers.findOne({
|
||||
name: values.teacher
|
||||
})) {
|
||||
}) && values.teacher !== "") {
|
||||
Meteor.call("createTeacher", values.teacher, values.school, function(error, result) {
|
||||
if (error !== undefined) {
|
||||
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({
|
||||
'click .userAdder .fa' (event) {
|
||||
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) {
|
||||
$("#mainBody").fadeOut(250, function() {
|
||||
(Session.equals("sidebarMode", "option")) ? Session.set("settingMode", mode): Session.set("mode", mode);
|
||||
|
||||
@ -312,7 +312,7 @@ function securityCheck(checklist, input) {
|
||||
break;
|
||||
// Incorrect teacher format
|
||||
case 28:
|
||||
if (input.teachername.split(" ").length < 2) error = 20;
|
||||
if (input.teachername.split(" ").length < 2 && teachername !== "") error = 20;
|
||||
break;
|
||||
}
|
||||
results.push(error);
|
||||
@ -373,17 +373,17 @@ Meteor.methods({
|
||||
if (!security) {
|
||||
input.status = Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']);
|
||||
input.admin = Meteor.userId();
|
||||
Meteor.call('genCode', function(error, result) {
|
||||
Meteor.call('genCode', input.privacy, function(error, result) {
|
||||
input.code = result;
|
||||
});
|
||||
if (input.category != "class" && input.category != "club") {
|
||||
input.category = "other";
|
||||
}
|
||||
input.subscribers = [];
|
||||
input.moderators = [];
|
||||
input.banned = [];
|
||||
classes.insert(input, function(err, result) {
|
||||
Meteor.call('joinClass', [result, input.code]);
|
||||
if (input.category != "class" && input.category != "club") {
|
||||
input.category = "other";
|
||||
}
|
||||
input.subscribers = [];
|
||||
input.moderators = [];
|
||||
input.banned = [];
|
||||
classes.insert(input, function(err, result) {
|
||||
Meteor.call('joinClass', [result, input.code]);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
throw new Meteor.Error(errors[security]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user