Class: ActiveAdmin::BatchActions::BatchActionForm

Inherits:
Component
  • Object
show all
Defined in:
lib/active_admin/batch_actions/views/batch_action_form.rb

Overview

Build a BatchActionForm

Instance Method Summary collapse

Instance Method Details

#build(options = {}, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/active_admin/batch_actions/views/batch_action_form.rb', line 10

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

#to_sObject

Override the default to_s to include a closing form tag



24
25
26
# File 'lib/active_admin/batch_actions/views/batch_action_form.rb', line 24

def to_s
  content + closing_form_tag
end