Sha256: 841b5288ed21eb5ab254a69f9b497367a4165ca1df1830d82d713ad85e3eb438

Contents?: true

Size: 956 Bytes

Versions: 1

Compression:

Stored size: 956 Bytes

Contents

#= require ./lib/dialog_mass_fields_update

$(document).ready ->

  $('.scoped_collection_action_button').click (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

1 entries across 1 versions & 1 rubygems

Version Path
active_admin_scoped_collection_actions-0.2.1 vendor/assets/javascripts/active_admin_scoped_collection_actions.js.coffee