module Trestle::Form::Fields::CheckBoxHelpers

Public Instance Methods

custom?() click to toggle source
# File lib/trestle/form/fields/check_box_helpers.rb, line 5
def custom?
  options[:custom] != false
end
default_wrapper_class() click to toggle source
# File lib/trestle/form/fields/check_box_helpers.rb, line 17
def default_wrapper_class
  if custom?
    [
      "custom-control",
      switch? ? "custom-switch" : "custom-checkbox",
      ("custom-control-inline" if inline?)
    ].compact
  else
    [
      "form-check",
      ("form-check-inline" if inline?)
    ].compact
  end
end
defaults() click to toggle source
# File lib/trestle/form/fields/check_box_helpers.rb, line 40
def defaults
  Trestle::Options.new(disabled: readonly?)
end
inline?() click to toggle source
# File lib/trestle/form/fields/check_box_helpers.rb, line 13
def inline?
  options[:inline]
end
input_class() click to toggle source
# File lib/trestle/form/fields/check_box_helpers.rb, line 32
def input_class
  custom? ? ["custom-control-input"] : ["form-check-input"]
end
label_class() click to toggle source
# File lib/trestle/form/fields/check_box_helpers.rb, line 36
def label_class
  custom? ? ["custom-control-label"] : ["form-check-label"]
end
switch?() click to toggle source
# File lib/trestle/form/fields/check_box_helpers.rb, line 9
def switch?
  options[:switch]
end