Commit 4eb16290 authored by Arinde Eniola's avatar Arinde Eniola Committed by Zeger-Jan van de Weg

move frontend logic from previous MR to new MR

parent 3bdc57f0
...@@ -22,6 +22,7 @@ class Dispatcher ...@@ -22,6 +22,7 @@ class Dispatcher
new Issue() new Issue()
shortcut_handler = new ShortcutsIssuable() shortcut_handler = new ShortcutsIssuable()
new ZenMode() new ZenMode()
awards_handler = new AwardsHandler()
when 'projects:milestones:show', 'groups:milestones:show', 'dashboard:milestones:show' when 'projects:milestones:show', 'groups:milestones:show', 'dashboard:milestones:show'
new Milestone() new Milestone()
when 'dashboard:todos:index' when 'dashboard:todos:index'
...@@ -52,6 +53,7 @@ class Dispatcher ...@@ -52,6 +53,7 @@ class Dispatcher
new Diff() new Diff()
shortcut_handler = new ShortcutsIssuable(true) shortcut_handler = new ShortcutsIssuable(true)
new ZenMode() new ZenMode()
awards_handler = new AwardsHandler()
when "projects:merge_requests:diffs" when "projects:merge_requests:diffs"
new Diff() new Diff()
new ZenMode() new ZenMode()
......
((w) ->
w.gl ?= {}
w.gl.emoji ?= {}
w.gl.emoji.emojiAliases = ->
JSON.parse('<%= Gitlab::AwardEmoji.aliases.to_json %>')
) window
\ No newline at end of file
...@@ -150,12 +150,12 @@ class @Notes ...@@ -150,12 +150,12 @@ class @Notes
renderNote: (note) -> renderNote: (note) ->
unless note.valid unless note.valid
if note.award if note.award
flash = new Flash('You have already used this award emoji!', 'alert') flash = new Flash('You have already awarded this emoji, and it we\'ve removed it', 'alert')
flash.pinTo('.header-content') flash.pinTo('.header-content')
return return
if note.award if note.award
awards_handler.addAwardToEmojiBar(note.note) awards_handler.addAwardToEmojiBar(note.name)
awards_handler.scrollToAwards() awards_handler.scrollToAwards()
# render note if it not present in loaded list # render note if it not present in loaded list
......
.awards { .awards {
line-height: 34px;
.emoji-icon { .emoji-icon {
width: 20px; width: 20px;
height: 20px; height: 20px;
...@@ -9,8 +7,6 @@ ...@@ -9,8 +7,6 @@
.emoji-menu { .emoji-menu {
position: absolute; position: absolute;
top: 100%;
left: 0;
margin-top: 3px; margin-top: 3px;
z-index: 1000; z-index: 1000;
min-width: 160px; min-width: 160px;
...@@ -23,7 +19,12 @@ ...@@ -23,7 +19,12 @@
opacity: 0; opacity: 0;
transform: scale(.2); transform: scale(.2);
transform-origin: 0 -45px; transform-origin: 0 -45px;
transition: all .3s cubic-bezier(.87,-.41,.19,1.44); transition: .3s cubic-bezier(.87,-.41,.19,1.44);
transition-property: transform, opacity;
&.is-aligned-right {
transform-origin: 100% -45px;
}
&.is-visible { &.is-visible {
pointer-events: all; pointer-events: all;
...@@ -107,7 +108,7 @@ ...@@ -107,7 +108,7 @@
} }
&.is-loading { &.is-loading {
.award-control-icon { .award-control-icon-normal {
display: none; display: none;
} }
......
...@@ -63,7 +63,8 @@ ul.notes { ...@@ -63,7 +63,8 @@ ul.notes {
&.is-editting { &.is-editting {
.note-header, .note-header,
.note-text, .note-text,
.edited-text { .edited-text,
.note-awards {
display: none; display: none;
} }
...@@ -73,8 +74,6 @@ ul.notes { ...@@ -73,8 +74,6 @@ ul.notes {
} }
.note-body { .note-body {
overflow: auto;
.note-text { .note-text {
overflow: auto; overflow: auto;
word-wrap: break-word; word-wrap: break-word;
...@@ -307,6 +306,42 @@ ul.notes { ...@@ -307,6 +306,42 @@ ul.notes {
} }
} }
.note-award-control {
display: block;
&:hover,
&:focus {
text-decoration: none;
}
.award-control-icon-loading {
display: none;
}
&.is-loading {
.award-control-icon-normal {
display: none;
}
.award-control-icon-loading {
display: block;
}
}
}
.note-awards {
.awards {
padding-top: 10px;
}
.award-control {
padding-top: 2px;
padding-bottom: 2px;
color: #8f8f8f;
font-size: 13px;
}
}
.disabled-comment { .disabled-comment {
margin-left: -$gl-padding-top; margin-left: -$gl-padding-top;
margin-right: -$gl-padding-top; margin-right: -$gl-padding-top;
......
...@@ -12,9 +12,9 @@ class NotesFinder ...@@ -12,9 +12,9 @@ class NotesFinder
when "commit" when "commit"
project.notes.for_commit_id(target_id).not_inline project.notes.for_commit_id(target_id).not_inline
when "issue" when "issue"
project.issues.find(target_id).notes.nonawards.inc_author project.issues.find(target_id).notes.inc_author
when "merge_request" when "merge_request"
project.merge_requests.find(target_id).mr_and_commit_notes.nonawards.inc_author project.merge_requests.find(target_id).mr_and_commit_notes.inc_author
when "snippet", "project_snippet" when "snippet", "project_snippet"
project.snippets.find(target_id).notes project.snippets.find(target_id).notes
else else
......
- grouped_awards = awardable.grouped_awards(inline) - grouped_emojis = awardable.grouped_awards(inline)
.awards.js-awards-block{ class: ("hidden" if !inline && grouped_emojis.size == 0), data: { award_url: url_for([:toggle_award_emoji, @project.namespace.becomes(Namespace), @project, awardable]) } } .awards.js-awards-block{ class: ("hidden" if !inline && grouped_emojis.size == 0), data: { award_url: url_for([:toggle_award_emoji, @project.namespace.becomes(Namespace), @project, awardable]) } }
- awards_sort(grouped_awards).each do |emoji, awards| - awards_sort(grouped_emojis).each do |emoji, awards|
%button.btn.award-control.js-emoji-btn.has-tooltip{ type: "button", class: (award_active_class(awards, current_user)), title: award_user_list(awards, current_user), data: { placement: "bottom" } } %button.btn.award-control.js-emoji-btn.has-tooltip{ type: "button", class: (award_active_class(awards, current_user)),data: { placement: "bottom", original_title: award_user_list(awards, current_user)} }
= emoji_icon(emoji) = emoji_icon(emoji)
%span.award-control-text.js-counter %span.award-control-text.js-counter
= awards.count = awards.count
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment