Commit bb2214bd authored by Sandra Freihofer's avatar Sandra Freihofer

Fix award emoji picker for relative_url

MR !2888 caused a regression where the emoji picker does not load when
using relative_url, because the path for the controller was hardcoded.
parent de1c8164
class @AwardsHandler class @AwardsHandler
constructor: (@post_emoji_url, @noteable_type, @noteable_id, @aliases) -> constructor: (@get_emojis_url, @post_emoji_url, @noteable_type, @noteable_id, @aliases) ->
$(".js-add-award").on "click", (event) => $(".js-add-award").on "click", (event) =>
event.stopPropagation() event.stopPropagation()
event.preventDefault() event.preventDefault()
...@@ -34,7 +34,7 @@ class @AwardsHandler ...@@ -34,7 +34,7 @@ class @AwardsHandler
$("#emoji_search").focus() $("#emoji_search").focus()
else else
$('.js-add-award').addClass "is-loading" $('.js-add-award').addClass "is-loading"
$.get "/emojis", (response) => $.get @get_emojis_url, (response) =>
$('.js-add-award').removeClass "is-loading" $('.js-add-award').removeClass "is-loading"
$(".js-award-holder").append response $(".js-award-holder").append response
setTimeout => setTimeout =>
......
...@@ -15,12 +15,14 @@ ...@@ -15,12 +15,14 @@
- if current_user - if current_user
:javascript :javascript
var get_emojis_url = "#{emojis_path}";
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 aliases = #{AwardEmoji.aliases.to_json};
window.awards_handler = new AwardsHandler( window.awards_handler = new AwardsHandler(
get_emojis_url,
post_emoji_url, post_emoji_url,
noteable_type, noteable_type,
noteable_id, noteable_id,
......
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