Fixed issue #1053 - Bulk Action -> JS Error - Bug.
This commit is contained in:
parent
d12d386f00
commit
862ec3706d
3 changed files with 35 additions and 15 deletions
|
@ -364,8 +364,8 @@ class App.ControllerTable extends App.Controller
|
||||||
do (table, event, callback) ->
|
do (table, event, callback) ->
|
||||||
table.delegate('input[name="bulk"]', event, (e) ->
|
table.delegate('input[name="bulk"]', event, (e) ->
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
id = $(e.target).parents('tr').data('id')
|
id = $(e.currentTarget).parents('tr').data('id')
|
||||||
checked = $(e.target).prop('checked')
|
checked = $(e.currentTarget).prop('checked')
|
||||||
callback(id, checked, e)
|
callback(id, checked, e)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -382,27 +382,38 @@ class App.ControllerTable extends App.Controller
|
||||||
if @checkbox
|
if @checkbox
|
||||||
|
|
||||||
# click first tr>td, catch click
|
# click first tr>td, catch click
|
||||||
table.delegate('tr > td:nth-child(1)', event, (e) ->
|
table.delegate('tr > td:nth-child(1)', 'click', (e) ->
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
)
|
)
|
||||||
|
|
||||||
# bind on full bulk click
|
# bind on full bulk click
|
||||||
table.delegate('input[name="bulk_all"]', 'change', (e) ->
|
table.delegate('input[name="bulk_all"]', 'change', (e) =>
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
if $(e.target).prop('checked')
|
clicks = []
|
||||||
$(e.target).parents('table').find('[name="bulk"]').each( ->
|
if $(e.currentTarget).prop('checked')
|
||||||
if !$(@).prop('checked')
|
$(e.currentTarget).parents('table').find('[name="bulk"]').each( ->
|
||||||
#$(@).prop('checked', true)
|
$element = $(@)
|
||||||
$(@).trigger('click')
|
return if $element.prop('checked')
|
||||||
|
$element.prop('checked', true)
|
||||||
|
id = $element.parents('tr').data('id')
|
||||||
|
clicks.push [id, true]
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
$(e.target).parents('table').find('[name="bulk"]').each( ->
|
$(e.currentTarget).parents('table').find('[name="bulk"]').each( ->
|
||||||
if $(@).prop('checked')
|
$element = $(@)
|
||||||
#$(@).prop('checked', false)
|
return if !$element.prop('checked')
|
||||||
$(@).trigger('click')
|
$element.prop('checked', false)
|
||||||
|
id = $element.parents('tr').data('id')
|
||||||
|
clicks.push [id, false]
|
||||||
)
|
)
|
||||||
|
return if !@bindCheckbox
|
||||||
|
return if !@bindCheckbox.events
|
||||||
|
return if _.isEmpty(clicks)
|
||||||
|
for event, callback of @bindCheckbox.events
|
||||||
|
if event == 'click' || event == 'change'
|
||||||
|
for click in clicks
|
||||||
|
callback(click..., e)
|
||||||
)
|
)
|
||||||
|
|
||||||
table
|
table
|
||||||
|
|
||||||
sortList: (objects) =>
|
sortList: (objects) =>
|
||||||
|
|
|
@ -120,9 +120,18 @@ class App.TicketOverview extends App.Controller
|
||||||
options:
|
options:
|
||||||
duration: 200
|
duration: 200
|
||||||
complete: =>
|
complete: =>
|
||||||
|
if !@hoveredBatchEntry
|
||||||
|
@cleanUpDrag()
|
||||||
|
return
|
||||||
|
|
||||||
@hoveredBatchEntry.velocity 'reverse',
|
@hoveredBatchEntry.velocity 'reverse',
|
||||||
duration: 200
|
duration: 200
|
||||||
complete: =>
|
complete: =>
|
||||||
|
|
||||||
|
if !@hoveredBatchEntry
|
||||||
|
@cleanUpDrag()
|
||||||
|
return
|
||||||
|
|
||||||
# clean scale
|
# clean scale
|
||||||
action = @hoveredBatchEntry.attr('data-action')
|
action = @hoveredBatchEntry.attr('data-action')
|
||||||
id = @hoveredBatchEntry.attr('data-id')
|
id = @hoveredBatchEntry.attr('data-id')
|
||||||
|
|
|
@ -195,7 +195,7 @@ class App extends Spine.Controller
|
||||||
|
|
||||||
# if date is a object, get name of the object
|
# if date is a object, get name of the object
|
||||||
isObject = false
|
isObject = false
|
||||||
if typeof item is 'object'
|
if item && typeof item is 'object'
|
||||||
isObject = true
|
isObject = true
|
||||||
if item.displayNameLong
|
if item.displayNameLong
|
||||||
resultLocal = item.displayNameLong()
|
resultLocal = item.displayNameLong()
|
||||||
|
|
Loading…
Reference in a new issue