Sha256: 9aa30b54507b0344a0bccd5bfdfc7fa632ac8aef55d3a880dc332d7ba9a166c9

Contents?: true

Size: 755 Bytes

Versions: 5

Compression:

Stored size: 755 Bytes

Contents

class CollectionActions
  constructor: (el) ->
    $el  = $(el)

    $form = $el.closest('form')

    $el.on 'click', (e) ->
      e.stopPropagation()
      e.preventDefault()

      checkedCheckboxes = $('.rs:checked')
      unless checkedCheckboxes.length
        alert 'Select Items'
        return false

      # clear all hidden fields with class .hidden_selected_ids
      $form.find('input[type="hidden"]').remove()

      checkedCheckboxes.each ->
        # create a new hidden
        hidden_input = $('<input>').attr({
          type: 'hidden',
          name: 'selected_ids[]',
          value: $(@).val()
        }).appendTo($form)

      $form.submit()


Handlers.register 'CollectionActions', CollectionActions

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
manage-1.3.41 app/assets/javascripts/manage/collection_actions.js.coffee
manage-1.3.35 app/assets/javascripts/manage/collection_actions.js.coffee
manage-1.3.30 app/assets/javascripts/manage/collection_actions.js.coffee
manage-1.3.22 app/assets/javascripts/manage/collection_actions.js.coffee
manage-1.3.21 app/assets/javascripts/manage/collection_actions.js.coffee