Sha256: 9715dde8830f08ddd90e99470d1be50a66a10dd7d270c4b3a583357005a3a25e
Contents?: true
Size: 1.12 KB
Versions: 5
Compression:
Stored size: 1.12 KB
Contents
module JqueryUiForm module Helpers module ErrorHelper def has_errors?(method) @object && @object.respond_to?(:errors) && !@object.errors[method.to_sym].blank? end def error_message_on(method) @object.errors[method.to_sym] end def error_messages_on_base @object.errors[:base] end def inline_error(method) return "" unless has_errors?(method) template.content_tag(:div, error_message_on(method), :class => "ui-input-error-message") end def model_errors(errors=[]) errors = error_messages_on_base.to_a + errors.to_a return "" if errors.empty? template.content_tag(:div, :class => "ui-base-error-messages") do errors.each do |message| 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, message)) end ) end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems