debian-mirror-gitlab/app/views/votes/_votes_block.html.haml

49 lines
1.6 KiB
Text
Raw Normal View History

2015-11-26 14:37:03 +05:30
.awards.votes-block
- awards_sort(votable.notes.awards.grouped_awards).each do |emoji, notes|
2015-11-26 14:37:03 +05:30
.award{class: (note_active_class(notes, current_user)), title: emoji_author_list(notes, current_user)}
= emoji_icon(emoji)
2015-11-26 14:37:03 +05:30
.counter
= notes.count
- if current_user
.awards-controls
2016-04-02 18:10:28 +05:30
%a.add-award{"href" => "#"}
2015-11-26 14:37:03 +05:30
= icon('smile-o')
.emoji-menu
.emoji-menu-content
= text_field_tag :emoji_search, "", class: "emoji-search search-input form-control"
- AwardEmoji.emoji_by_category.each do |category, emojis|
%h5= AwardEmoji::CATEGORIES[category]
%ul
- emojis.each do |emoji|
%li
= emoji_icon(emoji["name"], emoji["unicode"], emoji["aliases"])
2015-11-26 14:37:03 +05:30
- if current_user
:javascript
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};
2015-11-26 14:37:03 +05:30
window.awards_handler = new AwardsHandler(
post_emoji_url,
noteable_type,
noteable_id,
aliases
);
2015-11-26 14:37:03 +05:30
$(".awards").on("click", ".emoji-menu-content li", function(e) {
var emoji = $(this).find(".emoji-icon").data("emoji");
awards_handler.addAward(emoji);
});
2015-11-26 14:37:03 +05:30
$(".awards").on("click", ".award", function(e) {
var emoji = $(this).find(".icon").data("emoji");
awards_handler.addAward(emoji);
});
$(".award").tooltip();
$(".emoji-menu-content").niceScroll({cursorwidth: "7px", autohidemode: false});