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
Boxiang Sun
gitlab-ce
Commits
f50306a7
Commit
f50306a7
authored
Apr 27, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/8-7-stable' into 'dev/8-7-stable'
parents
6044fd7e
a1db1355
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
18 deletions
+9
-18
app/assets/javascripts/awards_handler.coffee
app/assets/javascripts/awards_handler.coffee
+2
-15
app/assets/stylesheets/pages/search.scss
app/assets/stylesheets/pages/search.scss
+1
-1
app/views/votes/_votes_block.html.haml
app/views/votes/_votes_block.html.haml
+2
-2
lib/award_emoji.rb
lib/award_emoji.rb
+4
-0
No files found.
app/assets/javascripts/awards_handler.coffee
View file @
f50306a7
class
@
AwardsHandler
class
@
AwardsHandler
constructor
:
(
@
get_emojis_url
,
@
post_emoji_url
,
@
noteable_type
,
@
noteable_id
,
@
alias
es
)
->
constructor
:
(
@
get_emojis_url
,
@
post_emoji_url
,
@
noteable_type
,
@
noteable_id
,
@
unicod
es
)
->
$
(
".js-add-award"
).
on
"click"
,
(
event
)
=>
$
(
".js-add-award"
).
on
"click"
,
(
event
)
=>
event
.
stopPropagation
()
event
.
stopPropagation
()
event
.
preventDefault
()
event
.
preventDefault
()
...
@@ -57,7 +57,6 @@ class @AwardsHandler
...
@@ -57,7 +57,6 @@ class @AwardsHandler
,
200
,
200
addAward
:
(
emoji
)
->
addAward
:
(
emoji
)
->
emoji
=
@
normilizeEmojiName
(
emoji
)
@
postEmoji
emoji
,
=>
@
postEmoji
emoji
,
=>
@
addAwardToEmojiBar
(
emoji
)
@
addAwardToEmojiBar
(
emoji
)
...
@@ -66,7 +65,6 @@ class @AwardsHandler
...
@@ -66,7 +65,6 @@ class @AwardsHandler
addAwardToEmojiBar
:
(
emoji
)
->
addAwardToEmojiBar
:
(
emoji
)
->
@
addEmojiToFrequentlyUsedList
(
emoji
)
@
addEmojiToFrequentlyUsedList
(
emoji
)
emoji
=
@
normilizeEmojiName
(
emoji
)
if
@
exist
(
emoji
)
if
@
exist
(
emoji
)
if
@
isActive
(
emoji
)
if
@
isActive
(
emoji
)
@
decrementCounter
(
emoji
)
@
decrementCounter
(
emoji
)
...
@@ -148,15 +146,7 @@ class @AwardsHandler
...
@@ -148,15 +146,7 @@ class @AwardsHandler
$
(
'.award-control'
).
tooltip
()
$
(
'.award-control'
).
tooltip
()
resolveNameToCssClass
:
(
emoji
)
->
resolveNameToCssClass
:
(
emoji
)
->
emoji_icon
=
$
(
".emoji-menu-content [data-emoji='
#{
emoji
}
']"
)
"emoji-
#{
@
unicodes
[
emoji
]
}
"
if
emoji_icon
.
length
>
0
unicodeName
=
emoji_icon
.
data
(
"unicode-name"
)
else
# Find by alias
unicodeName
=
$
(
".emoji-menu-content [data-aliases*=':
#{
emoji
}
:']"
).
data
(
"unicode-name"
)
"emoji-
#{
unicodeName
}
"
postEmoji
:
(
emoji
,
callback
)
->
postEmoji
:
(
emoji
,
callback
)
->
$
.
post
@
post_emoji_url
,
{
note
:
{
$
.
post
@
post_emoji_url
,
{
note
:
{
...
@@ -175,9 +165,6 @@ class @AwardsHandler
...
@@ -175,9 +165,6 @@ class @AwardsHandler
scrollTop
:
$
(
'.awards'
).
offset
().
top
-
80
scrollTop
:
$
(
'.awards'
).
offset
().
top
-
80
},
200
)
},
200
)
normilizeEmojiName
:
(
emoji
)
->
@
aliases
[
emoji
]
||
emoji
addEmojiToFrequentlyUsedList
:
(
emoji
)
->
addEmojiToFrequentlyUsedList
:
(
emoji
)
->
frequently_used_emojis
=
@
getFrequentlyUsedEmojis
()
frequently_used_emojis
=
@
getFrequentlyUsedEmojis
()
frequently_used_emojis
.
push
(
emoji
)
frequently_used_emojis
.
push
(
emoji
)
...
...
app/assets/stylesheets/pages/search.scss
View file @
f50306a7
...
@@ -159,7 +159,7 @@
...
@@ -159,7 +159,7 @@
&
.has-location-badge
{
&
.has-location-badge
{
.search-input-wrap
{
.search-input-wrap
{
width
:
7
8%
;
width
:
6
8%
;
}
}
}
}
}
}
app/views/votes/_votes_block.html.haml
View file @
f50306a7
...
@@ -19,12 +19,12 @@
...
@@ -19,12 +19,12 @@
var
post_emoji_url
=
"
#{
award_toggle_namespace_project_notes_path
(
@project
.
namespace
,
@project
)
}
"
;
var
post_emoji_url
=
"
#{
award_toggle_namespace_project_notes_path
(
@project
.
namespace
,
@project
)
}
"
;
var
noteable_type
=
"
#{
votable
.
class
.
name
.
underscore
}
"
;
var
noteable_type
=
"
#{
votable
.
class
.
name
.
underscore
}
"
;
var
noteable_id
=
"
#{
votable
.
id
}
"
;
var
noteable_id
=
"
#{
votable
.
id
}
"
;
var
aliases
=
#{
AwardEmoji
.
aliases
.
to_json
}
;
var
unicodes
=
#{
AwardEmoji
.
unicode
.
to_json
}
;
window
.
awards_handler
=
new
AwardsHandler
(
window
.
awards_handler
=
new
AwardsHandler
(
get_emojis_url
,
get_emojis_url
,
post_emoji_url
,
post_emoji_url
,
noteable_type
,
noteable_type
,
noteable_id
,
noteable_id
,
alias
es
unicod
es
);
);
lib/award_emoji.rb
View file @
f50306a7
...
@@ -52,6 +52,10 @@ class AwardEmoji
...
@@ -52,6 +52,10 @@ class AwardEmoji
end
end
end
end
def
self
.
unicode
@unicode
||=
emojis
.
map
{
|
key
,
value
|
{
key
=>
emojis
[
key
][
"unicode"
]
}
}.
inject
(
:merge!
)
end
def
self
.
aliases
def
self
.
aliases
@aliases
||=
begin
@aliases
||=
begin
json_path
=
File
.
join
(
Rails
.
root
,
'fixtures'
,
'emojis'
,
'aliases.json'
)
json_path
=
File
.
join
(
Rails
.
root
,
'fixtures'
,
'emojis'
,
'aliases.json'
)
...
...
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