Class: Locomotive::ToggleInput

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

Instance Method Summary collapse

Methods included from SimpleForm::Inputs::FasterTranslate

#translate_from_namespace

Instance Method Details

#input(wrapper_options) ⇒ Object



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

def input(wrapper_options)
  template.(:div, class: 'toggle-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



18
19
20
# File 'app/inputs/locomotive/toggle_input.rb', line 18

def text(name)
  I18n.t(name, scope: 'locomotive.inputs.toggle')
end