Sha256: 82db17bdbc2860b329d5574a54f7bd82876b28b113f5f21fa478fe70d71a1624

Contents?: true

Size: 1.28 KB

Versions: 97

Compression:

Stored size: 1.28 KB

Contents

$(document).on('click', '[data-behaviour="bulk-action-checkbox"]', function(e) {
  if ($('[data-behaviour="bulk-action-checkbox"]').is(':checked')) {
    $('[data-section="bulk-action"]').removeClass('hidden')
    setBulkActionParams()
  } else {
    $('[data-section="bulk-action"]').addClass('hidden')
  }
});

$(document).on('click', '[data-behaviour="bulk-action-select-all"]', function(e) {
  if ($(this).is(':checked')) {
    $('[data-behaviour="bulk-action-checkbox"]').prop('checked', true)
    $('[data-section="bulk-action"]').removeClass('hidden')
    setBulkActionParams()
  } else {
    $('[data-behaviour="bulk-action-checkbox"]').prop('checked', false)
    $('[data-section="bulk-action"]').addClass('hidden')
  }
});

function setBulkActionParams() {
  var selected_ids = []
  $('[data-behaviour="bulk-action-checkbox"]:checked').each(function(){ selected_ids.push($(this).data('ar-object-id')) })
  var bulk_action_form = '[data-section="bulk-action"] form'
  if ($(bulk_action_form)) {
    if ($(bulk_action_form + ' [name="selected_ids"]').length == 0) {
      $('<input>').attr({
        type: 'hidden',
        name: 'selected_ids'
      }).appendTo(bulk_action_form);
    }
  }
  $('[data-section="bulk-action"] [name="selected_ids"]').each(function( i ) {
    $(this).val(selected_ids)
  })
}

Version data entries

97 entries across 97 versions & 1 rubygems

Version Path
cm-admin-2.4.3 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.4.2 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.4.1 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.4.0 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.3.4 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.3.3 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.3.2 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.3.1 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.3.0 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.2.1 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.2.0 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.1.5 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.1.4 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.1.3 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.1.2 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.1.1 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.1.0 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.0.2 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.0.1 app/assets/javascripts/cm_admin/bulk_actions.js
cm-admin-2.0.0 app/assets/javascripts/cm_admin/bulk_actions.js