Module: JqueryUiForm::Helpers::LabelHelper
- Included in:
- FormBuilder
- Defined in:
- lib/jquery_ui_form/helpers/label_helper.rb
Instance Method Summary collapse
-
#label(method, text = nil, options = {}) ⇒ Object
include ActionView::Helpers::FormHelper.
- #label_text(method, text, options = {}) ⇒ Object
Instance Method Details
#label(method, text = nil, options = {}) ⇒ Object
include ActionView::Helpers::FormHelper
6 7 8 9 10 11 |
# File 'lib/jquery_ui_form/helpers/label_helper.rb', line 6 def label(method, text = nil, = {}) text, = label_text(method, text, ) super(method,"#{text}:".html_safe, ) end |
#label_text(method, text, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/jquery_ui_form/helpers/label_helper.rb', line 13 def label_text(method, text, ={}) if text.is_a?(Hash) .merge!(text) text = nil end text = .delete(:label) if text.blank? if text.blank? if use_i18n text = I18n.t("#{@object_name.to_s.downcase}.#{method.to_s.downcase}",:scope => [:activerecord, :attributes]) else text = method.to_s.humanize end end if .delete(:required) text << (required_string.is_a?(Proc) ? required_string.call : required_string) end [text, ] end |