Batch action hover target

- don’t select when hovered over the name, only when hovered over the avatar
- fix hoveredBatchEntry bug
This commit is contained in:
Felix Niklas 2017-02-10 01:11:18 +01:00
parent 7ac8042b3f
commit e7c0688dbd
3 changed files with 12 additions and 9 deletions

View file

@ -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

View file

@ -1,7 +1,9 @@
<div class="batch-overlay-box-inner">
<% for macro in @macros: %>
<div class="batch-overlay-macro-entry js-batch-overlay-entry" data-action="macro" data-id="<%= macro.id %>">
<div class="js-hover-target">
<div class="batch-overlay-macro-entry-name"><%= macro.name %></div>
</div>
</div>
<% end %>
</div>

View file

@ -1,12 +1,12 @@
<% for user in @users: %>
<div class="batch-overlay-assign-entry js-batch-overlay-entry" data-action="user_assign" data-id="<%= user.id %>">
<%- user.avatar(80) %>
<div class="js-hover-target"><%- user.avatar(80) %></div>
<div class="batch-overlay-assign-entry-name"><%- user.displayName() %></div>
</div>
<% end %>
<% for group in @groups: %>
<div class="batch-overlay-assign-entry js-batch-overlay-entry" data-action="group_assign" data-id="<%= group.id %>">
<span class="avatar avatar--organization size-80">
<span class="avatar avatar--organization size-80 js-hover-target">
<%- @Icon('organization') %>
</span>
<div class="batch-overlay-assign-entry-name"><%- group.displayName() %></div>