BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
cea3cf17
Commit
cea3cf17
authored
Jun 09, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'award-emoji-fixes' into 'master'
Award emoji fixes Fixes #18357 #18325 and #18424 See merge request !4550
parents
e328eab0
94826d9a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
19 deletions
+17
-19
application.js.coffee
app/assets/javascripts/application.js.coffee
+1
-0
awards_handler.coffee
app/assets/javascripts/awards_handler.coffee
+9
-7
dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+0
-2
_awards_block.html.haml
app/views/award_emoji/_awards_block.html.haml
+0
-3
gon_helper.rb
lib/gitlab/gon_helper.rb
+1
-0
awards_handler_spec.js.coffee
spec/javascripts/awards_handler_spec.js.coffee
+6
-7
No files found.
app/assets/javascripts/application.js.coffee
View file @
cea3cf17
...
...
@@ -271,5 +271,6 @@ $ ->
.
on
"resize"
,
(
e
)
->
fitSidebarForSize
()
gl
.
awardsHandler
=
new
AwardsHandler
()
checkInitialSidebarSize
()
new
Aside
()
app/assets/javascripts/awards_handler.coffee
View file @
cea3cf17
...
...
@@ -65,7 +65,7 @@ class @AwardsHandler
$addBtn
.
removeClass
'is-loading'
$menu
=
$
(
'.emoji-menu'
)
@
positionMenu
(
$menu
,
$addBtn
)
@
renderFrequentlyUsedBlock
()
@
renderFrequentlyUsedBlock
()
unless
@
frequentEmojiBlockRendered
setTimeout
=>
$menu
.
addClass
'is-visible'
...
...
@@ -100,7 +100,7 @@ class @AwardsHandler
$menu
.
css
(
css
)
addAward
:
(
votesBlock
,
awardUrl
,
emoji
,
checkMutuality
=
yes
,
callback
)
->
addAward
:
(
votesBlock
,
awardUrl
,
emoji
,
checkMutuality
=
true
,
callback
)
->
emoji
=
@
normilizeEmojiName
emoji
...
...
@@ -111,7 +111,7 @@ class @AwardsHandler
$
(
'.emoji-menu'
).
removeClass
'is-visible'
addAwardToEmojiBar
:
(
votesBlock
,
emoji
,
checkForMutuality
=
yes
)
->
addAwardToEmojiBar
:
(
votesBlock
,
emoji
,
checkForMutuality
=
true
)
->
@
checkMutuality
votesBlock
,
emoji
if
checkForMutuality
@
addEmojiToFrequentlyUsedList
emoji
...
...
@@ -153,7 +153,7 @@ class @AwardsHandler
if
isAlreadyVoted
@
showEmojiLoader
$emojiButton
@
addAward
votesBlock
,
awardUrl
,
mutualVote
,
no
,
->
@
addAward
votesBlock
,
awardUrl
,
mutualVote
,
false
,
->
$emojiButton
.
removeClass
'is-loading'
...
...
@@ -282,7 +282,7 @@ class @AwardsHandler
@
createEmojiMenu
@
getAwardMenuUrl
(),
=>
@
createEmoji_
votesBlock
,
emoji
getAwardMenuUrl
:
->
return
g
l
.
awardMenuU
rl
getAwardMenuUrl
:
->
return
g
on
.
award_menu_u
rl
resolveNameToCssClass
:
(
emoji
)
->
...
...
@@ -336,13 +336,15 @@ class @AwardsHandler
if
$
.
cookie
'frequently_used_emojis'
frequentlyUsedEmojis
=
@
getFrequentlyUsedEmojis
()
ul
=
$
(
"<ul class='clearfix emoji-menu-list'>"
)
ul
=
$
(
"<ul class='clearfix emoji-menu-list
frequent-emojis
'>"
)
for
emoji
in
frequentlyUsedEmojis
$
(
".emoji-menu-content [data-emoji='
#{
emoji
}
']"
).
closest
(
'li'
).
clone
().
appendTo
(
ul
)
$
(
'input.emoji-search'
).
after
(
ul
).
after
(
$
(
'<h5>'
).
text
(
'Frequently used'
))
@
frequentEmojiBlockRendered
=
true
setupSearch
:
->
...
...
@@ -365,4 +367,4 @@ class @AwardsHandler
searchEmojis
:
(
term
)
->
$
(
".emoji-menu-
content
[data-emoji*='
#{
term
}
']"
).
closest
(
'li'
).
clone
()
$
(
".emoji-menu-
list:not(.frequent-emojis)
[data-emoji*='
#{
term
}
']"
).
closest
(
'li'
).
clone
()
app/assets/javascripts/dispatcher.js.coffee
View file @
cea3cf17
...
...
@@ -23,7 +23,6 @@ class Dispatcher
new
Issue
()
shortcut_handler
=
new
ShortcutsIssuable
()
new
ZenMode
()
gl
.
awardsHandler
=
new
AwardsHandler
()
when
'projects:milestones:show'
,
'groups:milestones:show'
,
'dashboard:milestones:show'
new
Milestone
()
when
'dashboard:todos:index'
...
...
@@ -54,7 +53,6 @@ class Dispatcher
new
Diff
()
shortcut_handler
=
new
ShortcutsIssuable
(
true
)
new
ZenMode
()
gl
.
awardsHandler
=
new
AwardsHandler
()
when
"projects:merge_requests:diffs"
new
Diff
()
new
ZenMode
()
...
...
app/views/award_emoji/_awards_block.html.haml
View file @
cea3cf17
...
...
@@ -7,9 +7,6 @@
=
awards
.
count
-
if
current_user
:javascript
gl
.
awardMenuUrl
=
"
#{
emojis_path
}
"
.award-menu-holder.js-award-holder
%button
.btn.award-control.js-add-award
{
type:
"button"
}
=
icon
(
'smile-o'
,
class:
"award-control-icon award-control-icon-normal"
)
...
...
lib/gitlab/gon_helper.rb
View file @
cea3cf17
...
...
@@ -8,6 +8,7 @@ module Gitlab
gon
.
relative_url_root
=
Gitlab
.
config
.
gitlab
.
relative_url_root
gon
.
shortcuts_path
=
help_shortcuts_path
gon
.
user_color_scheme
=
Gitlab
::
ColorSchemes
.
for_user
(
current_user
).
css_class
gon
.
award_menu_url
=
emojis_path
if
current_user
gon
.
current_user_id
=
current_user
.
id
...
...
spec/javascripts/awards_handler_spec.js.coffee
View file @
cea3cf17
...
...
@@ -3,10 +3,11 @@
#= require jquery.cookie
#= require ./fixtures/emoji_menu
awardsHandler
=
null
window
.
gl
or=
{}
gl
.
emojiAliases
=
->
return
{
'+1'
:
'thumbsup'
,
'-1'
:
'thumbsdown'
}
gl
.
awardMenuUrl
=
'/emojis'
awardsHandler
=
null
window
.
gl
or=
{}
window
.
gon
or=
{}
gl
.
emojiAliases
=
->
return
{
'+1'
:
'thumbsup'
,
'-1'
:
'thumbsdown'
}
gon
.
award_menu_url
=
'/emojis'
lazyAssert
=
(
done
,
assertFn
)
->
...
...
@@ -25,9 +26,7 @@ describe 'AwardsHandler', ->
fixture
.
load
'awards_handler.html'
awardsHandler
=
new
AwardsHandler
spyOn
(
awardsHandler
,
'postEmoji'
).
and
.
callFake
(
url
,
emoji
,
cb
)
=>
cb
()
spyOn
(
jQuery
,
'get'
).
and
.
callFake
(
req
,
cb
)
->
expect
(
req
).
toBe
'/emojis'
cb
window
.
emojiMenu
spyOn
(
jQuery
,
'get'
).
and
.
callFake
(
req
,
cb
)
->
cb
window
.
emojiMenu
describe
'::showEmojiMenu'
,
->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment