small refactor

This commit is contained in:
Dennis Collinson 2012-01-12 14:43:31 -08:00
parent ee6fc18703
commit 7b1d7b8ac9
2 changed files with 3 additions and 11 deletions

View file

@ -22,22 +22,14 @@ app.views.Post = app.views.StreamObject.extend({
tooltipSelector : ".delete, .block_user, .post_scope",
initialize : function() {
// set the guid
$(this.el).attr("id", this.model.get("guid"));
// remove post
this.model.bind('remove', this.remove, this);
// commentStream view
//subviews
this.commentStreamView = new app.views.CommentStream({ model : this.model});
this.likesInfoView = new app.views.LikesInfo({ model : this.model});
// feedback view
if(window.app.user().current_user) {
this.feedbackView = new app.views.Feedback({model : this.model});
} else {
this.feedbackView = null;
}
this.feedbackView = window.app.user().current_user && new app.views.Feedback({model : this.model});
return this;
},

View file

@ -164,7 +164,7 @@ describe("app.views.Post", function(){
window.current_user = app.user(null);
var view = new app.views.Post({model : this.statusMessage}).render();
expect(view.feedbackView).toBeNull();
expect(view.feedbackView).toBeFalsy();
})
})