removed App.Views.PostContent in lieu of StreamObject; moved some view logic to where it should be
This commit is contained in:
parent
c6e4172926
commit
574eb7b12d
3 changed files with 9 additions and 27 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
App.Views.CommentStream = Backbone.View.extend({
|
App.Views.CommentStream = Backbone.View.extend({
|
||||||
events: {
|
events: {
|
||||||
"submit form": "createComment"
|
"submit form": "createComment",
|
||||||
|
"focus .comment_box": "commentTextareaFocused"
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
|
|
@ -40,6 +41,10 @@ App.Views.CommentStream = Backbone.View.extend({
|
||||||
this.$("ul.comments").append(new App.Views.Comment({
|
this.$("ul.comments").append(new App.Views.Comment({
|
||||||
model: comment
|
model: comment
|
||||||
}).render().el);
|
}).render().el);
|
||||||
|
},
|
||||||
|
|
||||||
|
commentTextareaFocused: function(evt){
|
||||||
|
this.$("form").removeClass('hidden').addClass("open");
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,11 @@
|
||||||
App.Views.PostContent = Backbone.View.extend({
|
App.Views.StatusMessage = App.Views.StreamObject.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({
|
|
||||||
template_name : "#status-message-template"
|
template_name : "#status-message-template"
|
||||||
});
|
});
|
||||||
|
|
||||||
App.Views.Reshare = App.Views.PostContent.extend({
|
App.Views.Reshare = App.Views.StreamObject.extend({
|
||||||
template_name : "#reshare-template"
|
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"
|
template_name : "#activity-streams-photo-template"
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ App.Views.Post = App.Views.StreamObject.extend({
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
"click .focus_comment_textarea": "focusCommentTextarea",
|
"click .focus_comment_textarea": "focusCommentTextarea",
|
||||||
"focus .comment_box": "commentTextareaFocused",
|
|
||||||
"click .shield a": "removeNsfwShield",
|
"click .shield a": "removeNsfwShield",
|
||||||
"click .remove_post": "destroyModel",
|
"click .remove_post": "destroyModel",
|
||||||
"click .like_action": "toggleLike",
|
"click .like_action": "toggleLike",
|
||||||
|
|
@ -68,7 +67,6 @@ App.Views.Post = App.Views.StreamObject.extend({
|
||||||
if(link.hasClass('like')) {
|
if(link.hasClass('like')) {
|
||||||
var like = this.model.likes.create();
|
var like = this.model.likes.create();
|
||||||
if(like) {
|
if(like) {
|
||||||
console.log(like);
|
|
||||||
this.model.set({
|
this.model.set({
|
||||||
user_like : like,
|
user_like : like,
|
||||||
likes_count : post.get("likes_count") + 1
|
likes_count : post.get("likes_count") + 1
|
||||||
|
|
@ -162,9 +160,5 @@ App.Views.Post = App.Views.StreamObject.extend({
|
||||||
this.$(".comment_box").focus();
|
this.$(".comment_box").focus();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
|
||||||
|
|
||||||
commentTextareaFocused: function(evt){
|
|
||||||
this.$("form").removeClass('hidden').addClass("open");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue