Skip to content

Commit

Permalink
Set css class for inline likes on comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tclaus committed Feb 25, 2021
1 parent b492088 commit dfcec9d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/assets/javascripts/app/models/post/like_interactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ app.models.Post.LikeInteractions = Backbone.Model.extend({
var self = this;
this.userLike().destroy({
success: function() {
self.post.set({participation: false});
// TODO: If user unlikes a post and all comments, then set participation to false
// self.post.set({participation: false});
self.trigger("change");
self.set({"likes_count": self.get("likes_count") - 1});
self.likes.trigger("change");
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/app/views/comment_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ app.views.Comment = app.views.Content.extend({

initialize: function(options) {
this.templateName = options.templateName || this.templateName;
this.model.interactions.on("change", this.render, this);
this.model.on("change", this.render, this);
},

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/app/views/stream_post_views.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ app.views.StreamPost = app.views.Post.extend({
subviews : {
".feedback": "feedbackView",
".comments": "commentStreamView",
".likes": "likesInfoView",
".likes-on-post": "likesInfoView",
".reshares": "resharesInfoView",
".post-controls": "postControlsView",
".post-content": "postContentView",
Expand Down
4 changes: 3 additions & 1 deletion app/assets/templates/comment_tpl.jst.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
{{~/if~}}
</a>
</div>
<div class="likes-on-comment"> </div>

<div class="likes likes-on-comment"> </div>

</div>
</div>
2 changes: 1 addition & 1 deletion app/assets/templates/stream-element_tpl.jst.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

{{#unless preview}}
<div class="feedback nsfw-hidden"> </div>
<div class="likes nsfw-hidden"> </div>
<div class="likes likes-on-post nsfw-hidden"> </div>
<div class="reshares nsfw-hidden"> </div>
<div class="comments nsfw-hidden"> </div>
{{/unless}}
Expand Down

0 comments on commit dfcec9d

Please sign in to comment.