Skip to content

Commit

Permalink
Add tooltip on like comment through js (#5357)
Browse files Browse the repository at this point in the history
  • Loading branch information
jainaman224 authored and grvsachdeva committed Apr 4, 2019
1 parent 554aea8 commit e2ff7bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/comment_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def like_comment
end

@likes = comment.likes.group(:emoji_type).count
@user_reactions_map = comment.user_reactions_map
respond_with do |format|
format.js do
render template: 'comments/like_comment'
Expand Down
3 changes: 3 additions & 0 deletions app/views/comments/like_comment.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ $("<%= str %>").css("display","none");
$("<%= str %>").css("display","flex");
$("<%= str %> div").first().html("<%= @likes[capitalized_emoji_name] %>");
<% end %>
<% if @user_reactions_map.has_key? capitalized_emoji_name %>
$("<%= str %>").attr("data-original-title", "<%= @user_reactions_map[capitalized_emoji_name] %>");
<% end %>
<% end %>

0 comments on commit e2ff7bf

Please sign in to comment.