Module: Trestle::Form::Fields::RadioButtonHelpers

Included in:
CollectionRadioButtons, RadioButton
Defined in:
lib/trestle/form/fields/radio_button_helpers.rb

Instance Method Summary collapse

Instance Method Details

#custom?Boolean

Returns:

  • (Boolean)


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

def custom?
  options[:custom] != false
end

#default_wrapper_classObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/trestle/form/fields/radio_button_helpers.rb', line 13

def default_wrapper_class
  if custom?
    [
      "custom-control",
      "custom-radio",
      ("custom-control-inline" if inline?)
    ].compact
  else
    [
      "form-check",
      ("form-check-inline" if inline?)
  ].compact
  end
end

#inline?Boolean

Returns:

  • (Boolean)


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

def inline?
  options[:inline]
end

#input_classObject



28
29
30
# File 'lib/trestle/form/fields/radio_button_helpers.rb', line 28

def input_class
  custom? ? ["custom-control-input"] : ["form-check-input"]
end

#label_classObject



32
33
34
# File 'lib/trestle/form/fields/radio_button_helpers.rb', line 32

def label_class
  custom? ? ["custom-control-label"] : ["form-check-label"]
end