Module: Releaf::Builders::FormBuilder::Label
- Included in:
- Releaf::Builders::FormBuilder
- Defined in:
- app/builders/releaf/builders/form_builder/label.rb
Instance Method Summary collapse
- #label_attributes(_name, attributes, _options) ⇒ Object
- #label_text(name, options = {}) ⇒ Object
- #releaf_label(name, attributes, options = {}) ⇒ Object
Instance Method Details
#label_attributes(_name, attributes, _options) ⇒ Object
31 32 33 |
# File 'app/builders/releaf/builders/form_builder/label.rb', line 31 def label_attributes(_name, attributes, ) attributes end |
#label_text(name, options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/builders/releaf/builders/form_builder/label.rb', line 17 def label_text(name, = {}) if [:label_text].present? [:label_text] else if [:translation_key].present? key = [:translation_key] else key = name.to_s.sub(/_uid$/, '') end translate_attribute(key) end end |
#releaf_label(name, attributes, options = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/builders/releaf/builders/form_builder/label.rb', line 2 def releaf_label(name, attributes, = {}) = .fetch(:label, {}) attributes = label_attributes(name, attributes, ) text = label_text(name, ) content = label(name, text, attributes) if .fetch(:minimal, false) == true content else content += wrapper([:description], class: "description") if .fetch(:description, nil).present? wrapper(content, class: "label-wrap") end end |