summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/awards_handler.coffee20
-rw-r--r--app/assets/javascripts/notes.js.coffee2
-rw-r--r--app/controllers/projects/notes_controller.rb3
-rw-r--r--app/helpers/issues_helper.rb11
-rw-r--r--app/models/merge_request.rb1
5 files changed, 16 insertions, 21 deletions
diff --git a/app/assets/javascripts/awards_handler.coffee b/app/assets/javascripts/awards_handler.coffee
index 4c0a274b793..589caf011ed 100644
--- a/app/assets/javascripts/awards_handler.coffee
+++ b/app/assets/javascripts/awards_handler.coffee
@@ -4,21 +4,21 @@ class @AwardsHandler
$(document)
.off "click", ".js-add-award"
- .on "click", ".js-add-award", (event) =>
- event.stopPropagation()
- event.preventDefault()
+ .on "click", ".js-add-award", (e) =>
+ e.stopPropagation()
+ e.preventDefault()
- @showEmojiMenu $(event.currentTarget)
+ @showEmojiMenu $(e.currentTarget)
- $("html").on 'click', (event) ->
- if !$(event.target).closest(".emoji-menu").length
+ $("html").on 'click', (e) ->
+ if !$(e.target).closest(".emoji-menu").length
if $(".emoji-menu").is(":visible")
$('.js-add-award.is-active').removeClass 'is-active'
$(".emoji-menu").removeClass "is-visible"
$(document)
.off "click", ".js-emoji-btn"
- .on "click", ".js-emoji-btn", (e) => @handleClick(e)
+ .on "click", ".js-emoji-btn", @handleClick.bind(@)
handleClick: (e) ->
e.preventDefault()
@@ -31,7 +31,8 @@ class @AwardsHandler
else if $votesBlock.length is 0
$votesBlock = $addAwardBtn.closest('.js-awards-block')
- $votesBlock.addClass 'js-awards-block-current'
+ @currentVoteBlock = $votesBlock
+
awardUrl = $votesBlock.data 'award-url'
emoji = $emojiBtn
.find(".icon")
@@ -103,7 +104,6 @@ class @AwardsHandler
emoji = @normilizeEmojiName(emoji)
@postEmoji awardUrl, emoji, =>
@addAwardToEmojiBar(emoji)
- $('.js-awards-block').removeClass 'js-awards-block-current'
$(".emoji-menu").removeClass "is-visible"
@@ -210,7 +210,7 @@ class @AwardsHandler
callback.call()
findEmojiIcon: (emoji) ->
- $(".js-awards-block-current.awards > .js-emoji-btn [data-emoji='#{emoji}']")
+ @currentVoteBlock.find(".js-emoji-btn [data-emoji='#{emoji}']")
scrollToAwards: ->
$('body, html').animate({
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index ae8c1f22e4c..74ae897b84a 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -150,7 +150,7 @@ class @Notes
renderNote: (note) ->
unless note.valid
if note.award
- flash = new Flash('You have already awarded this emoji, and it we\'ve removed it', 'alert')
+ flash = new Flash('You have already awarded this emoji, it has been removed', 'alert')
flash.pinTo('.header-content')
return
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb
index 9000e0adf63..eb5137fe999 100644
--- a/app/controllers/projects/notes_controller.rb
+++ b/app/controllers/projects/notes_controller.rb
@@ -22,7 +22,7 @@ class Projects::NotesController < Projects::ApplicationController
def create
@note = Notes::CreateService.new(project, current_user, note_params).execute
- @note = note.is_a?(AwardEmoji) ? @note.to_note_json : note_json(@note)
+ @note = @note.is_a?(AwardEmoji) ? @note.to_note_json : note_json(@note)
respond_to do |format|
format.json { render json: @note }
@@ -63,7 +63,6 @@ class Projects::NotesController < Projects::ApplicationController
def note
@note ||= @project.notes.find(params[:id])
end
- alias_method :awardable, :note
def note_to_html(note)
render_to_string(
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 38de0b442ca..ac6c6fb25bb 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -131,7 +131,7 @@ module IssuesHelper
class: "icon emoji-icon emoji-#{unicode}",
title: name,
data: data
- else
+ else
# Emoji icons displayed separately, used for the awards already given
# to an issue or merge request.
content_tag :img, "",
@@ -145,12 +145,9 @@ module IssuesHelper
end
def award_user_list(awards, current_user)
- list =
- awards.map do |award|
- award.user == current_user ? "me" : award.user.name
- end
-
- list.join(", ")
+ awards.map do |award|
+ award.user == current_user ? 'me' : award.user.name
+ end.join(', ')
end
def award_active_class(awards, current_user)
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 2cb3e8b0176..e410febdfff 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -36,7 +36,6 @@ class MergeRequest < ActiveRecord::Base
include Referable
include Sortable
include Taskable
- include Awardable
belongs_to :target_project, foreign_key: :target_project_id, class_name: "Project"
belongs_to :source_project, foreign_key: :source_project_id, class_name: "Project"