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:
parent
7ac8042b3f
commit
e7c0688dbd
3 changed files with 12 additions and 9 deletions
|
@ -21,8 +21,8 @@ class App.TicketOverview extends App.Controller
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'mousedown .item': 'startDragItem'
|
'mousedown .item': 'startDragItem'
|
||||||
'mouseenter .js-batch-overlay-entry': 'highlightBatchEntry'
|
'mouseenter .js-hover-target': 'highlightBatchEntry'
|
||||||
'mouseleave .js-batch-overlay-entry': 'unhighlightBatchEntry'
|
'mouseleave .js-hover-target': 'unhighlightBatchEntry'
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
|
@ -492,26 +492,27 @@ class App.TicketOverview extends App.Controller
|
||||||
@batchMacroShown = false
|
@batchMacroShown = false
|
||||||
|
|
||||||
highlightBatchEntryAtMousePosition: =>
|
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)
|
if(entryAtPoint.length)
|
||||||
@hoveredBatchEntry = entryAtPoint.addClass('is-hovered')
|
@hoveredBatchEntry = entryAtPoint.closest('.js-batch-overlay-entry').addClass('is-hovered')
|
||||||
|
|
||||||
highlightBatchEntry: (event) ->
|
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'
|
if @hoveredBatchEntry.attr('data-action') is 'group_assign'
|
||||||
@batchAssignGroupHintTimeout = setTimeout @blinkBatchEntry, 800
|
@batchAssignGroupHintTimeout = setTimeout @blinkBatchEntry, 800
|
||||||
@batchAssignGroupTimeout = setTimeout @showBatchAssignGroup, 900
|
@batchAssignGroupTimeout = setTimeout @showBatchAssignGroup, 900
|
||||||
|
|
||||||
unhighlightBatchEntry: (event) ->
|
unhighlightBatchEntry: (event) ->
|
||||||
|
return if !@hoveredBatchEntry
|
||||||
if @hoveredBatchEntry.attr('data-action') is 'group_assign'
|
if @hoveredBatchEntry.attr('data-action') is 'group_assign'
|
||||||
if @batchAssignGroupTimeout
|
if @batchAssignGroupTimeout
|
||||||
clearTimeout @batchAssignGroupTimeout
|
clearTimeout @batchAssignGroupTimeout
|
||||||
if @batchAssignGroupHintTimeout
|
if @batchAssignGroupHintTimeout
|
||||||
clearTimeout @batchAssignGroupHintTimeout
|
clearTimeout @batchAssignGroupHintTimeout
|
||||||
|
|
||||||
|
@hoveredBatchEntry.removeClass('is-hovered')
|
||||||
@hoveredBatchEntry = null
|
@hoveredBatchEntry = null
|
||||||
$(event.currentTarget).removeClass('is-hovered')
|
|
||||||
|
|
||||||
blinkBatchEntry: =>
|
blinkBatchEntry: =>
|
||||||
@hoveredBatchEntry
|
@hoveredBatchEntry
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<div class="batch-overlay-box-inner">
|
<div class="batch-overlay-box-inner">
|
||||||
<% for macro in @macros: %>
|
<% for macro in @macros: %>
|
||||||
<div class="batch-overlay-macro-entry js-batch-overlay-entry" data-action="macro" data-id="<%= macro.id %>">
|
<div class="batch-overlay-macro-entry js-batch-overlay-entry" data-action="macro" data-id="<%= macro.id %>">
|
||||||
<div class="batch-overlay-macro-entry-name"><%= macro.name %></div>
|
<div class="js-hover-target">
|
||||||
|
<div class="batch-overlay-macro-entry-name"><%= macro.name %></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
|
@ -1,12 +1,12 @@
|
||||||
<% for user in @users: %>
|
<% for user in @users: %>
|
||||||
<div class="batch-overlay-assign-entry js-batch-overlay-entry" data-action="user_assign" data-id="<%= user.id %>">
|
<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 class="batch-overlay-assign-entry-name"><%- user.displayName() %></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% for group in @groups: %>
|
<% for group in @groups: %>
|
||||||
<div class="batch-overlay-assign-entry js-batch-overlay-entry" data-action="group_assign" data-id="<%= group.id %>">
|
<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') %>
|
<%- @Icon('organization') %>
|
||||||
</span>
|
</span>
|
||||||
<div class="batch-overlay-assign-entry-name"><%- group.displayName() %></div>
|
<div class="batch-overlay-assign-entry-name"><%- group.displayName() %></div>
|
||||||
|
|
Loading…
Reference in a new issue