Module: JqueryUiForm::Helpers::ErrorHelper
- Included in:
- FormBuilder
- Defined in:
- lib/jquery_ui_form/helpers/error_helper.rb
Instance Method Summary collapse
- #error_message_on(method) ⇒ Object
- #error_messages_on_base ⇒ Object
- #has_errors?(method) ⇒ Boolean
- #inline_error(method) ⇒ Object
- #model_errors(errors = []) ⇒ Object
Instance Method Details
#error_message_on(method) ⇒ Object
9 10 11 |
# File 'lib/jquery_ui_form/helpers/error_helper.rb', line 9 def (method) @object.errors[method.to_sym].join(" #{use_i18n ? I18n.t('and') : 'and'} ") end |
#error_messages_on_base ⇒ Object
13 14 15 |
# File 'lib/jquery_ui_form/helpers/error_helper.rb', line 13 def @object.errors[:base] end |
#has_errors?(method) ⇒ Boolean
5 6 7 |
# File 'lib/jquery_ui_form/helpers/error_helper.rb', line 5 def has_errors?(method) @object && @object.respond_to?(:errors) && !@object.errors[method.to_sym].blank? end |
#inline_error(method) ⇒ Object
17 18 19 20 |
# File 'lib/jquery_ui_form/helpers/error_helper.rb', line 17 def inline_error(method) return "" unless has_errors?(method) template.content_tag(:div, (method), :class => "ui-input-error-message") end |
#model_errors(errors = []) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jquery_ui_form/helpers/error_helper.rb', line 22 def model_errors(errors=[]) errors = .to_a + errors.to_a return "" if errors.empty? template.content_tag(:div, :class => "ui-base-error-messages") do errors.each do || template.concat( template.content_tag(:p) do template.concat(template.content_tag(:span, "", :class => "ui-icon ui-icon-alert")) template.concat(template.content_tag(:strong, )) end ) end end end |