diff options
author | francis <francis> | 2008-02-12 01:37:25 +0000 |
---|---|---|
committer | francis <francis> | 2008-02-12 01:37:25 +0000 |
commit | 297eccfeda529bd8a99bde1c5fe62edf36384cee (patch) | |
tree | 0aca387eb317df00c920e3b458728b77ce9a532a | |
parent | 3fd61dd559b1f2c656b793829f0181ed640abfe2 (diff) |
Fix lots of HTML validation errors.
-rw-r--r-- | app/views/admin_public_body/edit.rhtml | 2 | ||||
-rw-r--r-- | app/views/admin_public_body/list.rhtml | 2 | ||||
-rw-r--r-- | app/views/admin_public_body/new.rhtml | 2 | ||||
-rw-r--r-- | app/views/admin_public_body/show.rhtml | 4 | ||||
-rw-r--r-- | app/views/admin_request/show.rhtml | 2 | ||||
-rw-r--r-- | app/views/admin_user/show.rhtml | 2 | ||||
-rw-r--r-- | app/views/body/show.rhtml | 4 | ||||
-rw-r--r-- | app/views/layouts/admin.rhtml | 42 | ||||
-rw-r--r-- | app/views/request/_bubble.rhtml | 8 | ||||
-rw-r--r-- | app/views/request/_correspondence.rhtml | 2 | ||||
-rw-r--r-- | app/views/request/_followup.rhtml | 8 | ||||
-rw-r--r-- | app/views/request/show.rhtml | 4 | ||||
-rw-r--r-- | public/stylesheets/main.css | 2 | ||||
-rw-r--r-- | spec/spec_helper.rb | 41 | ||||
-rw-r--r-- | todo.txt | 4 |
15 files changed, 67 insertions, 62 deletions
diff --git a/app/views/admin_public_body/edit.rhtml b/app/views/admin_public_body/edit.rhtml index b38ff02b3..d0b0d85fb 100644 --- a/app/views/admin_public_body/edit.rhtml +++ b/app/views/admin_public_body/edit.rhtml @@ -4,7 +4,7 @@ <% form_tag '../update/' + @public_body.id.to_s do %> <%= render :partial => 'form' %> - <%= submit_tag 'Save' %> + <p><%= submit_tag 'Save' %></p> <% end %> <p> diff --git a/app/views/admin_public_body/list.rhtml b/app/views/admin_public_body/list.rhtml index 27ae929f8..b331b5914 100644 --- a/app/views/admin_public_body/list.rhtml +++ b/app/views/admin_public_body/list.rhtml @@ -23,5 +23,3 @@ <%= will_paginate(@public_bodies) %> -<br /> - diff --git a/app/views/admin_public_body/new.rhtml b/app/views/admin_public_body/new.rhtml index 111320512..1b8cd48a0 100644 --- a/app/views/admin_public_body/new.rhtml +++ b/app/views/admin_public_body/new.rhtml @@ -4,7 +4,7 @@ <% form_tag 'create' do %> <%= render :partial => 'form' %> - <%= submit_tag "Create" %> + <p><%= submit_tag "Create" %></p> <% end %> <p> diff --git a/app/views/admin_public_body/show.rhtml b/app/views/admin_public_body/show.rhtml index a8c8dfa5e..ae8ae2774 100644 --- a/app/views/admin_public_body/show.rhtml +++ b/app/views/admin_public_body/show.rhtml @@ -9,8 +9,8 @@ <% end %> </p> -<%= link_to 'Edit', '../edit/' + @public_body.id.to_s %> -| <%= link_to 'Public page', main_url(public_body_url(@public_body)) %> +<p><%= link_to 'Edit', '../edit/' + @public_body.id.to_s %> +| <%= link_to 'Public page', main_url(public_body_url(@public_body)) %></p> <h2>History</h2> <table border="1"> diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml index 0453e4ce8..e950c4349 100644 --- a/app/views/admin_request/show.rhtml +++ b/app/views/admin_request/show.rhtml @@ -13,7 +13,7 @@ <strong>Envelope email address:</strong> <%=h @info_request.envelope_email %> <br> </p> -<%= link_to 'Public page', main_url(request_url(@info_request)) %> +<p><%= link_to 'Public page', main_url(request_url(@info_request)) %></p> <h2>Outgoing messages</h2> diff --git a/app/views/admin_user/show.rhtml b/app/views/admin_user/show.rhtml index 7dbc5377a..82681dc79 100644 --- a/app/views/admin_user/show.rhtml +++ b/app/views/admin_user/show.rhtml @@ -15,6 +15,6 @@ <% end %> </p> -<%= link_to 'Public page', main_url(user_url(@admin_user)) %> +<p><%= link_to 'Public page', main_url(user_url(@admin_user)) %></p> diff --git a/app/views/body/show.rhtml b/app/views/body/show.rhtml index 7b5a905fa..44677548e 100644 --- a/app/views/body/show.rhtml +++ b/app/views/body/show.rhtml @@ -7,8 +7,10 @@ A public body in the UK, also called <%= h(@public_body.short_name) %> </p> <% form_for(:info_request, @info_request, :url => new_request_url, :html => { :id => 'public_body_form' } ) do |f| %> + <p> <%= f.hidden_field(:public_body_id, { :value => @public_body.id } ) %> - <p><%= submit_tag "Make new FOI request to " + @public_body.short_name %></p> + <%= submit_tag "Make new FOI request to " + @public_body.short_name %> + </p> <% end %> <% if @public_body.info_requests.empty? %> diff --git a/app/views/layouts/admin.rhtml b/app/views/layouts/admin.rhtml index cdbd37219..71618f755 100644 --- a/app/views/layouts/admin.rhtml +++ b/app/views/layouts/admin.rhtml @@ -1,27 +1,25 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html lang="en-gb"> + <head> + <meta http-equiv="content-type" content="text/html;charset=UTF-8" > + <title>FOIFA admin<%= @title ? ":" : "" %> <%=@title%></title> + <% + # Have to do explicit tag for stylesheet, to get absolute path on main server + %> + <%= tag("link", { "rel" => "Stylesheet", "type" => "text/css", "media" => "screen", "href" => admin_public_url(stylesheet_path('admin')) }) %> + <%= tag("link", { "rel" => "Stylesheet", "type" => "text/css", "media" => "screen", "href" => admin_public_url(stylesheet_path('scaffold')) }) %> + </head> + <body> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> - <title>FOIFA admin<%= @title ? ":" : "" %> <%=@title%></title> - <% - # Have to do explicit tag for stylesheet, to get absolute path on main server - %> - <%= tag("link", { "rel" => "Stylesheet", "type" => "text/css", "media" => "screen", "href" => admin_public_url(stylesheet_path('admin')) }) %> - <%= tag("link", { "rel" => "Stylesheet", "type" => "text/css", "media" => "screen", "href" => admin_public_url(stylesheet_path('scaffold')) }) %> -</head> -<body> + <p><b>FOIFA admin interface:</b> + <%= link_to 'Public bodies', admin_url('body/list') %> + | <%= link_to 'Requests', admin_url('request/list') %> + | <%= link_to 'Users', admin_url('user/list') %> + </p> -<p><b>FOIFA admin interface:</b> -<%= link_to 'Public bodies', admin_url('body/list') %> -| <%= link_to 'Requests', admin_url('request/list') %> -| <%= link_to 'Users', admin_url('user/list') %> -</p> + <p style="color: green"><%= flash[:notice] %></p> -<p style="color: green"><%= flash[:notice] %></p> + <%= yield %> -<%= yield %> - -</body> + </body> </html> diff --git a/app/views/request/_bubble.rhtml b/app/views/request/_bubble.rhtml index 5ac9d95af..c8ee1dbd8 100644 --- a/app/views/request/_bubble.rhtml +++ b/app/views/request/_bubble.rhtml @@ -1,5 +1,7 @@ <blockquote class="xsnazzy"> - <b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b> + <div> + <strong class="xb1"></strong><strong class="xb2"></strong><strong class="xb3"></strong><strong class="xb4"></strong><strong class="xb5"></strong><strong class="xb6"></strong><strong class="xb7"></strong> + </div> <div class="xboxcontent"> <% if not attachments.nil? and attachments.size > 0 %> <p> <% attachments.each do |a| %> @@ -18,9 +20,11 @@ <% end %> <p><%= body %></p> </div> - <b class="xb7"></b><b class="xb6"></b><b class="xb5"></b><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b> + <div> + <strong class="xb7"></strong><strong class="xb6"></strong><strong class="xb5"></strong><strong class="xb4"></strong><strong class="xb3"></strong><strong class="xb2"></strong><strong class="xb1"></strong> <em></em> <span class="bubblebit"></span> + </div> </blockquote> diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml index d283a1acb..d8b8887a8 100644 --- a/app/views/request/_correspondence.rhtml +++ b/app/views/request/_correspondence.rhtml @@ -1,4 +1,4 @@ -<div id="correspondence"> +<div class="correspondence"> <% diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.rhtml index 8266661c9..3f6f5322d 100644 --- a/app/views/request/_followup.rhtml +++ b/app/views/request/_followup.rhtml @@ -7,7 +7,7 @@ </h2> <p>Use this if the public body has asked for clarification of - your request. + your request.</p> <% form_for(:outgoing_message, @outgoing_message) do |o| %> <p> @@ -19,8 +19,10 @@ to it, will also be displayed publically on this website. </p> - <%= hidden_field_tag 'submitted_followup', 1 %> - <%= submit_tag "Send >>" %> + <p> + <%= hidden_field_tag 'submitted_followup', 1 %> + <%= submit_tag "Send >>" %> + </p> <% end %> <p> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index f10e36ccd..fd2455475 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -1,7 +1,7 @@ <% @title = h(@info_request.title) %> <% if @info_request.awaiting_description %> - <div id="describe_state_form"> + <div class="describe_state_form"> <%= render :partial => 'describe_state' %> </div> <% end %> @@ -64,7 +64,7 @@ </div> <% if @info_request.awaiting_description %> - <div id="describe_state_form"> + <div class="describe_state_form"> <%= render :partial => 'describe_state' %> </div> <% end %> diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index 0d41bafa7..47e162d34 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -300,7 +300,7 @@ table#list_requests .odd { /* /describe_state - user setting status of request */ -#describe_state_form { +.describe_state_form { clear: both; background-color: #eeffee; border: solid 1px #00cc00; diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7ac73dac2..360b2f38b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -31,30 +31,31 @@ def receive_incoming_mail(email_name, email_to) end # Monkeypatch! Validate HTML in tests. -$tempfilecount = 0 -module ActionController - module TestProcess - alias :original_process :process - - def process(action, parameters = nil, session = nil, flash = nil) - # Call original process function - self.original_process(action, parameters, session, flash) - - # And then validate if HTML - if @response.content_type == "text/html" and @response.response_code != 302 - $tempfilecount = $tempfilecount + 1 - tempfilename = File.join(Dir::tmpdir, "railshtmlvalidate."+$$.to_s+"."+$tempfilecount.to_s+".html") - File.open(tempfilename, "w+") do |f| - f.puts @response.body +if $tempfilecount.nil? + $tempfilecount = 0 + module ActionController + module TestProcess + alias :original_process :process + + def process(action, parameters = nil, session = nil, flash = nil) + # Call original process function + self.original_process(action, parameters, session, flash) + + # And then validate if HTML + if @response.content_type == "text/html" and @response.response_code != 302 + $tempfilecount = $tempfilecount + 1 + tempfilename = File.join(Dir::tmpdir, "railshtmlvalidate."+$$.to_s+"."+$tempfilecount.to_s+".html") + File.open(tempfilename, "w+") do |f| + f.puts @response.body + end + if not system("/usr/bin/validate", tempfilename) + raise "HTML validation error in " + tempfilename + " HTTP status: " + @response.response_code.to_s + end + File.unlink(tempfilename) end - if not system("/usr/bin/validate", tempfilename) - raise "HTML validation error in " + tempfilename + " HTTP status: " + @response.response_code.to_s - end - File.unlink(tempfilename) end end end end - @@ -59,9 +59,9 @@ Consider removing login links from notifications of new responses Tidying ======= +HTML validation - make it properly optional is /usr/bin/validate present + Work out how to get it to tell you code coverage of .rhtml files -Make it validate the HTML - maybe with http://www.anodyne.ca/wp-content/uploads/2007/09/be_valid_xhtml.rb Test that it is actually sending the request outgoing mail, by using deliveries Test sending a message to bounce/envelope-from address |