Class: ActionView::Helpers::FormBuilder
- Inherits:
-
Object
- Object
- ActionView::Helpers::FormBuilder
- Defined in:
- lib/required_field_style.rb
Instance Method Summary collapse
-
#label(method, content_or_options = nil, options = nil, &block) ⇒ Object
add a ‘*’ after the field label if the field is required and no configuration.
- #orig_label ⇒ Object
Instance Method Details
#label(method, content_or_options = nil, options = nil, &block) ⇒ Object
add a ‘*’ after the field label if the field is required and no configuration
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/required_field_style.rb', line 11 def label(method, = nil, = nil, &block) if && .class == Hash = else content = end if ValidationChecker.mandatory_field?(object.class, method) if RequiredFieldStyle.configuration.css_class_name.blank? content ||= method.to_s.humanize content = content + '<sup style="color:red"> *</sup>'.html_safe else = {:class => RequiredFieldStyle.configuration.css_class_name} end end self.orig_label(method, content, || {}, &block) end |
#orig_label ⇒ Object
8 |
# File 'lib/required_field_style.rb', line 8 alias :orig_label :label |