Class: ActionAdmin::ToggleInput

Inherits:
SimpleForm::Inputs::BooleanInput
  • Object
show all
Defined in:
app/inputs/action_admin/toggle_input.rb

Instance Method Summary collapse

Instance Method Details

#field_input(wrapper_options) ⇒ Object



24
25
26
# File 'app/inputs/action_admin/toggle_input.rb', line 24

def field_input(wrapper_options)
   :div, input(wrapper_options) + label(wrapper_options), class: 'switch tiny'
end

#field_nameObject



28
29
30
# File 'app/inputs/action_admin/toggle_input.rb', line 28

def field_name
   :label, @initial_label_text
end

#input(wrapper_options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'app/inputs/action_admin/toggle_input.rb', line 3

def input(wrapper_options)
  @initial_label_text = raw_label_text

  input_html_options[:class] ||= []
  input_html_options[:class] << 'switch-input'

  options[:label_html] = { class: 'switch-paddle' }
  options[:label]      =  :span, raw_label_text, class: 'show-for-sr'

  super
end

#label_input(wrapper_options) ⇒ Object



15
16
17
18
19
20
21
22
# File 'app/inputs/action_admin/toggle_input.rb', line 15

def label_input(wrapper_options)
  field_html = field_input(wrapper_options)

  template. :div, class: 'grid-x' do
    template.concat (:div, field_name, class: 'cell auto')
    template.concat (:div, field_html, class: 'cell shrink')
  end
end

#nested_boolean_style?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/inputs/action_admin/toggle_input.rb', line 32

def nested_boolean_style?
  false
end