Class: FormErrorsWidget

Inherits:
Cuca::Widget show all
Includes:
Cuca::Generator::Markaby
Defined in:
lib/cuca/stdlib/formerrors.rb

Overview

this widget you can use within a form to display all form errors

Instance Method Summary collapse

Methods included from Cuca::Generator::Markaby

#mab, #mabtext

Methods inherited from Cuca::Widget

#app, #cgi, #clear, clear_hints, #content, #content=, #controller, define_attr_method, #escape, #escapeHTML, #get_assigns, #hints, #initialize, #log, #params, #query_parameters, #request_method, #request_parameters, run_attr_method, #session, #to_s, #unescape, #unescapeHTML

Constructor Details

This class inherits a constructor from Cuca::Widget

Instance Method Details

#output(form_errors, title = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cuca/stdlib/formerrors.rb', line 8

def output(form_errors, title = nil)
  return if form_errors.empty?
  mab {
    b title ? title : "Form contains errors"
    ul {
     form_errors.each_pair { |name, value| 
        li { b {name}; text " - #{value}" }
     }
    }
  }
end