Added adding work from calendar, fixed #38

This commit is contained in:
Kenneth Jao 2016-08-20 15:58:31 -04:00
parent 12e9017959
commit 1bdd65c4bf
3 changed files with 106 additions and 26 deletions

View File

@ -276,6 +276,8 @@ input, textarea {
#classListHolder h3 {
font-weight: 200;
margin: 5%;
margin-right: 4%;
display: inline-block;
}
.sideClass {
@ -668,3 +670,49 @@ input, textarea {
padding: 2%;
display: inline-block;
}
#calCreWork {
margin-left: 0 !important;
color: #fff;
display: inline-block;
-webkit-animation: neonglow 1.5s ease-in-out infinite alternate;
-moz-animation: neonglow 1.5s ease-in-out infinite alternate;
animation: neonglow 1.5s ease-in-out infinite alternate;
}
@-webkit-keyframes neonglow {
from {
text-shadow:
0 0 10px #fff,
0 0 20px #fff,
0 0 30px #fff,
0 0 40px #228DFF,
0 0 70px #228DFF,
0 0 80px #228DFF,
0 0 100px #228DFF,
0 0 150px #228DFF;
}
to {
text-shadow:
0 0 5px #fff,
0 0 10px #fff,
0 0 15px #fff,
0 0 20px #228DFF,
0 0 35px #228DFF,
0 0 40px #228DFF,
0 0 50px #228DFF,
0 0 75px #228DFF;
}
}
.fc-day:not(.fc-past):not(.fc-other-month) {
-webkit-transition: background-color 0.4s ease;
-moz-transition: background-color 0.4s ease;
-ms-transition: background-color 0.4s ease;
transition: background-color 0.4s ease;
}
.fc-day:not(.fc-past):not(.fc-other-month):hover {
background-color: rgba(0,0,0,0.1);
}

View File

@ -32,7 +32,7 @@
</div>
</div>
<div id="classListHolder">
<h3>Enrolled</h3>
<h3>Enrolled</h3><h3 id="calCreWork">{{calCreWork}}</h3>
{{#each myClasses}}
{{> sidebarClasses}}
{{/each}}
@ -119,7 +119,7 @@
</template>
<template name="sidebarClasses">
<div class="sideClass">
<div class="sideClass" classid="{{_id}}">
<p class="sideClassName">{{name}}</p>
<p class="sideClassHour">{{hour}}</p>
</div>

View File

@ -42,7 +42,8 @@ Session.set("radioDiv",null);
Session.set("radioOffset",null);
Session.set("serverData",null);
Session.set("noclass",null);
Session.set("updateCalWork",true);
Session.set("creCalWork",null);
Session.set("calWorkDate",null);
Template.registerHelper('divColor', (div) => {
return themeColors[Cookie.get("theme")][div];
@ -191,21 +192,14 @@ Template.main.helpers({
var thisReadWork = formReadable(thisWork);
Session.set("currentReadableWork",thisReadWork);
openDivFade(document.getElementsByClassName("overlay")[0]);
},
dayClick: function(date, jsEvent, view) {
if(Session.get("sidebar") !== null) return;
if(jsEvent.target.className.includes("fc-other-month") || jsEvent.target.className.includes("fc-past")) return;
Session.set("calCreWork",true);
Session.set("calWorkDate",date.format());
Session.set("sidebar","menuContainer");
}
/*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() {
@ -217,6 +211,13 @@ Template.main.helpers({
var height = window.innerHeight * 0.76;
return "width:" + width.toString() + "px;height:" + height.toString() + "px;margin-left:" + (0.5 * window.innerWidth - 0.5 * width).toString() + "px;margin-top:" + (0.47 * window.innerHeight - 0.5 * height).toString() + "px";
},
calCreWork() {
if(Session.get("calCreWork")) {
return " -- Pick a Class";
} else {
return "";
}
},
workCenter() {
var w = window.innerWidth * 0.3;
var h = window.innerHeight * 0.7;
@ -228,6 +229,7 @@ Template.main.helpers({
},
workType() {
if(Session.get("currentWork") === null) return;
if(Session.get("currentWork").type === undefined) return;
type = Session.get("currentWork").type;
if(type.includes("edit")) {
return;
@ -299,11 +301,15 @@ Template.main.events({
var e = event.target.className;
var sessval = Session.get("modifying");
if (e !== Session.get("sidebar") &&
!e.includes("fa-cog") &&
!e.includes("fa-bars") &&
!document.getElementById("menuContainer").contains(event.target) &&
!document.getElementById("optionsContainer").contains(event.target)) {
Session.set("sidebar", null);
!e.includes("fa-cog") &&
!e.includes("fa-bars") &&
!document.getElementById("menuContainer").contains(event.target) &&
!document.getElementById("optionsContainer").contains(event.target) &&
!event.target.className.includes("fc-day")) {
if(Session.get("calCreWork")) {
Session.set("calCreWork",false);
}
Session.set("sidebar",null);
}
if(e === "overlay") {
@ -506,6 +512,31 @@ Template.main.events({
todayHighlight: true,
autoclose: true
});
},
'click .sideClass' (event) {
if(!Session.equals("mode","calendar")) return;
var div = event.target
while(div.getAttribute("classid") === null) div = div.parentNode;
var classid = div.getAttribute("classid");
if(Session.get("calCreWork")) {
Session.set("calCreWork",null);
Session.set("sidebar",null);
var date = Session.get("calWorkDate").split("-");
var date = new Date(date[0],parseInt(date[1])-1,date[2],11,59,59);
Session.set("newWork", true);
Session.set("currentReadableWork",
{
name:"Name | Click here to edit...",
class:classid,
dueDate:getReadableDate(date),
description:"Click here to edit...",
type:"Click here to edit..."
});
Session.set("currentWork",{class:classid,dueDate:date});
openDivFade(document.getElementsByClassName("overlay")[0]);
}
}
});
@ -525,10 +556,11 @@ function closeDivFade(div) {
}
function sendData(funcName) {
Meteor.call(funcName, Session.get("serverData"));
if(funcName.includes("Work") && Session.get("mode") === "calendar") {
$("#fullcalendar").fullCalendar( 'refetchEvents' );
}
Meteor.call(funcName, Session.get("serverData") , function(err,result) {
if((funcName === "editWork" || funcName === "createWork") && Session.get("mode") === "calendar") {
$("#fullcalendar").fullCalendar( 'refetchEvents' );
}
});
}
function closeInput(sessval) {