module Zena module Use module ErrorRendering module Common #TODO: test def error_messages_for(type, opts={}) super unless type == 'node' obj = opts[:object] return '' if obj.errors.empty? res = [""] obj.errors.each_error do |er,msg| res << "" end res << '
#{er}#{_(msg)}
' res.join("\n") end # TODO: test (where is this used ? discussions, ?) def processing_error(msg) # (this method used to be called add_error, but it messed up with 'test/unit/testcase.rb' when testing helpers) @errors ||= [] @errors << _(msg) end # TODO: test def render_errors(errs=@errors) if !errs || errs.empty? "" elsif errs.kind_of?(ActiveRecord::Errors) res = "" errs.each do |k,v| res << "\n" end res << "
#{k}#{v}
" res else "\n
#{errs.join("
")}
" end end end # Common module ControllerMethods include Common end module ViewMethods include Common end end # ErrorRendering end # Use end # Zena