Module: Trestle::Form::Fields::CheckBoxHelpers

Included in:
CheckBox, CollectionCheckBoxes
Defined in:
lib/trestle/form/fields/check_box_helpers.rb

Instance Method Summary collapse

Instance Method Details

#default_wrapper_classObject



13
14
15
16
17
18
19
# File 'lib/trestle/form/fields/check_box_helpers.rb', line 13

def default_wrapper_class
  [
    "form-check",
    ("form-switch" if switch?),
    ("form-check-inline" if inline?)
  ].compact
end

#defaultsObject



29
30
31
# File 'lib/trestle/form/fields/check_box_helpers.rb', line 29

def defaults
  Trestle::Options.new(disabled: readonly?)
end

#inline?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/trestle/form/fields/check_box_helpers.rb', line 9

def inline?
  options[:inline]
end

#input_classObject



21
22
23
# File 'lib/trestle/form/fields/check_box_helpers.rb', line 21

def input_class
  ["form-check-input"]
end

#label_classObject



25
26
27
# File 'lib/trestle/form/fields/check_box_helpers.rb', line 25

def label_class
  ["form-check-label"]
end

#switch?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/trestle/form/fields/check_box_helpers.rb', line 5

def switch?
  options[:switch]
end