Sha256: 6e5f8a66727ae9115154fbc037e02e9801c493514ea7ff6af5d1fe9d641ea087

Contents?: true

Size: 1.4 KB

Versions: 17

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true
require "active_admin/component"

module ActiveAdmin
  module BatchActions

    # Creates the toggle checkbox used to toggle the collection selection on/off
    class ResourceSelectionToggleCell < ActiveAdmin::Component
      builder_method :resource_selection_toggle_cell

      def build(label_text = "")
        label do
          input type: "checkbox", id: "collection_selection_toggle_all", name: "collection_selection_toggle_all", class: "toggle_all"
          text_node label_text if label_text.present?
        end
      end
    end

    # Creates the checkbox used to select a resource in the collection selection
    class ResourceSelectionCell < ActiveAdmin::Component
      builder_method :resource_selection_cell

      def build(resource)
        input type: "checkbox", id: "batch_action_item_#{resource.id}", value: resource.id, class: "collection_selection", name: "collection_selection[]"
      end
    end

    # Creates a wrapper panel for all index pages, except for the table, as the table has the checkbox in the thead
    class ResourceSelectionTogglePanel < ActiveAdmin::Component
      builder_method :resource_selection_toggle_panel

      def build
        super(id: "collection_selection_toggle_panel")
        resource_selection_toggle_cell(I18n.t("active_admin.batch_actions.selection_toggle_explanation", default: "(Toggle Selection)"))
      end
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
activeadmin-3.2.5 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-3.2.4 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-3.2.3 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-3.2.2 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-3.2.1 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-3.2.0 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-3.1.0 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-3.0.0 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-2.14.0 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-2.13.1 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-2.13.0 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-2.12.0 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-2.11.2 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-2.11.1 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-2.11.0 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-2.10.1 lib/active_admin/batch_actions/views/selection_cells.rb
activeadmin-2.10.0 lib/active_admin/batch_actions/views/selection_cells.rb