Module: SimpleForm::Components::Labels
- Included in:
- Inputs::Base
- Defined in:
- lib/simple_form/components/labels.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/simple_form/components/labels.rb', line 4 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#label ⇒ Object
26 27 28 |
# File 'lib/simple_form/components/labels.rb', line 26 def label @builder.label(label_target, label_text, ) end |
#label_html_options ⇒ Object
39 40 41 42 43 |
# File 'lib/simple_form/components/labels.rb', line 39 def = (:label, input_type, required_class) [:for] = [:input_html][:id] if .key?(:input_html) end |
#label_target ⇒ Object
35 36 37 |
# File 'lib/simple_form/components/labels.rb', line 35 def label_target attribute_name end |
#label_text ⇒ Object
30 31 32 33 |
# File 'lib/simple_form/components/labels.rb', line 30 def label_text result = SimpleForm.label_text.call(raw_label_text, required_label_text) result.respond_to?(:html_safe) ? result.html_safe : result end |