transformed window vars in Session vars

This commit is contained in:
Sacha Greif 2012-11-21 13:44:03 +09:00
parent cf8a433b0c
commit 6c2589ab90
4 changed files with 4 additions and 9 deletions

View file

@ -34,7 +34,7 @@
Session.set('scrollToCommentId', commentId);
// XXX: should use the Session for these
// on post page, we show the comment recursion
// on post page, we show the comment tree
Session.set('showChildComments',true);
// reset the new comment time at each new request of the post page
Session.set('newCommentTimestamp',new Date());
@ -51,7 +51,6 @@
Session.set('selectedCommentId', id);
// XXX: should use the Session for these
Session.set('showChildComments',false);
Session.set('newCommentTimestamp',new Date());
return 'comment_page';
@ -61,7 +60,6 @@
Session.set('selectedCommentId', id);
// XXX: should use the Session for these
Session.set('showChildComments', false);
Session.set('newCommentTimestamp',new Date());
return 'comment_reply';

View file

@ -2,8 +2,8 @@
commentIsNew=function(comment){
var d=new Date(comment.submitted);
var commentIsNew=d > window.newCommentTimestamp;
// console.log("body: "+comment.body+" | comment submission date: "+d+" | newCommentTimestamp: "+window.newCommentTimestamp+" | isNew: "+commentIsNew);
var commentIsNew=d > Session.get('newCommentTimestamp');
// console.log("body: "+comment.body+" | comment submission date: "+d+" | newCommentTimestamp: "+Session.get('newCommentTimestamp')+" | isNew: "+commentIsNew);
return commentIsNew;
};

View file

@ -6,7 +6,6 @@ Template.comment_page.post = function(){
Template.comment_page.helpers({
comment: function(){
var comment = Comments.findOne(Session.get('selectedCommentId'));
// Template.comment_page.showChildComments = false;
return comment;
}
});

View file

@ -22,6 +22,4 @@ Template.post_page.rendered = function(){
Session.set('scrollToCommentId', null);
this.rendered=true;
}
}
window.newCommentTimestamp=new Date();
}