Added click to display classes from sidebar, fixed #53
This commit is contained in:
parent
0f7017ce5b
commit
043d9b93a1
@ -320,12 +320,26 @@ input, textarea {
|
||||
.sideClassName {
|
||||
font-weight: 600;
|
||||
margin: 0;
|
||||
display: table-row;
|
||||
}
|
||||
|
||||
.sideClassHour {
|
||||
font-weight: 400;
|
||||
color: #444;
|
||||
margin: 0;
|
||||
display: table-row;
|
||||
}
|
||||
|
||||
.fa-dot-circle-o {
|
||||
font-size: 150%;
|
||||
color: #53BD42;
|
||||
margin-top: -10%;
|
||||
margin-right: 10%;
|
||||
|
||||
float: right;
|
||||
|
||||
-webkit-filter: drop-shadow(2px 2px 5px #666);
|
||||
filter: drop-shadow(2px 2px 5px #666);
|
||||
}
|
||||
|
||||
#classesMode {
|
||||
@ -401,7 +415,7 @@ input, textarea {
|
||||
}
|
||||
|
||||
.workCard:hover {
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
background-color: rgba(0,0,0,0.05);
|
||||
}
|
||||
|
||||
.cWorkCont {
|
||||
|
||||
@ -158,9 +158,15 @@
|
||||
|
||||
<template name="sidebarClasses">
|
||||
<div class="sideClass" classid="{{_id}}">
|
||||
<div>
|
||||
<p class="sideClassName">{{name}}</p>
|
||||
<p class="sideClassHour">{{hour}}</p>
|
||||
</div>
|
||||
{{#if selected}}
|
||||
<i class="fa fa-dot-circle-o" aria-hidden="true"></i>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<template name="classesMode">
|
||||
|
||||
@ -62,7 +62,7 @@ Session.set("radioDiv",null);
|
||||
Session.set("radioOffset",null);
|
||||
Session.set("serverData",null);
|
||||
Session.set("noclass",null);
|
||||
Session.set("creCalWork",null);
|
||||
Session.set("calCreWork",null);
|
||||
Session.set("calWorkDate",null);
|
||||
Session.set("classDisp",[]);
|
||||
Session.set("classDispHover",null);
|
||||
@ -92,6 +92,7 @@ Template.registerHelper('myClasses', () => {
|
||||
} else {
|
||||
var array = [];
|
||||
var courses = Meteor.user().profile.classes;
|
||||
var classDisp = Session.get("classDisp");
|
||||
for(var i = 0; i < courses.length; i++) {
|
||||
found = classes.findOne({_id:courses[i]});
|
||||
found.subscribers = found.subscribers.length/17;
|
||||
@ -100,10 +101,16 @@ Template.registerHelper('myClasses', () => {
|
||||
found.box = " owned";
|
||||
found.mine = false;
|
||||
}
|
||||
if(classDisp.indexOf(courses[i]) !== -1) found.selected = true;
|
||||
array.push(found);
|
||||
|
||||
var thisWork = work.find({class: courses[i]}).fetch();
|
||||
|
||||
if(classDisp.length !== 0 && classDisp.indexOf(found._id) === -1) {
|
||||
array[i].thisClassWork = [];
|
||||
continue;
|
||||
}
|
||||
|
||||
for(var j = 0; j < thisWork.length; j++) {
|
||||
thisWork[j].dueDate = moment(thisWork[j].dueDate).calendar(null, {
|
||||
sameDay: '[Today]',
|
||||
@ -198,8 +205,11 @@ Template.main.helpers({
|
||||
events: function(start, end, timezone, callback) {
|
||||
var events = [];
|
||||
var cursor = work.find({class: {$in: Session.get("calendarclasses")}});
|
||||
var hoverHighlight = Session.get("classDispHover");
|
||||
var classDisp = Session.get("classDisp");
|
||||
cursor.forEach(function(current) {
|
||||
var disp = true;
|
||||
if(classDisp.length !== 0 && classDisp.indexOf(current.class) === -1) disp = false;
|
||||
|
||||
var inRole = false;
|
||||
if(Meteor.userId() === current.creator ||
|
||||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
|
||||
@ -210,6 +220,7 @@ Template.main.helpers({
|
||||
backgroundColor = workColors[current.type];
|
||||
title = current.name;
|
||||
duedate = current.dueDate.toISOString().slice(0, 10);
|
||||
if(disp) {
|
||||
events.push({
|
||||
id: current._id,
|
||||
start: duedate,
|
||||
@ -219,6 +230,7 @@ Template.main.helpers({
|
||||
startEditable: inRole,
|
||||
className: "workevent "+current.class,
|
||||
});
|
||||
}
|
||||
});
|
||||
callback(events);
|
||||
},
|
||||
@ -287,7 +299,6 @@ Template.main.helpers({
|
||||
var id = works[i].className;
|
||||
var index = id.indexOf("workevent");
|
||||
id = id.substring(index+10,index+27);
|
||||
console.log(id);console.log(hoverHighlight);
|
||||
if(id === hoverHighlight) {
|
||||
works[i].style.webkitTransform = 'scale(1.12)';
|
||||
works[i].style.msTransform = 'scale(1.12)';
|
||||
@ -650,7 +661,6 @@ Template.main.events({
|
||||
while(div.getAttribute("classid") === null) div = div.parentNode;
|
||||
var classid = div.getAttribute("classid");
|
||||
|
||||
if(!Session.equals("mode","calendar")) {
|
||||
if(Session.get("calCreWork")) {
|
||||
Session.set("calCreWork",null);
|
||||
Session.set("sidebar",null);
|
||||
@ -668,11 +678,15 @@ Template.main.events({
|
||||
});
|
||||
Session.set("currentWork",{class:classid,dueDate:date});
|
||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||
}
|
||||
} else if(!Session.get("calCreWork")) {
|
||||
} else {
|
||||
var array = Session.get("classDisp");
|
||||
if(array.indexOf(classid) !== -1) {
|
||||
array.splice(array.indexOf(classid),1);
|
||||
} else {
|
||||
array.push(classid);
|
||||
}
|
||||
Session.set("classDisp",array);
|
||||
$("#fullcalendar").fullCalendar( 'refetchEvents' );
|
||||
}
|
||||
},
|
||||
'mouseover .sideClass' (event) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user