Fixed editWork, and displays work information on click
This commit is contained in:
parent
6833e3a1cd
commit
00ded2965d
@ -145,7 +145,7 @@
|
||||
</template>
|
||||
|
||||
<template name="classModeWork">
|
||||
<div class="workCard">
|
||||
<div class="workCard" workid="{{_id}}">
|
||||
<div class="cWorkType" style="background-color:{{typeColor}}"></div>
|
||||
<div class="cWorkCont">
|
||||
<p class="cWorkName">{{name}}</p>
|
||||
|
||||
@ -72,7 +72,6 @@ Template.registerHelper('myClasses', () => {
|
||||
thisWork[j].dueDate = getReadableDate(thisWork[j].dueDate);
|
||||
thisWork[j].typeColor = workColors[thisWork[j].type];
|
||||
}
|
||||
console.log(thisWork);
|
||||
array[i].thisClassWork = thisWork;
|
||||
}
|
||||
return array;
|
||||
@ -173,11 +172,11 @@ Template.main.helpers({
|
||||
return Session.get("currentWork")[value];
|
||||
},
|
||||
workType() {
|
||||
type = Session.get("currentWork").type
|
||||
type = Session.get("currentWork").type;
|
||||
if(type.includes("edit")) {
|
||||
return;
|
||||
} else {
|
||||
return workColors.type;
|
||||
return workColors[type];
|
||||
}
|
||||
},
|
||||
cWorkColor(type) {
|
||||
@ -289,7 +288,6 @@ Template.main.events({
|
||||
} else {
|
||||
var attr = event.target.getAttribute("classid");
|
||||
}
|
||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||
Session.set("newWork", true);
|
||||
Session.set("currentWork",
|
||||
{
|
||||
@ -299,6 +297,7 @@ Template.main.events({
|
||||
description:"Click here to edit...",
|
||||
type:"Click here to edit..."
|
||||
});
|
||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||
},
|
||||
'click .change' (event) {
|
||||
var ele = event.target;
|
||||
@ -409,7 +408,6 @@ Template.main.events({
|
||||
'click #workSubmit' () {
|
||||
data = getHomeworkFormData();
|
||||
if(data === null) return;
|
||||
console.log(data);
|
||||
Session.set("serverData",data);
|
||||
if(Session.get("newWork")) {
|
||||
sendData("createWork");
|
||||
@ -423,7 +421,17 @@ Template.main.events({
|
||||
'focus .op' (event) {
|
||||
event.target.click();
|
||||
},
|
||||
|
||||
'click .workCard' (event) {
|
||||
var dom = event.target;
|
||||
while(event.target.className !== "workCard") event.target = event.target.parentNode;
|
||||
workid = event.target.getAttribute("workid");
|
||||
Session.set("newWork",false);
|
||||
var thisWork = work.findOne({_id:workid});
|
||||
thisWork.dueDate = getReadableDate(thisWork.dueDate);
|
||||
thisWork.type = thisWork.type[0].toUpperCase() + thisWork.type.slice(1);
|
||||
Session.set("currentWork",thisWork);
|
||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||
}
|
||||
});
|
||||
|
||||
function openDivFade(div) {
|
||||
@ -500,5 +508,5 @@ function getHomeworkFormData() {
|
||||
function getReadableDate(date) {
|
||||
var days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
|
||||
var months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
|
||||
return days[date.getDay()]+", "+months[date.getMonth()]+" "+date.getDate();
|
||||
return days[date.getDay()]+", "+months[date.getMonth()]+" "+date.getDate()+", "+date.getFullYear();
|
||||
}
|
||||
@ -190,12 +190,12 @@ Meteor.methods({
|
||||
|
||||
var currentclass = classes.findOne({
|
||||
_id: work.findOne({
|
||||
_id: workId
|
||||
_id: change._id
|
||||
}).class
|
||||
});
|
||||
var authorized = currentclass.moderators.push(currentclass.admin);
|
||||
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
|
||||
Meteor.update({
|
||||
work.update({
|
||||
_id: change._id
|
||||
}, {
|
||||
$set: change
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user