BigW Consortium Gitlab

_votes_block.html.haml 1.14 KB
Newer Older
Valery Sizov committed
1
.awards.votes-block
Valery Sizov committed
2
  - awards_sort(votable.notes.awards.grouped_awards).each do |emoji, notes|
3
    %button.btn.award-control.js-emoji-btn.has-tooltip{class: (note_active_class(notes, current_user)), data: {placement: "top", original_title: emoji_author_list(notes, current_user)}}
4
      = emoji_icon(emoji, sprite: false)
5
      %span.award-control-text.js-counter
Valery Sizov committed
6
        = notes.count
Valery Sizov committed
7

Valery Sizov committed
8
  - if current_user
9 10 11 12 13 14
    %div.award-menu-holder.js-award-holder
      %a.btn.award-control.js-add-award{"href" => "#"}
        = icon('smile-o', {class: "award-control-icon"})
        = icon('spinner spin', {class: "award-control-icon award-control-icon-loading"})
        %span.award-control-text
          Add
Valery Sizov committed
15

Valery Sizov committed
16
- if current_user
17
  :javascript
18 19 20 21
    var getEmojisUrl = "#{emojis_path}";
    var postEmojiUrl = "#{award_toggle_namespace_project_notes_path(@project.namespace, @project)}";
    var noteableType = "#{votable.class.name.underscore}";
    var noteableId = "#{votable.id}";
22
    var unicodes = #{AwardEmoji.unicode.to_json};
Valery Sizov committed
23

24 25 26 27 28
    window.awardsHandler = new AwardsHandler(
      getEmojisUrl,
      postEmojiUrl,
      noteableType,
      noteableId,
29
      unicodes
30
    );