Class: Trestle::Mobility::Fields::CheckBox

Inherits:
Form::Fields::CheckBox
  • Object
show all
Defined in:
lib/trestle/mobility/fields/check_box.rb

Instance Method Summary collapse

Instance Method Details

#fieldObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/trestle/mobility/fields/check_box.rb', line 5

def field
  label = options[:label] || name.to_s.humanize
  locales = options[:locales] || I18n.available_locales.sort
  selected = options[:selected] || Trestle.config.mobility.selected.call || locales.first

  @template.render partial: "trestle/mobility/check_box",
                   locals: {
                     field_name: name,
                     label: label,
                     locales: locales,
                     selected: selected
                   }
end