diff --git a/hourglass/client/main/main.html b/hourglass/client/main/main.html
index 0e544eb..fea22e9 100644
--- a/hourglass/client/main/main.html
+++ b/hourglass/client/main/main.html
@@ -128,24 +128,24 @@
Other
- Attach other files
+
{{#unless newWork}}
{{/unless}}
@@ -201,3 +201,11 @@
+
+
+
+
diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js
index a634cf2..a83a698 100644
--- a/hourglass/client/main/main.js
+++ b/hourglass/client/main/main.js
@@ -671,7 +671,9 @@ Template.main.events({
},
'click #commentSubmit' (event) {
workId = Session.get("currentWork")._id;
- comment = document.getElementById('workComment').value;
+ var input = document.getElementById('workComment');
+ comment = input.value;
+ input.value = "";
if (comment !== "") {
document.getElementById('workComment').value = "";
Meteor.call('addComment', [comment, workId]);
@@ -889,5 +891,18 @@ function toDate(date) {
function formReadable(input) {
input.dueDate = getReadableDate(input.dueDate);
input.type = input.type[0].toUpperCase() + input.type.slice(1);
+ var comments = input.comments;
+ for(var k = 0; k < comments.length; k++) {
+ comments[k].user = Meteor.users.findOne({_id:comments[k].user}).profile.name;
+ comments[k].date = moment(comments[k].date).calendar(null, { //change to time if recently posted
+ sameDay: '[Today]',
+ nextDay: '[Tomorrow]',
+ nextWeek: 'dddd',
+ lastDay: '[Yesterday]',
+ lastWeek: '[Last] dddd',
+ sameElse: 'MMMM Do'
+ });
+ }
+ input.comments = comments;
return input;
}
diff --git a/hourglass/server/main.js b/hourglass/server/main.js
index 9bdfbd2..70661ce 100644
--- a/hourglass/server/main.js
+++ b/hourglass/server/main.js
@@ -434,14 +434,17 @@ Meteor.methods({
if (typeof comment === "string" && comment.length <= 200 &&
foundsubs.indexOf(Meteor.userId()) != -1 &&
currentclass.banned.indexOf(Meteor.userId()) === -1) {
- var comments = workobject.comments.concat(comment);
+ commentInfo = {
+ "comment":input[0],
+ "user":user,
+ "date": new Date()
+ };
+ var comments = workobject.comments.concat(commentInfo);
work.update({
_id: input[1]
}, {
$set: {
- comments: comments,
- user: user,
- time: new Date()
+ comments: comments
}
});
} else {