Class: ExpressTemplates::Components::Forms::Checkbox

Inherits:
FormComponent show all
Defined in:
lib/express_templates/components/forms/checkbox.rb

Instance Attribute Summary

Attributes inherited from FormComponent

#input_attributes

Instance Method Summary collapse

Methods inherited from FormComponent

#field_name, #field_name_attribute, #label_name, #label_text, #parent_form, #resource_class, #resource_name, #resource_var

Methods inherited from Configurable

#build, #config, emits, has_argument, has_option, #required_options

Methods inherited from Base

before_build, #build, builder_method_and_class, #builder_method_name, builder_method_name, contains, descendants, has_attributes, inherited, #initialize, #resource, tag

Constructor Details

This class inherits a constructor from ExpressTemplates::Components::Base

Instance Method Details

#checked_valueObject



26
27
28
# File 'lib/express_templates/components/forms/checkbox.rb', line 26

def checked_value
  "1"
end

#field_optionsObject



22
23
24
# File 'lib/express_templates/components/forms/checkbox.rb', line 22

def field_options
  {}
end

#label_after?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/express_templates/components/forms/checkbox.rb', line 18

def label_after?
  !!config[:label_after]
end

#label_before?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/express_templates/components/forms/checkbox.rb', line 14

def label_before?
  !label_after?
end

#unchecked_valueObject



30
31
32
# File 'lib/express_templates/components/forms/checkbox.rb', line 30

def unchecked_value
  "0"
end