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 {
|
.sideClassName {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
display: table-row;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sideClassHour {
|
.sideClassHour {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #444;
|
color: #444;
|
||||||
margin: 0;
|
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 {
|
#classesMode {
|
||||||
@ -401,7 +415,7 @@ input, textarea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.workCard:hover {
|
.workCard:hover {
|
||||||
background-color: rgba(0,0,0,0.5);
|
background-color: rgba(0,0,0,0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cWorkCont {
|
.cWorkCont {
|
||||||
|
|||||||
@ -158,9 +158,15 @@
|
|||||||
|
|
||||||
<template name="sidebarClasses">
|
<template name="sidebarClasses">
|
||||||
<div class="sideClass" classid="{{_id}}">
|
<div class="sideClass" classid="{{_id}}">
|
||||||
<p class="sideClassName">{{name}}</p>
|
<div>
|
||||||
<p class="sideClassHour">{{hour}}</p>
|
<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>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template name="classesMode">
|
<template name="classesMode">
|
||||||
|
|||||||
@ -62,7 +62,7 @@ Session.set("radioDiv",null);
|
|||||||
Session.set("radioOffset",null);
|
Session.set("radioOffset",null);
|
||||||
Session.set("serverData",null);
|
Session.set("serverData",null);
|
||||||
Session.set("noclass",null);
|
Session.set("noclass",null);
|
||||||
Session.set("creCalWork",null);
|
Session.set("calCreWork",null);
|
||||||
Session.set("calWorkDate",null);
|
Session.set("calWorkDate",null);
|
||||||
Session.set("classDisp",[]);
|
Session.set("classDisp",[]);
|
||||||
Session.set("classDispHover",null);
|
Session.set("classDispHover",null);
|
||||||
@ -92,6 +92,7 @@ Template.registerHelper('myClasses', () => {
|
|||||||
} else {
|
} else {
|
||||||
var array = [];
|
var array = [];
|
||||||
var courses = Meteor.user().profile.classes;
|
var courses = Meteor.user().profile.classes;
|
||||||
|
var classDisp = Session.get("classDisp");
|
||||||
for(var i = 0; i < courses.length; i++) {
|
for(var i = 0; i < courses.length; i++) {
|
||||||
found = classes.findOne({_id:courses[i]});
|
found = classes.findOne({_id:courses[i]});
|
||||||
found.subscribers = found.subscribers.length/17;
|
found.subscribers = found.subscribers.length/17;
|
||||||
@ -100,11 +101,17 @@ Template.registerHelper('myClasses', () => {
|
|||||||
found.box = " owned";
|
found.box = " owned";
|
||||||
found.mine = false;
|
found.mine = false;
|
||||||
}
|
}
|
||||||
|
if(classDisp.indexOf(courses[i]) !== -1) found.selected = true;
|
||||||
array.push(found);
|
array.push(found);
|
||||||
|
|
||||||
var thisWork = work.find({class: courses[i]}).fetch();
|
var thisWork = work.find({class: courses[i]}).fetch();
|
||||||
|
|
||||||
for(var j = 0; j < thisWork.length; j++) {
|
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, {
|
thisWork[j].dueDate = moment(thisWork[j].dueDate).calendar(null, {
|
||||||
sameDay: '[Today]',
|
sameDay: '[Today]',
|
||||||
nextDay: '[Tomorrow]',
|
nextDay: '[Tomorrow]',
|
||||||
@ -198,8 +205,11 @@ Template.main.helpers({
|
|||||||
events: function(start, end, timezone, callback) {
|
events: function(start, end, timezone, callback) {
|
||||||
var events = [];
|
var events = [];
|
||||||
var cursor = work.find({class: {$in: Session.get("calendarclasses")}});
|
var cursor = work.find({class: {$in: Session.get("calendarclasses")}});
|
||||||
var hoverHighlight = Session.get("classDispHover");
|
var classDisp = Session.get("classDisp");
|
||||||
cursor.forEach(function(current) {
|
cursor.forEach(function(current) {
|
||||||
|
var disp = true;
|
||||||
|
if(classDisp.length !== 0 && classDisp.indexOf(current.class) === -1) disp = false;
|
||||||
|
|
||||||
var inRole = false;
|
var inRole = false;
|
||||||
if(Meteor.userId() === current.creator ||
|
if(Meteor.userId() === current.creator ||
|
||||||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
|
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
|
||||||
@ -210,15 +220,17 @@ Template.main.helpers({
|
|||||||
backgroundColor = workColors[current.type];
|
backgroundColor = workColors[current.type];
|
||||||
title = current.name;
|
title = current.name;
|
||||||
duedate = current.dueDate.toISOString().slice(0, 10);
|
duedate = current.dueDate.toISOString().slice(0, 10);
|
||||||
events.push({
|
if(disp) {
|
||||||
id: current._id,
|
events.push({
|
||||||
start: duedate,
|
id: current._id,
|
||||||
title: title,
|
start: duedate,
|
||||||
backgroundColor: backgroundColor,
|
title: title,
|
||||||
borderColor: "#444",
|
backgroundColor: backgroundColor,
|
||||||
startEditable: inRole,
|
borderColor: "#444",
|
||||||
className: "workevent "+current.class,
|
startEditable: inRole,
|
||||||
});
|
className: "workevent "+current.class,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
callback(events);
|
callback(events);
|
||||||
},
|
},
|
||||||
@ -287,7 +299,6 @@ Template.main.helpers({
|
|||||||
var id = works[i].className;
|
var id = works[i].className;
|
||||||
var index = id.indexOf("workevent");
|
var index = id.indexOf("workevent");
|
||||||
id = id.substring(index+10,index+27);
|
id = id.substring(index+10,index+27);
|
||||||
console.log(id);console.log(hoverHighlight);
|
|
||||||
if(id === hoverHighlight) {
|
if(id === hoverHighlight) {
|
||||||
works[i].style.webkitTransform = 'scale(1.12)';
|
works[i].style.webkitTransform = 'scale(1.12)';
|
||||||
works[i].style.msTransform = 'scale(1.12)';
|
works[i].style.msTransform = 'scale(1.12)';
|
||||||
@ -650,29 +661,32 @@ Template.main.events({
|
|||||||
while(div.getAttribute("classid") === null) div = div.parentNode;
|
while(div.getAttribute("classid") === null) div = div.parentNode;
|
||||||
var classid = div.getAttribute("classid");
|
var classid = div.getAttribute("classid");
|
||||||
|
|
||||||
if(!Session.equals("mode","calendar")) {
|
if(Session.get("calCreWork")) {
|
||||||
if(Session.get("calCreWork")) {
|
Session.set("calCreWork",null);
|
||||||
Session.set("calCreWork",null);
|
Session.set("sidebar",null);
|
||||||
Session.set("sidebar",null);
|
|
||||||
|
|
||||||
var date = Session.get("calWorkDate").split("-");
|
var date = Session.get("calWorkDate").split("-");
|
||||||
var date = new Date(date[0],parseInt(date[1])-1,date[2],11,59,59);
|
var date = new Date(date[0],parseInt(date[1])-1,date[2],11,59,59);
|
||||||
Session.set("newWork", true);
|
Session.set("newWork", true);
|
||||||
Session.set("currentReadableWork",
|
Session.set("currentReadableWork",
|
||||||
{
|
{
|
||||||
name:"Name | Click here to edit...",
|
name:"Name | Click here to edit...",
|
||||||
class:classid,
|
class:classid,
|
||||||
dueDate:getReadableDate(date),
|
dueDate:getReadableDate(date),
|
||||||
description:"Click here to edit...",
|
description:"Click here to edit...",
|
||||||
type:"Click here to edit..."
|
type:"Click here to edit..."
|
||||||
});
|
});
|
||||||
Session.set("currentWork",{class:classid,dueDate:date});
|
Session.set("currentWork",{class:classid,dueDate:date});
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||||
}
|
} else {
|
||||||
} else if(!Session.get("calCreWork")) {
|
|
||||||
var array = Session.get("classDisp");
|
var array = Session.get("classDisp");
|
||||||
array.push(classid);
|
if(array.indexOf(classid) !== -1) {
|
||||||
|
array.splice(array.indexOf(classid),1);
|
||||||
|
} else {
|
||||||
|
array.push(classid);
|
||||||
|
}
|
||||||
Session.set("classDisp",array);
|
Session.set("classDisp",array);
|
||||||
|
$("#fullcalendar").fullCalendar( 'refetchEvents' );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'mouseover .sideClass' (event) {
|
'mouseover .sideClass' (event) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user