Sha256: c5438ea12c2dfe212f18177eb28adaf07804767cc97d0d2f104b92e4ae660689

Contents?: true

Size: 995 Bytes

Versions: 12

Compression:

Stored size: 995 Bytes

Contents

# frozen_string_literal: true
require "active_admin/component"

module ActiveAdmin
  module BatchActions
    # Build a BatchActionForm
    class BatchActionForm < ActiveAdmin::Component
      def build(options = {}, &block)
        options[:id] ||= "collection_selection"

        # Open a form with two hidden input fields:
        # batch_action        => name of the specific action called
        # batch_action_inputs => a JSON string of any requested confirmation values
        text_node form_tag active_admin_config.route_batch_action_path(params, url_options), id: options[:id]
        input name: :batch_action, id: :batch_action, type: :hidden
        input name: :batch_action_inputs, id: :batch_action_inputs, type: :hidden

        super(options)
      end

      # Override the default to_s to include a closing form tag
      def to_s
        content + closing_form_tag
      end

      private

      def closing_form_tag
        "</form>".html_safe
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
activeadmin-4.0.0.beta12 lib/active_admin/batch_actions/views/batch_action_form.rb
activeadmin-4.0.0.beta11 lib/active_admin/batch_actions/views/batch_action_form.rb
activeadmin-4.0.0.beta10 lib/active_admin/batch_actions/views/batch_action_form.rb
activeadmin-4.0.0.beta9 lib/active_admin/batch_actions/views/batch_action_form.rb
activeadmin-4.0.0.beta8 lib/active_admin/batch_actions/views/batch_action_form.rb
activeadmin-4.0.0.beta7 lib/active_admin/batch_actions/views/batch_action_form.rb
activeadmin-4.0.0.beta6 lib/active_admin/batch_actions/views/batch_action_form.rb
activeadmin-4.0.0.beta5 lib/active_admin/batch_actions/views/batch_action_form.rb
activeadmin-4.0.0.beta4 lib/active_admin/batch_actions/views/batch_action_form.rb
activeadmin-4.0.0.beta3 lib/active_admin/batch_actions/views/batch_action_form.rb
activeadmin-4.0.0.beta2 lib/active_admin/batch_actions/views/batch_action_form.rb
activeadmin-4.0.0.beta1 lib/active_admin/batch_actions/views/batch_action_form.rb