Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
8dc1fa0d
Commit
8dc1fa0d
authored
Jun 04, 2016
by
Fatih Acet
Committed by
Z.J. van de Weg
Jun 06, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated MR notes.
parent
7d3f8f54
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
22 deletions
+21
-22
app/assets/javascripts/awards_handler.coffee
app/assets/javascripts/awards_handler.coffee
+11
-13
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+2
-2
app/assets/javascripts/lib/emoji_aliases.js.coffee.erb
app/assets/javascripts/lib/emoji_aliases.js.coffee.erb
+1
-1
app/assets/javascripts/notes.js.coffee
app/assets/javascripts/notes.js.coffee
+2
-2
config/routes.rb
config/routes.rb
+1
-0
spec/javascripts/awards_handler_spec.js.coffee
spec/javascripts/awards_handler_spec.js.coffee
+4
-4
No files found.
app/assets/javascripts/awards_handler.coffee
View file @
8dc1fa0d
...
@@ -2,7 +2,7 @@ class @AwardsHandler
...
@@ -2,7 +2,7 @@ class @AwardsHandler
constructor
:
->
constructor
:
->
@
aliases
=
emojiAliases
()
@
aliases
=
gl
.
emojiAliases
()
$
(
document
)
$
(
document
)
.
off
'click'
,
'.js-add-award'
.
off
'click'
,
'.js-add-award'
...
@@ -172,7 +172,7 @@ class @AwardsHandler
...
@@ -172,7 +172,7 @@ class @AwardsHandler
decrementCounter
:
(
$emojiButton
,
emoji
)
->
decrementCounter
:
(
$emojiButton
,
emoji
)
->
counter
=
$
(
'.js-counter'
,
$emojiButton
)
counter
=
$
'.js-counter'
,
$emojiButton
counterNumber
=
parseInt
counter
.
text
(),
10
counterNumber
=
parseInt
counter
.
text
(),
10
if
counterNumber
>
1
if
counterNumber
>
1
...
@@ -218,9 +218,7 @@ class @AwardsHandler
...
@@ -218,9 +218,7 @@ class @AwardsHandler
awardBlock
awardBlock
.
closest
'.js-emoji-btn'
.
closest
'.js-emoji-btn'
.
removeData
'original-title'
.
removeData
'original-title'
.
removeData
'title'
.
attr
'data-original-title'
,
newAuthors
.
attr
'data-original-title'
,
newAuthors
.
attr
'data-title'
,
newAuthors
@
resetTooltip
awardBlock
@
resetTooltip
awardBlock
...
@@ -258,8 +256,8 @@ class @AwardsHandler
...
@@ -258,8 +256,8 @@ class @AwardsHandler
</button>"
</button>"
$emojiButton
=
$
buttonHtml
$emojiButton
=
$
buttonHtml
emoji_node
=
$emojiButton
$emojiButton
.
insertBefore
votesBlock
.
find
'.js-award-holder
:not(.js-award-action-btn)
'
.
insertBefore
votesBlock
.
find
'.js-award-holder'
.
find
'.emoji-icon'
.
find
'.emoji-icon'
.
data
'emoji'
,
emoji
.
data
'emoji'
,
emoji
...
@@ -281,21 +279,21 @@ class @AwardsHandler
...
@@ -281,21 +279,21 @@ class @AwardsHandler
if
$
(
'.emoji-menu'
).
length
if
$
(
'.emoji-menu'
).
length
return
@
createEmoji_
votesBlock
,
emoji
return
@
createEmoji_
votesBlock
,
emoji
@
createEmojiMenu
@
getAwardMenuUrl
(),
=>
@
createEmoji
votesBlock
,
emoji
@
createEmojiMenu
@
getAwardMenuUrl
(),
=>
@
createEmoji
_
votesBlock
,
emoji
getAwardMenuUrl
:
->
return
gl
.
awardMenuUrl
or
'/emojis'
getAwardMenuUrl
:
->
return
gl
.
awardMenuUrl
resolveNameToCssClass
:
(
emoji
)
->
resolveNameToCssClass
:
(
emoji
)
->
emoji
_icon
=
$
(
".emoji-menu-content [data-emoji='
#{
emoji
}
']"
)
emoji
Icon
=
$
".emoji-menu-content [data-emoji='
#{
emoji
}
']"
if
emoji
_i
con
.
length
>
0
if
emoji
I
con
.
length
>
0
unicodeName
=
emoji
_icon
.
data
(
'unicode-name'
)
unicodeName
=
emoji
Icon
.
data
'unicode-name'
else
else
# Find by alias
# Find by alias
unicodeName
=
$
(
".emoji-menu-content [data-aliases*=':
#{
emoji
}
:']"
).
data
(
'unicode-name'
)
unicodeName
=
$
(
".emoji-menu-content [data-aliases*=':
#{
emoji
}
:']"
).
data
'unicode-name'
return
"emoji-
#{
unicodeName
}
"
return
"emoji-
#{
unicodeName
}
"
...
@@ -303,7 +301,7 @@ class @AwardsHandler
...
@@ -303,7 +301,7 @@ class @AwardsHandler
postEmoji
:
(
awardUrl
,
emoji
,
callback
)
->
postEmoji
:
(
awardUrl
,
emoji
,
callback
)
->
$
.
post
awardUrl
,
{
name
:
emoji
},
(
data
)
->
$
.
post
awardUrl
,
{
name
:
emoji
},
(
data
)
->
callback
.
call
()
if
data
.
ok
callback
()
if
data
.
ok
findEmojiIcon
:
(
votesBlock
,
emoji
)
->
findEmojiIcon
:
(
votesBlock
,
emoji
)
->
...
...
app/assets/javascripts/dispatcher.js.coffee
View file @
8dc1fa0d
...
@@ -23,7 +23,7 @@ class Dispatcher
...
@@ -23,7 +23,7 @@ class Dispatcher
new
Issue
()
new
Issue
()
shortcut_handler
=
new
ShortcutsIssuable
()
shortcut_handler
=
new
ShortcutsIssuable
()
new
ZenMode
()
new
ZenMode
()
window
.
awardsHandler
=
new
AwardsHandler
()
gl
.
awardsHandler
=
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'
...
@@ -54,7 +54,7 @@ class Dispatcher
...
@@ -54,7 +54,7 @@ class Dispatcher
new
Diff
()
new
Diff
()
shortcut_handler
=
new
ShortcutsIssuable
(
true
)
shortcut_handler
=
new
ShortcutsIssuable
(
true
)
new
ZenMode
()
new
ZenMode
()
window
.
awardsHandler
=
new
AwardsHandler
()
gl
.
awardsHandler
=
new
AwardsHandler
()
when
"projects:merge_requests:diffs"
when
"projects:merge_requests:diffs"
new
Diff
()
new
Diff
()
new
ZenMode
()
new
ZenMode
()
...
...
app/assets/javascripts/lib/emoji_aliases.js.coffee.erb
View file @
8dc1fa0d
window
.emojiAliases = ->
gl
.emojiAliases = ->
JSON.parse('
<%=
Gitlab
::
AwardEmoji
.
aliases
.
to_json
%>
')
JSON.parse('
<%=
Gitlab
::
AwardEmoji
.
aliases
.
to_json
%>
')
app/assets/javascripts/notes.js.coffee
View file @
8dc1fa0d
...
@@ -168,8 +168,8 @@ class @Notes
...
@@ -168,8 +168,8 @@ class @Notes
if
note
.
award
if
note
.
award
votesBlock
=
$
(
'.js-awards-block'
).
eq
0
votesBlock
=
$
(
'.js-awards-block'
).
eq
0
awardsHandler
.
addAwardToEmojiBar
votesBlock
,
note
.
name
gl
.
awardsHandler
.
addAwardToEmojiBar
votesBlock
,
note
.
name
awardsHandler
.
scrollToAwards
()
gl
.
awardsHandler
.
scrollToAwards
()
# render note if it not present in loaded list
# render note if it not present in loaded list
# or skip if rendered
# or skip if rendered
...
...
config/routes.rb
View file @
8dc1fa0d
...
@@ -757,6 +757,7 @@ Rails.application.routes.draw do
...
@@ -757,6 +757,7 @@ Rails.application.routes.draw do
resources
:notes
,
only:
[
:index
,
:create
,
:destroy
,
:update
],
constraints:
{
id:
/\d+/
}
do
resources
:notes
,
only:
[
:index
,
:create
,
:destroy
,
:update
],
constraints:
{
id:
/\d+/
}
do
member
do
member
do
post
:toggle_award_emoji
delete
:delete_attachment
delete
:delete_attachment
end
end
end
end
...
...
spec/javascripts/awards_handler_spec.js.coffee
View file @
8dc1fa0d
...
@@ -3,10 +3,10 @@
...
@@ -3,10 +3,10 @@
#= require jquery.cookie
#= require jquery.cookie
#= require ./fixtures/emoji_menu
#= require ./fixtures/emoji_menu
awardsHandler
=
null
awardsHandler
=
null
window
.
gl
or=
{}
window
.
gl
or=
{}
window
.
gl
.
awardMenuUrl
=
'/emojis'
gl
.
emojiAliases
=
->
return
{
'+1'
:
'thumbsup'
,
'-1'
:
'thumbsdown'
}
window
.
emojiAliases
=
->
return
{
'+1'
:
'thumbsup'
,
'-1'
:
'thumbsdown'
}
gl
.
awardMenuUrl
=
'/emojis'
lazyAssert
=
(
done
,
assertFn
)
->
lazyAssert
=
(
done
,
assertFn
)
->
...
...
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