From e7c0688dbdfb2b4d66fa21921466ffab37b58ec8 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Fri, 10 Feb 2017 01:11:18 +0100 Subject: [PATCH] Batch action hover target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - don’t select when hovered over the name, only when hovered over the avatar - fix hoveredBatchEntry bug --- .../app/controllers/ticket_overview.coffee | 13 +++++++------ .../ticket_overview/batch_overlay_macro.jst.eco | 4 +++- .../batch_overlay_user_group.jst.eco | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_overview.coffee b/app/assets/javascripts/app/controllers/ticket_overview.coffee index 3ab920d7c..116a9021c 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.coffee @@ -21,8 +21,8 @@ class App.TicketOverview extends App.Controller events: 'mousedown .item': 'startDragItem' - 'mouseenter .js-batch-overlay-entry': 'highlightBatchEntry' - 'mouseleave .js-batch-overlay-entry': 'unhighlightBatchEntry' + 'mouseenter .js-hover-target': 'highlightBatchEntry' + 'mouseleave .js-hover-target': 'unhighlightBatchEntry' constructor: -> super @@ -492,26 +492,27 @@ class App.TicketOverview extends App.Controller @batchMacroShown = false highlightBatchEntryAtMousePosition: => - entryAtPoint = $(document.elementFromPoint(@mouse.x, @mouse.y)).closest('.js-batch-overlay-entry') + entryAtPoint = $(document.elementFromPoint(@mouse.x, @mouse.y)).closest('.js-batch-overlay-entry .avatar') if(entryAtPoint.length) - @hoveredBatchEntry = entryAtPoint.addClass('is-hovered') + @hoveredBatchEntry = entryAtPoint.closest('.js-batch-overlay-entry').addClass('is-hovered') highlightBatchEntry: (event) -> - @hoveredBatchEntry = $(event.currentTarget).addClass('is-hovered') + @hoveredBatchEntry = $(event.currentTarget).closest('.js-batch-overlay-entry').addClass('is-hovered') if @hoveredBatchEntry.attr('data-action') is 'group_assign' @batchAssignGroupHintTimeout = setTimeout @blinkBatchEntry, 800 @batchAssignGroupTimeout = setTimeout @showBatchAssignGroup, 900 unhighlightBatchEntry: (event) -> + return if !@hoveredBatchEntry if @hoveredBatchEntry.attr('data-action') is 'group_assign' if @batchAssignGroupTimeout clearTimeout @batchAssignGroupTimeout if @batchAssignGroupHintTimeout clearTimeout @batchAssignGroupHintTimeout + @hoveredBatchEntry.removeClass('is-hovered') @hoveredBatchEntry = null - $(event.currentTarget).removeClass('is-hovered') blinkBatchEntry: => @hoveredBatchEntry diff --git a/app/assets/javascripts/app/views/ticket_overview/batch_overlay_macro.jst.eco b/app/assets/javascripts/app/views/ticket_overview/batch_overlay_macro.jst.eco index 8f490f314..35db0dedc 100644 --- a/app/assets/javascripts/app/views/ticket_overview/batch_overlay_macro.jst.eco +++ b/app/assets/javascripts/app/views/ticket_overview/batch_overlay_macro.jst.eco @@ -1,7 +1,9 @@
<% for macro in @macros: %>
-
<%= macro.name %>
+
+
<%= macro.name %>
+
<% end %>
\ No newline at end of file diff --git a/app/assets/javascripts/app/views/ticket_overview/batch_overlay_user_group.jst.eco b/app/assets/javascripts/app/views/ticket_overview/batch_overlay_user_group.jst.eco index 956b89425..488df0200 100644 --- a/app/assets/javascripts/app/views/ticket_overview/batch_overlay_user_group.jst.eco +++ b/app/assets/javascripts/app/views/ticket_overview/batch_overlay_user_group.jst.eco @@ -1,12 +1,12 @@ <% for user in @users: %>
- <%- user.avatar(80) %> +
<%- user.avatar(80) %>
<%- user.displayName() %>
<% end %> <% for group in @groups: %>
- + <%- @Icon('organization') %>
<%- group.displayName() %>