createcomments
This commit is contained in:
parent
e68ffb9dba
commit
db85d38145
@ -31,3 +31,4 @@ rzymek:fullcalendar
|
|||||||
momentjs:moment
|
momentjs:moment
|
||||||
eternicode:bootstrap-datepicker
|
eternicode:bootstrap-datepicker
|
||||||
shell-server
|
shell-server
|
||||||
|
http
|
||||||
|
|||||||
@ -100,6 +100,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<h3>Comments</h3>
|
<h3>Comments</h3>
|
||||||
<textarea id="workComment" rows="4" cols="50"></textarea>
|
<textarea id="workComment" rows="4" cols="50"></textarea>
|
||||||
|
<div id="commentSubmit">Submit</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="comment">
|
<div id="comment">
|
||||||
{{#each work 'comments'}}
|
{{#each work 'comments'}}
|
||||||
|
|||||||
@ -407,7 +407,7 @@ Template.main.events({
|
|||||||
input.typ = "text";
|
input.typ = "text";
|
||||||
input.style.height = 0.9 * dim.height.toString() + "px";
|
input.style.height = 0.9 * dim.height.toString() + "px";
|
||||||
}
|
}
|
||||||
if(!event.target.id === "workDate") input.value = ele.childNodes[0].nodeValue;
|
if(event.target.id !== "workDate") input.value = ele.childNodes[0].nodeValue;
|
||||||
input.className = "changeInput";
|
input.className = "changeInput";
|
||||||
|
|
||||||
input.style.width = "70%";
|
input.style.width = "70%";
|
||||||
@ -495,6 +495,14 @@ Template.main.events({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'click #commentSubmit' (event) {
|
||||||
|
workId = Session.get("currentWork")._id;
|
||||||
|
comment = document.getElementById('workComment').value;
|
||||||
|
if (comment !== "") {
|
||||||
|
document.getElementById('workComment').value = "";
|
||||||
|
Meteor.call('addComment', [comment, workId]);
|
||||||
|
}
|
||||||
|
},
|
||||||
'click #workSubmit' () {
|
'click #workSubmit' () {
|
||||||
if(getHomeworkFormData() === null) return;
|
if(getHomeworkFormData() === null) return;
|
||||||
Session.set("serverData",Session.get("currentWork"));
|
Session.set("serverData",Session.get("currentWork"));
|
||||||
|
|||||||
@ -368,6 +368,7 @@ Meteor.methods({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'addComment': function(input) {
|
'addComment': function(input) {
|
||||||
|
var comment = input[0];
|
||||||
var workobject = work.findOne({
|
var workobject = work.findOne({
|
||||||
_id: input[1]
|
_id: input[1]
|
||||||
});
|
});
|
||||||
@ -375,8 +376,9 @@ Meteor.methods({
|
|||||||
_id: workobject.class
|
_id: workobject.class
|
||||||
});
|
});
|
||||||
var user = Meteor.userId();
|
var user = Meteor.userId();
|
||||||
|
foundsubs = currentclass.subscribers;
|
||||||
if (typeof comment === "string" && comment.length <= 200 &&
|
if (typeof comment === "string" && comment.length <= 200 &&
|
||||||
currentclass.subscribers.indexOf(Meteor.userId()) != -1 &&
|
foundsubs.indexOf(Meteor.userId()) != -1 &&
|
||||||
currentclass.banned.indexOf(Meteor.userId()) === -1) {
|
currentclass.banned.indexOf(Meteor.userId()) === -1) {
|
||||||
var comments = workobject.comments.concat(comment);
|
var comments = workobject.comments.concat(comment);
|
||||||
work.update({
|
work.update({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user