This commit is contained in:
Kenneth Jao 2017-04-26 02:35:06 -04:00
commit 41b44eed76
4 changed files with 58 additions and 11 deletions

View File

@ -476,6 +476,16 @@ input {
.mainClassTeacher { .mainClassTeacher {
font-size: 1.7vh; font-size: 1.7vh;
width: 70%;
display: table-cell;
pointer-events: none;
}
.mainClassStatus {
font-size: 1.7vh;
font-weight: bold;
margin: 0;
display: table-cell;
pointer-events: none; pointer-events: none;
} }
@ -670,7 +680,7 @@ textarea.clickModify {
} }
.info { .info {
font-size: 130%; font-size: 110%;
} }
.workTitle { .workTitle {
@ -1289,6 +1299,7 @@ textarea.clickModify {
} }
#markDone, #markConfirm, #markReport { #markDone, #markConfirm, #markReport {
font-size: 95%;
padding: 5%; padding: 5%;
background-color: rgba(0,0,0,0.1); background-color: rgba(0,0,0,0.1);

View File

@ -190,13 +190,22 @@
</template> </template>
<template name="classesMode"> <template name="classesMode">
<div class="classWrapper"> <div class="classWrapper"> <!-- class color -->
<div class="mainClass" style="background-color:{{divColor 'classCardColor'}}"> <div class="mainClass" style="background-color:{{divColor 'classCardColor'}}">
<div class="classInfo"> <!-- class color --> {{#if status}}
<h3 class="mainClassName">{{name}}</h3> <div class="classInfo">
<p class="mainClassHour">{{hour}}</p> <h3 class="mainClassName">{{name}}</h3>
<p class="mainClassTeacher">{{teacher}}</p> <p class="mainClassHour">{{hour}}</p>
</div> <p class="mainClassTeacher">{{teacher}}</p>
</div>
{{else}}
<div class="classInfo" style="border-top:1vh solid #E64F4F;padding-top:2vh">
<h3 class="mainClassName">{{name}}</h3>
<p class="mainClassHour">{{hour}}</p>
<p class="mainClassTeacher">{{teacher}}</p>
<p class="mainClassStatus">Unapproved</p>
</div>
{{/if}}
<div class="creWork" classid="{{_id}}"> <div class="creWork" classid="{{_id}}">
<i class="fa fa-plus" aria-hidden="true"></i> <i class="fa fa-plus" aria-hidden="true"></i>
<h4>Add Work</h4> <h4>Add Work</h4>

View File

@ -383,9 +383,24 @@ Template.main.helpers({
}); });
}, },
eventMouseover: function(event, jsEvent, view) { eventMouseover: function(event, jsEvent, view) {
var classid = work.findOne({_id: event.id})["class"];
var className = (classid === Meteor.userId()) ? "Personal" : classes.findOne({_id: classid}).name;
var span = this.children[0].children[0];
$(span).velocity("stop");
$(span).velocity({opacity:0}, 50, function() {
span.childNodes[0].nodeValue = className;
$(span).velocity({opacity:1}, 50);
});
this.style.boxShadow = "inset 0 0 0 99999px rgba(255,255,255,0.2)"; this.style.boxShadow = "inset 0 0 0 99999px rgba(255,255,255,0.2)";
}, },
eventMouseout: function(event, jsEvent, view) { eventMouseout: function(event, jsEvent, view) {
var workName = work.findOne({_id: event.id}).name;
var span = this.children[0].children[0];
$(span).velocity("stop");
$(span).velocity({opacity:0}, 50, function() {
span.childNodes[0].nodeValue = workName;
$(span).velocity({opacity:1}, 50);
});
this.style.boxShadow = ""; this.style.boxShadow = "";
}, },
dayClick: function(date, jsEvent, view) { // On-click for each day. dayClick: function(date, jsEvent, view) { // On-click for each day.
@ -843,8 +858,9 @@ sendData = function(funcName) { // Call Meteor function, and do actions after fu
if(funcName === "editProfile") filterWork(); if(funcName === "editProfile") filterWork();
Meteor.call(funcName, serverData, function(error, result) { Meteor.call(funcName, serverData, function(error, result) {
serverData = null; serverData = null;
if (error !== undefined) { if (error !== undefined) {
console.log(funcName);
console.log(error);
sAlert.error(error.error[1] || error.message, { sAlert.error(error.error[1] || error.message, {
effect: 'stackslide', effect: 'stackslide',
position: 'top' position: 'top'
@ -971,6 +987,7 @@ getClasses = function(myClasses) {
classObj.box = " owned"; classObj.box = " owned";
classObj.mine = false; // Actual value is reversed. classObj.mine = false; // Actual value is reversed.
classObj.subscribers = 1; classObj.subscribers = 1;
classObj.status = true;
classObj.admin = Meteor.userId(); classObj.admin = Meteor.userId();
classObj._id = Meteor.userId(); classObj._id = Meteor.userId();
} else { } else {
@ -990,13 +1007,23 @@ getClasses = function(myClasses) {
} }
updateWork = function(id, fields, type) { updateWork = function(id, fields, type) {
if(type === "added") {
var allWork = Session.get("myWork").concat(Session.get("filterWork"));
if(allWork.filter(function(work) {
return work._id === id;
}).length !== 0) return;
}
if(type === "remove" && Session.get("myWork").concat(Session.get("filterWork")).length === 0) return; if(type === "remove" && Session.get("myWork").concat(Session.get("filterWork")).length === 0) return;
if(type === "remove" && Session.get("myWork").filter(function(work) { // Removed work and exists in user data. if(type === "remove" && Session.get("myWork").concat(Session.get("filterWork")).filter(function(work) { // Removed work and exists in user data.
return work._id === id; return work._id === id;
}).length !== 0) { }).length !== 0) {
Session.set("myWork", Session.get("myWork").filter(function(work) { Session.set("myWork", Session.get("myWork").filter(function(work) {
return work._id !== id; return work._id !== id;
})); }));
Session.set("filterWork", Session.get("filterWork").filter(function(work) {
return work._id !== id;
}));
return; return;
} }

View File

@ -515,7 +515,7 @@ Meteor.methods({
var security = securityCheck([[[8, 9, true], 16, false], 10, 20, 11, 12, true], var security = securityCheck([[[8, 9, true], 16, false], 10, 20, 11, 12, true],
Object.assign({}, found || {}, input, {userId: Meteor.userId()})); Object.assign({}, found || {}, input, {userId: Meteor.userId()}));
if (!security) { if (!security) {
input = Object.assign({}, input, {confirmations: [Meteor.userId()], reports: [], done: [], numberdone: 0, comments: []}); input = Object.assign({}, input, {confirmations: [Meteor.userId()], reports: [], done: [], comments: []});
work.insert(input); work.insert(input);
} else { } else {
throw new Meteor.Error(errors[security]); throw new Meteor.Error(errors[security]);