gitlab-org--gitlab-foss/app/views/votes/_votes_block.html.haml

33 lines
1.2 KiB
Plaintext

.awards.votes-block
- votable.notes.awards.grouped_awards.each do | vote |
.award{class: ("active" if vote.last.pluck(:author_id).include?(current_user.id))}
.icon{class: "emoji-#{vote.first}"}
= image_tag url_to_emoji(vote.first), height: "20px", width: "20px"
.counter
= vote.last.count
.dropdown.awards-controls
%a#add-award{"data-toggle" => "dropdown", "data-target" => "#", "href" => "#"} +
%ul.dropdown-menu.awards-menu
- ["100", "blush", "heart", "smile", "rage", "beers", "thumbsup", "disappointed", "ok_hand", "helicopter"].each do |emoji|
%li{class: "emoji-#{emoji}"}= image_tag url_to_emoji(emoji), height: "20px", width: "20px"
:coffeescript
post_emoji_url = "#{award_toggle_namespace_project_notes_path(@project.namespace, @project)}"
noteable_type = "Issue"
noteable_id = #{@issue.id}
awards_handler = new AwardsHandler(post_emoji_url, noteable_type, noteable_id)
$ ->
$(".awards-menu li").click (e)->
emoji = $(this).attr("class")
awards_handler.addAward(emoji)
$(".awards").on "click", ".award", (e)->
emoji = /(emoji-\S*)/.exec($(this).find(".icon").attr("class"))[0]
awards_handler.addAward(emoji)