Added toggling work
This commit is contained in:
parent
f6449ffe0c
commit
5f186e55fc
@ -808,7 +808,7 @@ input, textarea {
|
|||||||
#commentSubmit {
|
#commentSubmit {
|
||||||
padding: 2%;
|
padding: 2%;
|
||||||
background-color: rgba(255,255,255,0.1);
|
background-color: rgba(255,255,255,0.1);
|
||||||
|
|
||||||
display: inline;
|
display: inline;
|
||||||
float: right;
|
float: right;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -821,4 +821,50 @@ input, textarea {
|
|||||||
|
|
||||||
#commentSubmit:hover {
|
#commentSubmit:hover {
|
||||||
background-color: rgba(255,255,255,0.05);
|
background-color: rgba(255,255,255,0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
#done {
|
||||||
|
height: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#toggleButtons {
|
||||||
|
font-size: 150%;
|
||||||
|
height: 40%;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#toggleButtons i {
|
||||||
|
margin-right: 12%;
|
||||||
|
|
||||||
|
-webkit-transition: color 0.4s ease;
|
||||||
|
-moz-transition: color 0.4s ease;
|
||||||
|
-ms-transition: color 0.4s ease;
|
||||||
|
transition: color 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
#markDone p {
|
||||||
|
font-size: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#markDone i {
|
||||||
|
margin-right: 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#markDone p, #markConfirm p, #markReport p {
|
||||||
|
margin: 0;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#markDone, #markConfirm, #markReport {
|
||||||
|
padding: 5%;
|
||||||
|
background-color: rgba(0,0,0,0.1);
|
||||||
|
|
||||||
|
-webkit-transition: box-shadow 0.4s ease, background-color 0.4s ease;
|
||||||
|
-moz-transition: box-shadow 0.4s ease, background-color 0.4s ease;
|
||||||
|
-ms-transition: box-shadow 0.4s ease, background-color 0.4s ease;
|
||||||
|
transition: box-shadow 0.4s ease, background-color 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
#markDone:hover, #markConfirm:hover, #markReport:hover {
|
||||||
|
box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.15);
|
||||||
}
|
}
|
||||||
@ -78,6 +78,16 @@
|
|||||||
<p class="prefOptionText">Never</p>
|
<p class="prefOptionText">Never</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="inputRadioPref">
|
||||||
|
<p class="prefTitle">Hide Done:</p>
|
||||||
|
<span class="change radio" re="readonly" id="prefDone">{{pref 'done'}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="prefOptions" style="background-color:{{divColor 'header'}}">
|
||||||
|
<p class="prefOptionText">Yes</p>
|
||||||
|
<p class="prefOptionText">No</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<img id="bg" src={{bgSrc}}>
|
<img id="bg" src={{bgSrc}}>
|
||||||
@ -137,7 +147,7 @@
|
|||||||
{{#unless newWork}}
|
{{#unless newWork}}
|
||||||
<div id="workComments">
|
<div id="workComments">
|
||||||
<h3>Comments</h3>
|
<h3>Comments</h3>
|
||||||
<div id="comment" style="height:{{commentDim}}">
|
<div id="comment" style="max-height:{{commentDim}}">
|
||||||
{{#each work 'comments'}}
|
{{#each work 'comments'}}
|
||||||
{{> comment}}
|
{{> comment}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@ -154,7 +164,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="workToggle">
|
<div id="workToggle">
|
||||||
|
<div id="done">
|
||||||
|
</div>
|
||||||
|
<div id="toggleButtons">
|
||||||
|
<div id="markDone" style="background-color:{{work 'done'}}">
|
||||||
|
<i class="fa fa-check-square-o" aria-hidden="true"></i>
|
||||||
|
<p>{{work 'doneText'}}</p>
|
||||||
|
</div>
|
||||||
|
<div id="markConfirm" style="color:{{work 'userConfirm'}}">
|
||||||
|
<i class="fa fa-thumbs-up" aria-hidden="true"></i>
|
||||||
|
<p>{{work 'confirmations'}}</p>
|
||||||
|
</div>
|
||||||
|
<div id="markReport" style="color:{{work 'userReport'}}">
|
||||||
|
<i class="fa fa-thumbs-down" aria-hidden="true"></i>
|
||||||
|
<p>{{work 'reports'}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if newWork}}
|
{{#if newWork}}
|
||||||
{{#if inRole}}
|
{{#if inRole}}
|
||||||
|
|||||||
@ -50,7 +50,8 @@ var workColors = {
|
|||||||
var defaults = {
|
var defaults = {
|
||||||
"theme":"light",
|
"theme":"light",
|
||||||
"mode":"classes",
|
"mode":"classes",
|
||||||
"timeHide":"1 Day"
|
"timeHide":"1 Day",
|
||||||
|
"done":true
|
||||||
};
|
};
|
||||||
|
|
||||||
var ref = {
|
var ref = {
|
||||||
@ -61,6 +62,11 @@ var ref = {
|
|||||||
"Never":0
|
"Never":0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var dref = {
|
||||||
|
"Yes":true,
|
||||||
|
"No":false
|
||||||
|
}
|
||||||
|
|
||||||
// Reactive variables.
|
// Reactive variables.
|
||||||
Session.set("calendarclasses", null);
|
Session.set("calendarclasses", null);
|
||||||
Session.set("sidebar", null);
|
Session.set("sidebar", null);
|
||||||
@ -80,7 +86,7 @@ Template.registerHelper('divColor', (div) => {
|
|||||||
return Session.get("themeColors")[Meteor.user().profile.preferences.theme][div];
|
return Session.get("themeColors")[Meteor.user().profile.preferences.theme][div];
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.registerHelper("textColor", () => {
|
Template.registerHelper('textColor', () => {
|
||||||
document.getElementsByTagName("body")[0].style.color = Session.get("themeColors")[Meteor.user().profile.preferences.theme].text;
|
document.getElementsByTagName("body")[0].style.color = Session.get("themeColors")[Meteor.user().profile.preferences.theme].text;
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
@ -130,9 +136,11 @@ Template.registerHelper('myClasses', () => {
|
|||||||
j = 0;
|
j = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(thisWork[j] !== "no" && thisWork[j].done.indexOf(Meteor.userId()) !== -1) {
|
if(thisWork[j] !== "no" && dref[Meteor.user().profile.preferences.done]) {
|
||||||
thisWork[j] = "no";
|
if(thisWork[j].done.indexOf(Meteor.userId()) !== -1) {
|
||||||
j = 0;
|
thisWork[j] = "no";
|
||||||
|
j = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while(thisWork.indexOf("no") !== -1) thisWork.splice(thisWork.indexOf("no"),1);
|
while(thisWork.indexOf("no") !== -1) thisWork.splice(thisWork.indexOf("no"),1);
|
||||||
@ -146,12 +154,14 @@ Template.registerHelper('myClasses', () => {
|
|||||||
lastWeek: '[Last] dddd',
|
lastWeek: '[Last] dddd',
|
||||||
sameElse: 'MMMM Do'
|
sameElse: 'MMMM Do'
|
||||||
});
|
});
|
||||||
|
|
||||||
if(thisWork[j].dueDate === "Today") {
|
if(thisWork[j].dueDate === "Today") {
|
||||||
thisWork[j].cardDate = "600";
|
thisWork[j].cardDate = "600";
|
||||||
} else if(thisWork[j].dueDate === "Tomorrow") {
|
} else if(thisWork[j].dueDate === "Tomorrow") {
|
||||||
thisWork[j].cardDate = "400";
|
thisWork[j].cardDate = "400";
|
||||||
}
|
}
|
||||||
thisWork[j].typeColor = workColors[thisWork[j].type];
|
thisWork[j].typeColor = workColors[thisWork[j].type];
|
||||||
|
|
||||||
var hoverHighlight = Session.get("classDispHover");
|
var hoverHighlight = Session.get("classDispHover");
|
||||||
if(hoverHighlight !== null && hoverHighlight === found._id) {
|
if(hoverHighlight !== null && hoverHighlight === found._id) {
|
||||||
thisWork[j].scale = "-ms-transform: scale(1.12)-webkit-transform: scale(1.12);transform: scale(1.12)";
|
thisWork[j].scale = "-ms-transform: scale(1.12)-webkit-transform: scale(1.12);transform: scale(1.12)";
|
||||||
@ -173,11 +183,11 @@ Template.registerHelper('pref', (val) => {
|
|||||||
array.preferences = defaults;
|
array.preferences = defaults;
|
||||||
Session.set("serverData",array);
|
Session.set("serverData",array);
|
||||||
sendData("editProfile");
|
sendData("editProfile");
|
||||||
if(val === 'timeHide') return defaults[val];
|
if(val === 'timeHide' || val === 'done') return defaults[val];
|
||||||
return defaults[val].charAt(0).toUpperCase() + defaults[val].slice(1);
|
return defaults[val].charAt(0).toUpperCase() + defaults[val].slice(1);
|
||||||
} else {
|
} else {
|
||||||
var preferences = Meteor.user().profile.preferences;
|
var preferences = Meteor.user().profile.preferences;
|
||||||
if(val === 'timeHide') return preferences[val];
|
if(val === 'timeHide' || val === 'done') return preferences[val];
|
||||||
return preferences[val].charAt(0).toUpperCase() + preferences[val].slice(1);
|
return preferences[val].charAt(0).toUpperCase() + preferences[val].slice(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -377,10 +387,9 @@ Template.main.helpers({
|
|||||||
return "width:"+w.toString()+"px;height:"+h.toString()+"px;margin-left:"+-0.5*w.toString()+"px;margin-top:"+-0.5*h.toString()+"px";
|
return "width:"+w.toString()+"px;height:"+h.toString()+"px;margin-left:"+-0.5*w.toString()+"px;margin-top:"+-0.5*h.toString()+"px";
|
||||||
},
|
},
|
||||||
commentDim() {
|
commentDim() {
|
||||||
if(Session.get("newWork") || Session.get("newWork") === null) return;
|
|
||||||
var work = Session.get("currentWork");
|
var work = Session.get("currentWork");
|
||||||
if(work === null) return;
|
if(Session.get("newWork") === null || work === null) return;
|
||||||
if(work.comments.length <= 3) return;
|
if(Session.get("newWork") || work.comments.length <= 3) return;
|
||||||
return 0.23*window.innerHeight.toString() + "px";
|
return 0.23*window.innerHeight.toString() + "px";
|
||||||
},
|
},
|
||||||
work(value) {
|
work(value) {
|
||||||
@ -471,7 +480,7 @@ Template.main.events({
|
|||||||
!event.target.parentNode.className.includes("prefOptions")) {
|
!event.target.parentNode.className.includes("prefOptions")) {
|
||||||
closeInput(sessval);
|
closeInput(sessval);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e !== Session.get("sidebar") &&
|
if (e !== Session.get("sidebar") &&
|
||||||
!e.includes("fa-cog") &&
|
!e.includes("fa-cog") &&
|
||||||
!e.includes("fa-bars") &&
|
!e.includes("fa-bars") &&
|
||||||
@ -789,8 +798,19 @@ Template.main.events({
|
|||||||
if(chars === 200) {
|
if(chars === 200) {
|
||||||
document.getElementById("commentRestrict").style.color = "#FF1A1A";
|
document.getElementById("commentRestrict").style.color = "#FF1A1A";
|
||||||
}
|
}
|
||||||
Session.set("commentRestrict", "Characters left: " + (200-chars).toString());
|
Session.set("commentRestrict", "Characters left: " + (200-chars).toString());
|
||||||
|
},
|
||||||
|
'click #markDone' () {
|
||||||
|
Session.set("serverData", [Session.get("currentWork")._id, "done"])
|
||||||
|
sendData("toggleWork");
|
||||||
|
},
|
||||||
|
'click #markConfirm' () {
|
||||||
|
Session.set("serverData", [Session.get("currentWork")._id, "confirmations"])
|
||||||
|
sendData("toggleWork");
|
||||||
|
},
|
||||||
|
'click #markReport' () {
|
||||||
|
Session.set("serverData", [Session.get("currentWork")._id, "reports"])
|
||||||
|
sendData("toggleWork");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -813,7 +833,15 @@ function sendData(funcName) {
|
|||||||
Meteor.call(funcName, Session.get("serverData") , function(err,result) {
|
Meteor.call(funcName, Session.get("serverData") , function(err,result) {
|
||||||
if((funcName === "editWork" || funcName === "createWork") && Session.get("mode") === "calendar") {
|
if((funcName === "editWork" || funcName === "createWork") && Session.get("mode") === "calendar") {
|
||||||
$("#fullcalendar").fullCalendar( 'refetchEvents' );
|
$("#fullcalendar").fullCalendar( 'refetchEvents' );
|
||||||
}
|
} else if(funcName === "toggleWork") {
|
||||||
|
var workId = Session.get("currentWork")._id;
|
||||||
|
var thisWork = work.findOne({_id:workId});
|
||||||
|
Session.set("currentWork",thisWork);
|
||||||
|
var thisReadWork = formReadable(thisWork);
|
||||||
|
Session.set("currentReadableWork",thisReadWork);
|
||||||
|
} else if(funcName === "editProfile") {
|
||||||
|
$("#fullcalendar").fullCalendar( 'refetchEvents' );
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -884,7 +912,8 @@ function getPreferencesData() {
|
|||||||
var options = {
|
var options = {
|
||||||
"theme":document.getElementById("prefTheme").childNodes[0].nodeValue.toLowerCase(),
|
"theme":document.getElementById("prefTheme").childNodes[0].nodeValue.toLowerCase(),
|
||||||
"mode":document.getElementById("prefMode").childNodes[0].nodeValue.toLowerCase(),
|
"mode":document.getElementById("prefMode").childNodes[0].nodeValue.toLowerCase(),
|
||||||
"timeHide":document.getElementById("prefHide").childNodes[0].nodeValue
|
"timeHide":document.getElementById("prefHide").childNodes[0].nodeValue,
|
||||||
|
"done":document.getElementById("prefDone").childNodes[0].nodeValue
|
||||||
};
|
};
|
||||||
profile.preferences = options;
|
profile.preferences = options;
|
||||||
return profile;
|
return profile;
|
||||||
@ -908,6 +937,30 @@ function toDate(date) {
|
|||||||
function formReadable(input) {
|
function formReadable(input) {
|
||||||
input.dueDate = getReadableDate(input.dueDate);
|
input.dueDate = getReadableDate(input.dueDate);
|
||||||
input.type = input.type[0].toUpperCase() + input.type.slice(1);
|
input.type = input.type[0].toUpperCase() + input.type.slice(1);
|
||||||
|
|
||||||
|
if(input.done.indexOf(Meteor.userId()) !== -1) {
|
||||||
|
input.done = "#27A127";
|
||||||
|
input.doneText = "Done!";
|
||||||
|
} else {
|
||||||
|
input.done = "";
|
||||||
|
input.doneText = "Mark done";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(input.confirmations.indexOf(Meteor.userId()) !== -1) {
|
||||||
|
input.userConfirm = "#27A127";
|
||||||
|
} else {
|
||||||
|
input.userConfirm = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(input.reports.indexOf(Meteor.userId()) !== -1) {
|
||||||
|
input.userReport = "#FF1A1A";
|
||||||
|
} else {
|
||||||
|
input.userReport = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
input.confirmations = input.confirmations.length;
|
||||||
|
input.reports = input.reports.length;
|
||||||
|
|
||||||
var comments = input.comments;
|
var comments = input.comments;
|
||||||
var resort = [];
|
var resort = [];
|
||||||
if(!Session.get("newWork")) {
|
if(!Session.get("newWork")) {
|
||||||
|
|||||||
@ -177,6 +177,17 @@
|
|||||||
<p class="profOptionText">Never</p>
|
<p class="profOptionText">Never</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<br>
|
||||||
|
<div>
|
||||||
|
<div class="inputRadio">
|
||||||
|
<p class="profTitle">Hide Done:</p>
|
||||||
|
<span class="change radio" re="readonly" id="prefDone">{{pref 'done'}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="profOptions" style="background-color:{{divColor 'header'}}">
|
||||||
|
<p class="profOptionText">Yes</p>
|
||||||
|
<p class="profOptionText">No</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -464,10 +464,10 @@ Meteor.methods({
|
|||||||
if (userindex === -1) {
|
if (userindex === -1) {
|
||||||
workobject[input[1]] = workobject[input[1]].concat(Meteor.userId());
|
workobject[input[1]] = workobject[input[1]].concat(Meteor.userId());
|
||||||
} else {
|
} else {
|
||||||
workobject[input[1]] = workobject[input[1]].splice(userindex, 1);
|
workobject[input[1]].splice(userindex, 1);
|
||||||
}
|
}
|
||||||
work.update({
|
work.update({
|
||||||
_id: input[1]
|
_id: input[0]
|
||||||
}, {
|
}, {
|
||||||
$set: workobject
|
$set: workobject
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user