BigW Consortium Gitlab

_votes_block.html.haml 1.15 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
    var get_emojis_url = "#{emojis_path}";
19 20 21 22
    var post_emoji_url = "#{award_toggle_namespace_project_notes_path(@project.namespace, @project)}";
    var noteable_type = "#{votable.class.name.underscore}";
    var noteable_id = "#{votable.id}";
    var aliases = #{AwardEmoji.aliases.to_json};
Valery Sizov committed
23

24
    window.awards_handler = new AwardsHandler(
25
      get_emojis_url,
26 27 28 29
      post_emoji_url,
      noteable_type,
      noteable_id,
      aliases
30
    );