Class: Locomotive::ToggleInput

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

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options) ⇒ Object



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

def input(wrapper_options)
  template.(:span, class: 'form-wrapper') do
    @builder.check_box attribute_name, data: {
      'on-text'   => text(:on_text),
      'off-text'  => text(:off_text),
      'on-color'  => 'success',
      'off-color' => 'danger',
      'size'      => 'small'
    }
  end
end

#text(name) ⇒ Object



16
17
18
# File 'app/inputs/locomotive/toggle_input.rb', line 16

def text(name)
  I18n.t(name, scope: 'locomotive.shared.form.toggle_input')
end