Added deleting work for admins/moderators, fixed #74

This commit is contained in:
Kenneth Jao 2016-08-31 22:54:44 -04:00
parent 5f23c44857
commit c08ddac128
3 changed files with 35 additions and 9 deletions

View File

@ -812,7 +812,7 @@ input, textarea {
#commentSubmit { #commentSubmit {
margin-bottom: 0; margin-bottom: 0;
padding: 2%; padding: 2%;
background-color: rgba(255,255,255,0.1); background-color: rgba(0,0,0,0.1);
display: inline; display: inline;
float: right; float: right;
@ -825,7 +825,7 @@ input, textarea {
} }
#commentSubmit:hover { #commentSubmit:hover {
background-color: rgba(255,255,255,0.05); background-color: rgba(0,0,0,0.2);
} }
#done { #done {
@ -894,3 +894,23 @@ input, textarea {
box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.15); box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.15);
} }
#workDelete {
margin-bottom: 0;
padding: 4%;
background-color: rgba(0,0,0,0.1);
position: absolute;
bottom: 8%;
right: 5%;
cursor: pointer;
-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;
}
#workDelete:hover {
background-color: rgba(0,0,0,0.15);
}

View File

@ -177,20 +177,20 @@
</div> </div>
<div id="markConfirm" style="color:{{work 'userConfirm'}}"> <div id="markConfirm" style="color:{{work 'userConfirm'}}">
<i class="fa fa-thumbs-up" aria-hidden="true"></i> <i class="fa fa-thumbs-up" aria-hidden="true"></i>
<p>{{work 'confirmationLength'}}</p> <p>{{work 'confirmations'}}</p>
</div> </div>
<div id="markReport" style="color:{{work 'userReport'}}"> <div id="markReport" style="color:{{work 'userReport'}}">
<i class="fa fa-thumbs-down" aria-hidden="true"></i> <i class="fa fa-thumbs-down" aria-hidden="true"></i>
<p>{{work 'reportLength'}}</p> <p>{{work 'reports'}}</p>
</div> </div>
</div> </div>
</div> </div>
{{/unless}} {{/unless}}
{{#if newWork}} {{#if inRole}}
{{#if inRole}} {{#if newWork}}
<div id="workSubmit">Save</div> <div id="workSubmit">Save</div>
{{/if}} {{/if}}
<div id="workDelete">Delete</div>
{{/if}} {{/if}}
</div> </div>
</div> </div>

View File

@ -131,7 +131,7 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective
} }
thisWork[j].typeColor = workColors[thisWork[j].type]; thisWork[j].typeColor = workColors[thisWork[j].type];
thisWork[j].confirmationLength = thisWork[j].confirmations.length // Counts the number of confiramtions and reportsfor a particular work thisWork[j].confirmationLength = thisWork[j].confirmations.length // Counts the number of confirmations and reports for a particular work.
thisWork[j].reportLength = thisWork[j].reports.length thisWork[j].reportLength = thisWork[j].reports.length
var hoverHighlight = Session.get("classDispHover"); // Highlight/scale related class works on hover. var hoverHighlight = Session.get("classDispHover"); // Highlight/scale related class works on hover.
@ -686,6 +686,11 @@ Template.main.events({
Session.set("newWork",null); Session.set("newWork",null);
closeDivFade(document.getElementsByClassName("overlay")[0]); closeDivFade(document.getElementsByClassName("overlay")[0]);
}, },
'click #workDelete' () {
serverData = Session.get("currentWork")._id;
sendData("deleteWork");
closeDivFade(document.getElementsByClassName("overlay")[0]);
},
'keydown #workComment' (event) { // Restrict length on comment. 'keydown #workComment' (event) { // Restrict length on comment.
var chars = event.target.value.length; var chars = event.target.value.length;
document.getElementById("commentRestrict").style.color = "#7E7E7E"; document.getElementById("commentRestrict").style.color = "#7E7E7E";
@ -793,7 +798,6 @@ function sendData(funcName) { // Call Meteor function, and do actions after func
} else if(funcName === "editProfile") { } else if(funcName === "editProfile") {
$("#fullcalendar").fullCalendar( 'refetchEvents' ); $("#fullcalendar").fullCalendar( 'refetchEvents' );
} }
console.log(err,result);
}); });
} }
@ -909,6 +913,8 @@ function formReadable(input) { // Makes work information readable by users.
input.userReport = ""; input.userReport = "";
} }
input.confirmations = input.confirmations.length;
input.reports = input.reports.length;
var comments = input.comments; var comments = input.comments;
var resort = []; var resort = [];