Update calendar on change
This commit is contained in:
parent
bca216cf65
commit
93bd64c4b4
@ -42,6 +42,7 @@ Session.set("radioDiv",null);
|
||||
Session.set("radioOffset",null);
|
||||
Session.set("serverData",null);
|
||||
Session.set("noclass",null);
|
||||
Session.set("updateCalWork",true);
|
||||
|
||||
Template.registerHelper('divColor', (div) => {
|
||||
return themeColors[Cookie.get("theme")][div];
|
||||
@ -66,6 +67,7 @@ Template.registerHelper('myClasses', () => {
|
||||
for(var i = 0; i < courses.length; i++) {
|
||||
found = classes.findOne({_id:courses[i]});
|
||||
found.subscribers = found.subscribers.length;
|
||||
|
||||
if(found.admin === Meteor.userId()) found.box = " owned";
|
||||
array.push(found);
|
||||
|
||||
@ -87,7 +89,6 @@ Template.registerHelper('myClasses', () => {
|
||||
Session.set("noclass",false);
|
||||
Session.set("calendarclasses", Meteor.user().profile.classes);
|
||||
return array;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -142,6 +143,16 @@ Template.main.helpers({
|
||||
}
|
||||
},
|
||||
calendarOptions() {
|
||||
return {
|
||||
id: "fullcalendar",
|
||||
height: window.innerHeight * 0.8,
|
||||
buttonText: {
|
||||
today: 'Today',
|
||||
month: 'Month',
|
||||
week: 'Week',
|
||||
day: 'Day'
|
||||
},
|
||||
events: function(start, end, timezone, callback) {
|
||||
var events = [];
|
||||
var cursor = work.find({class: {$in: Session.get("calendarclasses")}});
|
||||
cursor.forEach(function(current) {
|
||||
@ -153,18 +164,12 @@ Template.main.helpers({
|
||||
start: duedate,
|
||||
title: title,
|
||||
backgroundColor: backgroundColor,
|
||||
borderColor: "#444",
|
||||
startEditable: true,
|
||||
className: "workevent",
|
||||
});
|
||||
});
|
||||
return {
|
||||
height: window.innerHeight * 0.8,
|
||||
events: events,
|
||||
buttonText: {
|
||||
today: 'Today',
|
||||
month: 'Month',
|
||||
week: 'Week',
|
||||
day: 'Day'
|
||||
callback(events);
|
||||
},
|
||||
eventDrop: function(event, delta, revertFunc) {
|
||||
var current = work.findOne({_id:event.id});
|
||||
@ -172,7 +177,28 @@ Template.main.helpers({
|
||||
current.dueDate = new Date(date[0],parseInt(date[1])-1,date[2],11,59,59);
|
||||
Session.set("serverData",current);
|
||||
sendData("editWork");
|
||||
}
|
||||
},
|
||||
eventClick: function(event, jsEvent, view) {
|
||||
var thisWork = work.findOne({_id:event.id})
|
||||
Session.set("currentWork",thisWork);
|
||||
var thisReadWork = formReadable(thisWork);
|
||||
Session.set("currentReadableWork",thisReadWork);
|
||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||
},
|
||||
/*dayClick: function(date, jsEvent, view) {
|
||||
//Make user select class
|
||||
Session.set("newWork", true);
|
||||
Session.set("currentReadableWork",
|
||||
{
|
||||
name:"Name | Click here to edit...",
|
||||
class:attr,
|
||||
dueDate:"Click here to edit...",
|
||||
description:"Click here to edit...",
|
||||
type:"Click here to edit..."
|
||||
});
|
||||
Session.set("currentWork",{class:attr});
|
||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||
}*/
|
||||
};
|
||||
},
|
||||
calCenter() {
|
||||
@ -472,7 +498,6 @@ Template.main.events({
|
||||
startDate: (new Date(Date.now())).toISOString().slice(0,10),
|
||||
todayHighlight: true,
|
||||
autoclose: true
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -494,6 +519,9 @@ function closeDivFade(div) {
|
||||
|
||||
function sendData(funcName) {
|
||||
Meteor.call(funcName, Session.get("serverData"));
|
||||
if(funcName.includes("Work") && Session.get("mode") === "calendar") {
|
||||
$("#fullcalendar").fullCalendar( 'refetchEvents' );
|
||||
}
|
||||
}
|
||||
|
||||
function closeInput(sessval) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user