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
iv
gitlab-ce
Commits
074fa8f2
Commit
074fa8f2
authored
Feb 18, 2016
by
Annabel Dunstone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load award emoji picker with ajax request
parent
66c03e0e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
11 deletions
+25
-11
app/assets/javascripts/awards_handler.coffee
app/assets/javascripts/awards_handler.coffee
+11
-2
app/controllers/autocomplete_controller.rb
app/controllers/autocomplete_controller.rb
+4
-0
app/views/shared/emoji_menu.html.haml
app/views/shared/emoji_menu.html.haml
+9
-0
app/views/votes/_votes_block.html.haml
app/views/votes/_votes_block.html.haml
+0
-9
config/routes.rb
config/routes.rb
+1
-0
No files found.
app/assets/javascripts/awards_handler.coffee
View file @
074fa8f2
class
@
AwardsHandler
class
@
AwardsHandler
constructor
:
(
@
post_emoji_url
,
@
noteable_type
,
@
noteable_id
,
@
aliases
)
->
constructor
:
(
@
post_emoji_url
,
@
noteable_type
,
@
noteable_id
,
@
aliases
)
->
$
(
".add-award"
).
click
(
event
)
-
>
$
(
".add-award"
).
click
(
event
)
=
>
event
.
stopPropagation
()
event
.
stopPropagation
()
event
.
preventDefault
()
event
.
preventDefault
()
$
(
".emoji-menu"
).
show
()
@
showEmojiMenu
()
$
(
"#emoji_search"
).
focus
()
$
(
"#emoji_search"
).
focus
()
$
(
"html"
).
on
'click'
,
(
event
)
->
$
(
"html"
).
on
'click'
,
(
event
)
->
...
@@ -14,6 +15,14 @@ class @AwardsHandler
...
@@ -14,6 +15,14 @@ class @AwardsHandler
@
renderFrequentlyUsedBlock
()
@
renderFrequentlyUsedBlock
()
@
setupSearch
()
@
setupSearch
()
showEmojiMenu
:
->
if
$
(
".emoji-menu"
).
length
$
(
".emoji-menu"
).
show
()
else
$
.
get
"/emoji_menu"
,
(
response
)
->
$
(
".add-award"
).
after
response
$
(
".emoji-menu"
).
show
()
addAward
:
(
emoji
)
->
addAward
:
(
emoji
)
->
emoji
=
@
normilizeEmojiName
(
emoji
)
emoji
=
@
normilizeEmojiName
(
emoji
)
@
postEmoji
emoji
,
=>
@
postEmoji
emoji
,
=>
...
...
app/controllers/autocomplete_controller.rb
View file @
074fa8f2
...
@@ -24,6 +24,10 @@ class AutocompleteController < ApplicationController
...
@@ -24,6 +24,10 @@ class AutocompleteController < ApplicationController
render
json:
@user
,
only:
[
:name
,
:username
,
:id
],
methods:
[
:avatar_url
]
render
json:
@user
,
only:
[
:name
,
:username
,
:id
],
methods:
[
:avatar_url
]
end
end
def
emoji_menu
render
'shared/emoji_menu'
,
layout:
false
end
private
private
def
find_users
def
find_users
...
...
app/views/shared/emoji_menu.html.haml
0 → 100644
View file @
074fa8f2
.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"
])
\ No newline at end of file
app/views/votes/_votes_block.html.haml
View file @
074fa8f2
...
@@ -9,15 +9,6 @@
...
@@ -9,15 +9,6 @@
.awards-controls
.awards-controls
%a
.add-award
{
"href"
=>
"#"
}
%a
.add-award
{
"href"
=>
"#"
}
=
icon
(
'smile-o'
)
=
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"
])
-
if
current_user
-
if
current_user
:javascript
:javascript
...
...
config/routes.rb
View file @
074fa8f2
...
@@ -42,6 +42,7 @@ Rails.application.routes.draw do
...
@@ -42,6 +42,7 @@ Rails.application.routes.draw do
# Autocomplete
# Autocomplete
get
'/autocomplete/users'
=>
'autocomplete#users'
get
'/autocomplete/users'
=>
'autocomplete#users'
get
'/autocomplete/users/:id'
=>
'autocomplete#user'
get
'/autocomplete/users/:id'
=>
'autocomplete#user'
get
'/emoji_menu'
=>
'autocomplete#emoji_menu'
# Search
# Search
...
...
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