Sha256: bfedc7c7376102bc6824f1c380ecc97bfe91039499c055354dab38a924b456e9

Contents?: true

Size: 972 Bytes

Versions: 4

Compression:

Stored size: 972 Bytes

Contents

#= require ./lib/dialog_mass_fields_update

$(document).ready ->

  $(document).on 'click', '.scoped_collection_action_button', (e) ->
    e.preventDefault()
    fields = JSON.parse( $(this).attr('data') )

    ActiveAdmin.dialogMassFieldsUpdate fields['confirm'], fields['inputs'],
      (inputs)=>
        url = window.location.pathname + '/batch_action' + window.location.search
        form_data = {
          changes: inputs,
          collection_selection: [],
          authenticity_token: fields['auth_token'],
          batch_action: fields['batch_action']
        }
        $('.paginated_collection').find('input.collection_selection:checked').each (i, el) ->
          form_data["collection_selection"].push($(el).val())

        $.post(url, form_data).always (data, textStatus, jqXHR) ->
          if jqXHR.getResponseHeader('Location')
            window.location.assign jqXHR.getResponseHeader('Location')
          else
            window.location.reload()

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_admin_scoped_collection_actions-0.3.5 vendor/assets/javascripts/active_admin_scoped_collection_actions.js.coffee
active_admin_scoped_collection_actions-0.3.4 vendor/assets/javascripts/active_admin_scoped_collection_actions.js.coffee
active_admin_scoped_collection_actions-0.3.3 vendor/assets/javascripts/active_admin_scoped_collection_actions.js.coffee
active_admin_scoped_collection_actions-0.3.0 vendor/assets/javascripts/active_admin_scoped_collection_actions.js.coffee