16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/rack-validate/validator.rb', line 16
def self.generate_report( issues )
report = ""
report << STYLES
report << SCRIPT
report << "<div id='message_toolbar'>"
report << '<div id="controls">'
summary = "<span>There were " + issues.errors.size.to_s + " errors and " + issues.warnings.size.to_s + " warnings</span><br/><br/>"
report << summary
report << LINKS
report << '</div>'
if !issues.errors.empty?
report << "<table id='errors_table' style='display:none;'>"
report << "<tr><td colspan='2' class='header_column'>Errors</td></tr>"
issues.errors.each do |item|
report << "<tr><td class='line_number_column'>Line #{item.line}</td><td class='message_column'>#{html_escape( item.message )}</td></tr>"
end
report << "</table>"
end
if !issues.warnings.empty?
report << "<table id='warnings_table' style='display:none;'>"
report << "<tr><td colspan='2' class='header_column'>Warnings</td></tr>"
issues.warnings.each do |item|
report << "<tr><td class='line_number_column'>--</td><td class='message_column'>#{html_escape( item.message )}</td></tr>"
end
report << "</table>"
end
report << "</div>"
end
|