removed App.Views.PostContent in lieu of StreamObject; moved some view logic to where it should be

This commit is contained in:
danielgrippi 2011-12-15 23:17:39 -08:00 committed by Dennis Collinson
parent c6e4172926
commit 574eb7b12d
3 changed files with 9 additions and 27 deletions

View file

@ -1,6 +1,7 @@
App.Views.CommentStream = Backbone.View.extend({
events: {
"submit form": "createComment"
"submit form": "createComment",
"focus .comment_box": "commentTextareaFocused"
},
initialize: function(options) {
@ -40,6 +41,10 @@ App.Views.CommentStream = Backbone.View.extend({
this.$("ul.comments").append(new App.Views.Comment({
model: comment
}).render().el);
},
commentTextareaFocused: function(evt){
this.$("form").removeClass('hidden').addClass("open");
}
});

View file

@ -1,28 +1,11 @@
App.Views.PostContent = Backbone.View.extend({
initialize: function(options) {
this.model = options.model;
this.template = _.template($(this.template_name).html());
},
render: function() {
this.el = $(this.template($.extend(
this.model.toJSON(),
App.user()
)));
return this;
}
});
App.Views.StatusMessage = App.Views.PostContent.extend({
App.Views.StatusMessage = App.Views.StreamObject.extend({
template_name : "#status-message-template"
});
App.Views.Reshare = App.Views.PostContent.extend({
App.Views.Reshare = App.Views.StreamObject.extend({
template_name : "#reshare-template"
});
App.Views.ActivityStreams__Photo = App.Views.PostContent.extend({
App.Views.ActivityStreams__Photo = App.Views.StreamObject.extend({
template_name : "#activity-streams-photo-template"
});

View file

@ -4,7 +4,6 @@ App.Views.Post = App.Views.StreamObject.extend({
events: {
"click .focus_comment_textarea": "focusCommentTextarea",
"focus .comment_box": "commentTextareaFocused",
"click .shield a": "removeNsfwShield",
"click .remove_post": "destroyModel",
"click .like_action": "toggleLike",
@ -68,7 +67,6 @@ App.Views.Post = App.Views.StreamObject.extend({
if(link.hasClass('like')) {
var like = this.model.likes.create();
if(like) {
console.log(like);
this.model.set({
user_like : like,
likes_count : post.get("likes_count") + 1
@ -162,9 +160,5 @@ App.Views.Post = App.Views.StreamObject.extend({
this.$(".comment_box").focus();
return this;
},
commentTextareaFocused: function(evt){
this.$("form").removeClass('hidden').addClass("open");
}
});