diff options
Diffstat (limited to 'app/views/votes/_votes_block.html.haml')
-rw-r--r-- | app/views/votes/_votes_block.html.haml | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/app/views/votes/_votes_block.html.haml b/app/views/votes/_votes_block.html.haml index 6071f1484c6..8c660ba16cc 100644 --- a/app/views/votes/_votes_block.html.haml +++ b/app/views/votes/_votes_block.html.haml @@ -1,18 +1,22 @@ .awards.votes-block - votable.notes.awards.grouped_awards.each do |emoji, notes| .award{class: (note_active_class(notes, current_user)), title: emoji_author_list(notes, current_user)} - .icon{"data-emoji" => "#{emoji}"} - = image_tag url_to_emoji(emoji), height: "20px", width: "20px" + = emoji_icon(emoji) .counter = notes.count - if current_user - .dropdown.awards-controls + .awards-controls %a.add-award{"data-toggle" => "dropdown", "data-target" => "#", "href" => "#"} = icon('smile-o') - %ul.dropdown-menu.awards-menu - - emoji_list.each do |emoji| - %li{"data-emoji" => "#{emoji}"}= image_tag url_to_emoji(emoji), height: "20px", width: "20px" + .emoji-menu + .emoji-menu-content + - AwardEmoji.emoji_by_category.each do |category, emojis| + %h5= AwardEmoji::CATEGORIES[category] + %ul + - emojis.each do |emoji| + %li + = emoji_icon(emoji["name"], emoji["unicode"]) - if current_user :coffeescript @@ -20,10 +24,16 @@ noteable_type = "#{votable.class.name.underscore}" noteable_id = "#{votable.id}" aliases = #{AwardEmoji::ALIASES.to_json} - window.awards_handler = new AwardsHandler(post_emoji_url, noteable_type, noteable_id, aliases) - $(".awards-menu li").click (e)-> - emoji = $(this).data("emoji") + window.awards_handler = new AwardsHandler( + post_emoji_url, + noteable_type, + noteable_id, + aliases + ) + + $(".emoji-menu-content li").click (e)-> + emoji = $(this).find(".emoji-icon").data("emoji") awards_handler.addAward(emoji) $(".awards").on "click", ".award", (e)-> @@ -31,3 +41,5 @@ awards_handler.addAward(emoji) $(".award").tooltip() + + $(".emoji-menu-content").niceScroll({cursorwidth: "7px", autohidemode: false}) |