aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/foi_attachment.rb3
-rw-r--r--app/views/admin_general/index.rhtml2
-rw-r--r--app/views/admin_general/stats.rhtml4
-rw-r--r--app/views/admin_public_body/_one_list.rhtml44
-rw-r--r--app/views/admin_public_body/list.rhtml3
-rw-r--r--app/views/admin_request/_incoming_message_actions.rhtml26
-rw-r--r--app/views/admin_request/list.rhtml2
-rw-r--r--app/views/admin_request/show.rhtml235
-rw-r--r--app/views/admin_request/show_raw_email.rhtml8
-rw-r--r--app/views/admin_track/list.rhtml2
-rw-r--r--app/views/admin_user/list.rhtml2
-rw-r--r--app/views/comment/new.rhtml6
-rw-r--r--app/views/general/blog.rhtml2
-rw-r--r--app/views/help/api.rhtml10
-rw-r--r--app/views/help/officers.rhtml5
-rw-r--r--app/views/layouts/admin.rhtml2
-rw-r--r--app/views/layouts/default.rhtml3
-rw-r--r--app/views/layouts/no_chrome.rhtml3
-rw-r--r--app/views/request/_describe_state.rhtml6
-rw-r--r--app/views/request/_sidebar.rhtml11
-rw-r--r--app/views/request/new.rhtml2
-rw-r--r--config/environment.rb1
-rw-r--r--lib/make_html_4_compliant.rb8
-rw-r--r--public/down.default.html3
-rw-r--r--public/stylesheets/main.css4
-rw-r--r--spec/spec_helper.rb67
-rw-r--r--spec/views/public_body/show.rhtml_spec.rb5
27 files changed, 195 insertions, 274 deletions
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index 723bc4abb..bba0b6a8d 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -317,8 +317,7 @@ class FoiAttachment < ActiveRecord::Base
text = CGI.escapeHTML(text)
text = MySociety::Format.make_clickable(text)
html = text.gsub(/\n/, '<br>')
- return '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd"><html><head><title></title></head><body>' + html + "</body></html>", wrapper_id
+ return '<!DOCTYPE html><html><head><title></title></head><body>' + html + "</body></html>", wrapper_id
end
# the extractions will also produce image files, which go in the
diff --git a/app/views/admin_general/index.rhtml b/app/views/admin_general/index.rhtml
index cf4bc4312..74d0f92f8 100644
--- a/app/views/admin_general/index.rhtml
+++ b/app/views/admin_general/index.rhtml
@@ -166,7 +166,7 @@
<tr>
<td class="link">
<%= link_to("<i class='icon-tags'></i>".html_safe, admin_request_show_path(@request)) %>
- <%= link_to(@request.title, request_link(@request)) %>
+ <%= link_to(@request.title, request_path(@request)) %>
</td>
<td class="span2">
<%=simple_date(@request.get_last_response_event.created_at)%>
diff --git a/app/views/admin_general/stats.rhtml b/app/views/admin_general/stats.rhtml
index 277df5437..27dc25ee0 100644
--- a/app/views/admin_general/stats.rhtml
+++ b/app/views/admin_general/stats.rhtml
@@ -10,7 +10,7 @@
<div class="span12">
<h1>Statistics</h1>
<h2>Chart of requests (excluding backpaged)</h2>
- <img src="/foi-live-creation.png">
+ <img src="/foi-live-creation.png" alt="Chart of requests">
</div>
</div>
<div class="row">
@@ -33,7 +33,7 @@
<div class="row">
<div class="span12">
<h2>Chart of users</h2>
- <img src="/foi-user-use.png">
+ <img src="/foi-user-use.png" alt="Chart of users">
</div>
</div>
<div class="row">
diff --git a/app/views/admin_public_body/_one_list.rhtml b/app/views/admin_public_body/_one_list.rhtml
index cf1866212..c867433a0 100644
--- a/app/views/admin_public_body/_one_list.rhtml
+++ b/app/views/admin_public_body/_one_list.rhtml
@@ -2,31 +2,30 @@
<% for public_body in bodies %>
<div class="accordion-group">
<div class="accordion-heading accordion-toggle row">
- <span class="item-title span6">
- <a href="#body_<%=public_body.id%>" data-toggle="collapse" data-parent="requests"><i class="icon-chevron-right"></i></a>
- <%= link_to(public_body.name, admin_body_show_path(public_body), :title => "view full details")%>
- </span>
- <span class="item-metadata span6">
- <%= render :partial => 'tags', :locals => { :body => public_body} %>
- </span>
+ <span class="item-title span6">
+ <a href="#body_<%=public_body.id%>" data-toggle="collapse" data-parent="requests"><i class="icon-chevron-right"></i></a>
+ <%= link_to(public_body.name, admin_body_show_path(public_body), :title => "view full details")%>
+ </span>
+ <span class="item-metadata span6">
+ <%= render :partial => 'tags', :locals => { :body => public_body} %>
+ </span>
</div>
<div id="body_<%=public_body.id%>" class="item-detail accordion-body collapse row">
-
- <% public_body.for_admin_column do |name, value, type| %>
- <div>
- <span class="span6">
- <b><%=name%></b>
- </span>
- <span class="span6">
- <% if type == 'datetime' %>
- <%= I18n.l(value, :format => "%e %B %Y %H:%M:%S") %>
- (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(value)) %>)
- <% else %>
- <%= h value %>&nbsp;
- <% end %>
- </span>
+ <% public_body.for_admin_column do |name, value, type| %>
+ <div>
+ <span class="span6">
+ <b><%=name%></b>
+ </span>
+ <span class="span6">
+ <% if type == 'datetime' %>
+ <%= I18n.l(value, :format => "%e %B %Y %H:%M:%S") %>
+ (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(value)) %>)
+ <% else %>
+ <%= h value %>&nbsp;
+ <% end %>
+ </span>
</div>
- <% end %>
+ <% end %>
</div>
</div>
<% end %>
@@ -41,6 +40,5 @@
<%= submit_tag "Add tag to all", :class => "btn btn-primary" %>
(in table just above)
</p>
-
<% end %>
diff --git a/app/views/admin_public_body/list.rhtml b/app/views/admin_public_body/list.rhtml
index f9153217e..b4328bcad 100644
--- a/app/views/admin_public_body/list.rhtml
+++ b/app/views/admin_public_body/list.rhtml
@@ -14,9 +14,8 @@
<%= link_to 'Import from CSV file', 'import_csv', :class => "btn btn-warning" %>
</div>
</div>
-</p>
-<% form_tag("", :method => "get", :class => "form form-search") do %>
+<% form_tag({}, :method => "get", :class => "form form-search") do %>
<%= text_field_tag 'query', params[:query], { :size => 30, :class => "input-large search-query" } %>
<%= submit_tag "Search", :class => "btn" %>
<% if !@query.nil? %>
diff --git a/app/views/admin_request/_incoming_message_actions.rhtml b/app/views/admin_request/_incoming_message_actions.rhtml
index 9fedcb525..0ebeb5f9b 100644
--- a/app/views/admin_request/_incoming_message_actions.rhtml
+++ b/app/views/admin_request/_incoming_message_actions.rhtml
@@ -1,33 +1,33 @@
-<formset class="form-horizontal">
+<fieldset class="form-horizontal">
<legend>Actions</legend>
<% form_tag '../redeliver_incoming', :class => "form form-inline" do %>
<div class="control-group">
- <label class="control-label" for="url_title">Redeliver message to one or more other requests</label>
+ <label class="control-label" for="url_title_<%= incoming_message.id %>">Redeliver message to one or more other requests</label>
<div class="controls">
<% if @info_requests && @info_requests.size == 1 %>
- <%= text_field_tag 'url_title', @info_requests[0].url_title, { :size => 20 } %>
+ <%= text_field_tag 'url_title', @info_requests[0].url_title, { :size => 20, :id => "url_title_#{incoming_message.id}" } %>
<% else %>
- <%= text_field_tag 'url_title', "", { :size => 20 } %>
+ <%= text_field_tag 'url_title', "", { :size => 20, :id => "url_title_#{incoming_message.id}" } %>
<% end %>
- <%= hidden_field_tag 'redeliver_incoming_message_id', incoming_message.id %>
+ <%= hidden_field_tag 'redeliver_incoming_message_id', incoming_message.id, :id => nil %>
<%= submit_tag "Redeliver to another request", :class => "btn" %>
<p class="help-block"><code>id</code> or <code>url_title</code>; you can supply more than one, separated by commas</p>
</div>
</div>
<% end %>
<div class="control-group">
- <label class="control-label" for="generate_upload_url">Generate FOI officer upload URL</label>
+ <label class="control-label">Generate FOI officer upload URL</label>
<div class="controls">
- <%= link_to 'Generate and take me there', "../generate_upload_url/#{incoming_message.info_request.id}?incoming_message_id=#{incoming_message.id}", :class => "btn", :id => "generate_upload_url" %>
+ <%= link_to 'Generate and take me there', "../generate_upload_url/#{incoming_message.info_request.id}?incoming_message_id=#{incoming_message.id}", :class => "btn" %>
</div>
</div>
<% form_tag '../destroy_incoming', :class => "form form-inline" do %>
<div class="control-group">
- <label class="control-label" for="generate_upload_url">Destroy message</label>
+ <label class="control-label" for="destroy_message_<%= incoming_message.id %>">Destroy message</label>
<div class="controls">
- <%= hidden_field_tag 'incoming_message_id', incoming_message.id %>
- <%= submit_tag "Destroy message", :class => "btn btn-danger", :confirm => "This is permanent! Are you sure?" %>
+ <%= hidden_field_tag 'incoming_message_id', incoming_message.id, :id => nil %>
+ <%= submit_tag "Destroy message", :class => "btn btn-danger", :confirm => "This is permanent! Are you sure?", :id => "destroy_message_#{incoming_message.id}" %>
</div>
</div>
<% end %>
@@ -35,11 +35,11 @@
<% if @raw_email.nil? %>
<%# we're not on the raw_email page itself %>
<div class="control-group">
- <label class="control-label" for="show_rail_email">Inspect email</label>
+ <label class="control-label">Inspect email</label>
<div class="controls">
- <%= link_to "View raw email", "../show_raw_email/#{incoming_message.raw_email_id}", :class => "btn", :id => "show_raw_email" %>
+ <%= link_to "View raw email", "../show_raw_email/#{incoming_message.raw_email_id}", :class => "btn" %>
</div>
</div>
<% end %>
-</formset>
+</fieldset>
diff --git a/app/views/admin_request/list.rhtml b/app/views/admin_request/list.rhtml
index ff67dd843..10b39d3a2 100644
--- a/app/views/admin_request/list.rhtml
+++ b/app/views/admin_request/list.rhtml
@@ -2,7 +2,7 @@
<h1><%=@title%></h1>
-<% form_tag("", :method => "get", :class => "form form-search") do %>
+<% form_tag({}, :method => "get", :class => "form form-search") do %>
<%= text_field_tag 'query', params[:query], { :size => 30, :class => "input-large search-query" } %>
<%= submit_tag "Search", :class => "btn" %> (substring search, titles only)
<% end %>
diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml
index def158d67..72552a588 100644
--- a/app/views/admin_request/show.rhtml
+++ b/app/views/admin_request/show.rhtml
@@ -4,116 +4,115 @@
<% form_tag '../move_request', { :class => "form form-horizontal" } do %>
<%= hidden_field_tag 'info_request_id', @info_request.id %>
-<div class="accordion" id="info_request">
- <div class="accordion-group">
- <div class="accordion-heading">
- <span class="item-title">
- <a href="#metadata_<%=@info_request.id%>" data-toggle="collapse" data-parent="#info_request"><i class="icon-chevron-down"></i></a>Request metadata
- </span>
- </div>
- <div id="metadata_<%=@info_request.id%>" class="accordion-body collapse in">
- <table class="table table-striped table-condensed">
- <thead>
- <tr>
- <td colspan="2">
- <%= link_to 'Edit metadata', '../edit/' + @info_request.id.to_s, :class => "btn" %>
- </td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <th>Public page:</th>
- <td><%= link_to request_url(@info_request), request_path(@info_request) %></td>
- </tr>
- <% @info_request.for_admin_column do |name, value, type, column_name|%>
+ <div class="accordion" id="info_request">
+ <div class="accordion-group">
+ <div class="accordion-heading">
+ <span class="item-title">
+ <a href="#metadata_<%=@info_request.id%>" data-toggle="collapse" data-parent="#info_request"><i class="icon-chevron-down"></i></a>Request metadata
+ </span>
+ </div>
+ <div id="metadata_<%=@info_request.id%>" class="accordion-body collapse in">
+ <table class="table table-striped table-condensed">
+ <thead>
+ <tr>
+ <td colspan="2">
+ <%= link_to 'Edit metadata', '../edit/' + @info_request.id.to_s, :class => "btn" %>
+ </td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <th>Public page:</th>
+ <td><%= link_to request_url(@info_request), request_path(@info_request) %></td>
+ </tr>
+ <% @info_request.for_admin_column do |name, value, type, column_name|%>
+ <tr>
+ <td>
+ <b><%= name %>:</b>
+ </td>
+ <td>
+ <% if type == 'datetime' %>
+ <%= I18n.l(value, :format => "%e %B %Y %H:%M:%S") %>
+ (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(value)) %>)
+ <% else %>
+ <%= h value %>
+ <% end %>
+ <% if column_name == 'described_state' %>
+ <ul>
+ <li><strong>Initial request last sent at:</strong> <%= @info_request.calculate_status %></li>
+ <li><strong>Initial request last sent at:</strong> <%=@info_request.date_initial_request_last_sent_at.to_date %></li>
+ <li><strong>Date response required by:</strong> <%= @info_request.date_response_required_by %></li>
+ <li><strong>Very overdue after:</strong> <%= @info_request.date_very_overdue_after %></li>
+ </ul>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
<tr>
<td>
- <b><%= name %>:</b>
+ <b>Created by</b>
</td>
<td>
- <% if type == 'datetime' %>
- <%= I18n.l(value, :format => "%e %B %Y %H:%M:%S") %>
- (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(value)) %>)
+ <% if @info_request.is_external? %>
+ <%= link_to("<i class='icon-eye-open'></i>".html_safe, @info_request.external_url, :title => "view URL of original request on external website") %>
+ <%= @info_request.public_body.name %> on behalf of <%= (@info_request.user_name || _('an anonymous user'))%> (using API)
<% else %>
- <%= h value %>
- <% end %>
- <% if column_name == 'described_state' %>
- <ul>
- <li><strong>Initial request last sent at:</strong> <%= @info_request.calculate_status %>
- <li><strong>Initial request last sent at:</strong> <%=@info_request.date_initial_request_last_sent_at.to_date %>
- <li><strong>Date response required by:</strong> <%= @info_request.date_response_required_by %>
- <li><strong>Very overdue after:</strong> <%= @info_request.date_very_overdue_after %>
- </ul>
+ <%= link_to("<i class='icon-eye-open'></i>".html_safe, user_path(@info_request.user), :title => "view user's page on public website") %>
+ <%= user_admin_link_for_request(@info_request) %>
+ <%= link_to _("move..."), "#", :class => "btn btn-mini btn-warning toggle-hidden" %>
+ <div style="display:none;">
+ <strong>url_name of new user:</strong>
+ <%= text_field_tag 'user_url_name', "", { :size => 20 } %>
+ <%= submit_tag "Move request to user", :class => "btn btn-info" %>
+ </div>
<% end %>
</td>
</tr>
- <% end %>
- <tr>
- <td>
- <b>Created by</b>
- </td>
- <td>
- <% if @info_request.is_external? %>
- <%= link_to("<i class='icon-eye-open'></i>".html_safe, @info_request.external_url, :title => "view URL of original request on external website") %>
- <%= @info_request.public_body.name %> on behalf of <%= (@info_request.user_name || _('an anonymous user'))%> (using API)
- <% else %>
- <%= link_to("<i class='icon-eye-open'></i>".html_safe, user_path(@info_request.user), :title => "view user's page on public website") %>
- <%= user_admin_link_for_request(@info_request) %>
- <%= link_to _("move..."), "#", :class => "btn btn-mini btn-warning toggle-hidden" %>
+ <tr>
+ <td>
+ <b>Public authority:</b>
+ </td>
+ <td>
+ <%= link_to("<i class='icon-eye-open'></i>".html_safe, public_body_path(@info_request.public_body), :title => "view authority on public website") %>
+ <%= link_to(@info_request.public_body.name, admin_body_show_path(@info_request.public_body)) %>
+ <%= link_to "move...", "#", :class => "btn btn-mini btn-warning toggle-hidden" %>
<div style="display:none;">
- <strong>url_name of new user:</strong>
- <%= text_field_tag 'user_url_name', "", { :size => 20 } %>
- <%= submit_tag "Move request to user", :class => "btn btn-info" %>
+ <strong>url_name of new authority:</strong>
+ <%= text_field_tag 'public_body_url_name', "", { :size => 20 } %>
+ <%= submit_tag "Move request to authority", :class => "btn btn-info" %>
</div>
- <% end %>
-
- </td>
- </tr>
- <tr>
- <td>
- <b>Public authority:</b>
- </td>
- <td>
- <%= link_to("<i class='icon-eye-open'></i>".html_safe, public_body_path(@info_request.public_body), :title => "view authority on public website") %>
- <%= link_to(@info_request.public_body.name, admin_body_show_path(@info_request.public_body)) %>
- <%= link_to "move...", "#", :class => "btn btn-mini btn-warning toggle-hidden" %>
- <div style="display:none;">
- <strong>url_name of new authority:</strong>
- <%= text_field_tag 'public_body_url_name', "", { :size => 20 } %>
- <%= submit_tag "Move request to authority", :class => "btn btn-info" %>
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <b><%=_("Incoming email address")%></b>
- </td>
- <td>
- <%= link_to h(@info_request.incoming_email), "mailto:#{@info_request.incoming_email}" %>
- </td>
- </tr>
- <tr>
- <td>
- <b><%=_("Tags")%></b>
- </td>
- <td>
- <%= render :partial => 'tags', :locals => { :info_request => @info_request} %>
- </td>
- </tr>
- </tbody>
- <tfoot>
- <tr>
- <td colspan="2">
- <%= link_to 'Edit metadata', '../edit/' + @info_request.id.to_s, :class => "btn" %>
- </td>
- </tr>
- </tfoot>
- </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><%=_("Incoming email address")%></b>
+ </td>
+ <td>
+ <%= link_to h(@info_request.incoming_email), "mailto:#{@info_request.incoming_email}" %>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><%=_("Tags")%></b>
+ </td>
+ <td>
+ <%= render :partial => 'tags', :locals => { :info_request => @info_request} %>
+ </td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td colspan="2">
+ <%= link_to 'Edit metadata', '../edit/' + @info_request.id.to_s, :class => "btn" %>
+ </td>
+ </tr>
+ </tfoot>
+ </table>
+ </div>
</div>
</div>
-</div>
<% end %>
-<formset class="form-horizontal">
+<fieldset class="form-horizontal">
<legend>Actions</legend>
<div class="control-group">
<label class="control-label">
@@ -124,15 +123,15 @@
<p class="help-block">(see also option to general URLs for individual incoming messages below)</p>
</div>
</div>
- <% form_tag '../hide/' + @info_request.id.to_s, :class => "form form-inline", :info_request_id => @info_request.id.to_s, :id => "hide_request_form" do %>
+ <% form_tag '../hide/' + @info_request.id.to_s, :class => "form form-inline", :id => "hide_request_form" do %>
<div class="control-group">
- <% if @info_request.is_external? %>
- <label class="control-label">Hide the request:</label>
- <% else %>
- <label class="control-label">Hide the request and notify the user:</label>
- <% end %>
+ <% if @info_request.is_external? %>
+ <label class="control-label">Hide the request:</label>
+ <% else %>
+ <label class="control-label">Hide the request and notify the user:</label>
+ <% end %>
- <div class="controls" id="request_hidden_user_explanation_reasons">
+ <div class="controls" id="request_hidden_user_explanation_reasons">
<% if ['hidden', 'requester_only'].include? @info_request.prominence %>
<p class="help-block">This request has already been hidden</p>
<% else %>
@@ -147,29 +146,29 @@
</div>
<% if !['hidden', 'requester_only'].include? @info_request.prominence %>
- <% if ! @info_request.is_external? %>
+ <% if ! @info_request.is_external? %>
- <div class="control-group" id="request_hidden_user_subject">
- <label for="request_hidden_user_subject_field" class="control-label">Subject of email:</label>
- <div class="controls">
- <%= text_field_tag "subject", "Your request on WhatDoTheyKnow.com hidden", {:id => "request_hidden_user_subject_field", :cols => 100} %>
- </div>
+ <div class="control-group" id="request_hidden_user_subject">
+ <label for="request_hidden_user_subject_field" class="control-label">Subject of email:</label>
+ <div class="controls">
+ <%= text_field_tag "subject", "Your request on WhatDoTheyKnow.com hidden", {:id => "request_hidden_user_subject_field", :cols => 100} %>
</div>
+ </div>
- <div class="control-group" id="request_hidden_user_explanation">
- <label for="request_hidden_user_explanation_field" class="control-label">Reason for hiding the request (will be emailed to user):</label>
- <div class="controls">
- <%= text_area_tag "explanation", h(@request_hidden_user_explanation), {:id => "request_hidden_user_explanation_field"} %>
- </div>
+ <div class="control-group" id="request_hidden_user_explanation">
+ <label for="request_hidden_user_explanation_field" class="control-label">Reason for hiding the request (will be emailed to user):</label>
+ <div class="controls">
+ <%= text_area_tag "explanation", h(@request_hidden_user_explanation), {:id => "request_hidden_user_explanation_field"} %>
</div>
+ </div>
- <% end %>
+ <% end %>
<div class="form-actions" id="request_hide_button">
<%= submit_tag _("Hide request"), :class => "btn" %>
</div>
<% end %>
<% end %>
-</formset>
+</fieldset>
<hr>
<h2>Events</h2>
@@ -195,7 +194,7 @@
<td>
<% if info_request_event.described_state != 'waiting_clarification' and info_request_event.event_type == 'response' %>
<% form_tag '../mark_event_as_clarification', :class => "form form-inline admin-table-form admin-inline-form" do %>
- <%= hidden_field_tag 'info_request_event_id', info_request_event.id %>
+ <%= hidden_field_tag 'info_request_event_id', info_request_event.id, :id => nil %>
<%= submit_tag "Was clarification request", :class => "btn btn-mini btn-primary" %>
<% end %>
<% end %>
diff --git a/app/views/admin_request/show_raw_email.rhtml b/app/views/admin_request/show_raw_email.rhtml
index ae0db1c29..72c782ad6 100644
--- a/app/views/admin_request/show_raw_email.rhtml
+++ b/app/views/admin_request/show_raw_email.rhtml
@@ -4,12 +4,12 @@
<p>
FOI request: <%= request_both_links(@raw_email.incoming_message.info_request) %>
- <% if @holding_pen %>
+ <% if @holding_pen %>
<br>This is in the holding pen because: <strong><%= @rejected_reason %></strong>
<% if @public_bodies.size > 0 %>
<br>Guessed authority:
<% @public_bodies.each do |public_body| %>
- <%=public_body_both_links(public_body)%>
+ <%=public_body_both_links(public_body)%>
<% end %>
(based on From: email domain)
<% end %>
@@ -20,7 +20,7 @@
<div class="accordion-group">
<div class="accordion-heading">
<a href="#info_request_<%= info_request.id %>" data-toggle="collapse"><i class="icon-chevron-right"></i></a>
- <%=request_both_links(info_request)%>
+ <%=request_both_links(info_request)%>
</div>
<div class="accordion-body collapse" id="info_request_<%= info_request.id %>">
<table class="table table-striped table-condensed">
@@ -35,7 +35,7 @@
<tr>
<td><strong>Authority:</strong></td>
<td>
- <%= link_to(info_request.public_body.name, public_body_admin_url(info_request.public_body)) %>
+ <%= link_to(info_request.public_body.name, admin_body_show_path(info_request.public_body)) %>
</td>
</tr>
<tr>
diff --git a/app/views/admin_track/list.rhtml b/app/views/admin_track/list.rhtml
index f40ad4e75..9cff5635b 100644
--- a/app/views/admin_track/list.rhtml
+++ b/app/views/admin_track/list.rhtml
@@ -2,7 +2,7 @@
<h1><%=@title%></h1>
-<% form_tag("", :method => "get", :class => "form form-search") do %>
+<% form_tag({}, :method => "get", :class => "form form-search") do %>
<%= text_field_tag 'query', params[:query], { :size => 30, :class => "input-large search-query" } %>
<%= submit_tag "Search", :class => "btn" %> (substring search the query – so use url_names_for_a_particular_request_or_authority_or_person)
<% end %>
diff --git a/app/views/admin_user/list.rhtml b/app/views/admin_user/list.rhtml
index df3a1b276..afe166f1f 100644
--- a/app/views/admin_user/list.rhtml
+++ b/app/views/admin_user/list.rhtml
@@ -2,7 +2,7 @@
<h1><%=@title%></h1>
-<% form_tag("", :method => "get", :class => "form form-search") do %>
+<% form_tag({}, :method => "get", :class => "form form-search") do %>
<%= text_field_tag 'query', params[:query], { :size => 30, :class => "input-large search-query"} %>
<%= submit_tag "Search", :class => "btn" %> (substring search, names and emails)
<%= link_to 'Banned users', 'banned', :class => "btn btn-info" %>
diff --git a/app/views/comment/new.rhtml b/app/views/comment/new.rhtml
index aa5b6051c..578732cdb 100644
--- a/app/views/comment/new.rhtml
+++ b/app/views/comment/new.rhtml
@@ -67,10 +67,10 @@
</ul>
<p>
- <big><%= _('Annotations will be posted publicly here, and are
- <strong>not</strong> sent to {{public_body_name}}.',:public_body_name=>h(@info_request.public_body.name)) %></big>
+ <span class="big"><%= _('Annotations will be posted publicly here, and are
+ <strong>not</strong> sent to {{public_body_name}}.',:public_body_name=>h(@info_request.public_body.name)) %></span>
<% if @info_request.is_external? %>
- <big><%= _('Note that the requester will not be notified about your annotation, because the request was published by {{public_body_name}} on their behalf.', :public_body_name => @info_request.public_body.name) %></big>
+ <span class="big"><%= _('Note that the requester will not be notified about your annotation, because the request was published by {{public_body_name}} on their behalf.', :public_body_name => @info_request.public_body.name) %></span>
<% end %>
</p>
diff --git a/app/views/general/blog.rhtml b/app/views/general/blog.rhtml
index 07d6d2f14..d42b32282 100644
--- a/app/views/general/blog.rhtml
+++ b/app/views/general/blog.rhtml
@@ -5,7 +5,7 @@
<div class="act_link">
<h2><%= _("Stay up to date") %></h2>
<img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="https://twitter.com/<%= @twitter_user %>"><%= _("Follow us on twitter") %></a><br/><br/>
- <img src="/images/feed-16.png" alt="RSS icon" valign="middle"> <a href="<%= @feed_url %>"><%= _("Subscribe to blog") %></a>
+ <img src="/images/feed-16.png" alt="RSS icon"> <a href="<%= @feed_url %>"><%= _("Subscribe to blog") %></a>
</div>
<% if Configuration::twitter_widget_id %>
<div id="twitter">
diff --git a/app/views/help/api.rhtml b/app/views/help/api.rhtml
index 3a6c867ee..57390d65a 100644
--- a/app/views/help/api.rhtml
+++ b/app/views/help/api.rhtml
@@ -30,15 +30,15 @@
</ul>
</dd>
- <dt>RSS (actually, Atom) feeds</h2>
+ <dt>RSS (actually, Atom) feeds</dt>
<dd>
<p>There are Atom feeds on most pages which list FOI requests, which you can
use to get updates and links in XML format. Find the URL of the Atom feed in
one of these ways:
<ul>
<li>Look for the <img src="/images/feed-16.png" alt=""> RSS feed links.</li>
- <li>Examine the <tt>&lt;link rel="alternate" type="application/atom+xml"&gt;</tt> tag in the head of the HTML. </li>
- <li>Add <tt>/feed</tt> to the start of another URL.
+ <li>Examine the <code>&lt;link rel="alternate" type="application/atom+xml"&gt;</code> tag in the head of the HTML. </li>
+ <li>Add <code>/feed</code> to the start of another URL.
</ul>
<p>In particular, even complicated search queries have Atom feeds.
@@ -53,8 +53,8 @@
objects in a structured form. Find them by:
</p>
<ul>
- <li>Adding <tt>.json</tt> to the end of the URL. </li>
- <li>Look for the <tt>&lt;link rel="alternate" type="application/json"&gt;</tt> tag in the head of the HTML. </li>
+ <li>Adding <code>.json</code> to the end of the URL. </li>
+ <li>Look for the <code>&lt;link rel="alternate" type="application/json"&gt;</code> tag in the head of the HTML. </li>
</ul>
<p>Requests, users and authorities all have JSON versions containing basic
diff --git a/app/views/help/officers.rhtml b/app/views/help/officers.rhtml
index b13e225fe..6db706f78 100644
--- a/app/views/help/officers.rhtml
+++ b/app/views/help/officers.rhtml
@@ -222,7 +222,7 @@
form in an annotation.
</dd>
- <dt id="copyright"><a name="commercial"></a>What is your policy on copyright of documents?<a href="#copyright">#</a> </dt>
+ <dt id="copyright"><a id="commercial"></a>What is your policy on copyright of documents?<a href="#copyright">#</a> </dt>
<dd>Our Freedom of Information law is "applicant blind", so anyone in the
world can request the same document and get a copy of it.
@@ -235,9 +235,6 @@
</dl>
-
- </dl>
-
<p><strong>If you haven't already</strong>, read <a href="<%= help_about_path %>">the introduction</a> --&gt;
<br><strong>Otherwise</strong>, the <a href="<%= help_credits_path %>">credits</a> or the <a href="<%= help_api_path %>">programmers API</a> --&gt;
diff --git a/app/views/layouts/admin.rhtml b/app/views/layouts/admin.rhtml
index 447b24537..a58913892 100644
--- a/app/views/layouts/admin.rhtml
+++ b/app/views/layouts/admin.rhtml
@@ -1,4 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE html>
<html lang="en-gb">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" >
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml
index 1e6a61f58..a66b85e02 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.rhtml
@@ -1,6 +1,7 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE html>
<html lang="<%= I18n.locale %>">
<head>
+ <meta charset="utf-8">
<title>
<% if @title %>
<%=@title%> - <%= site_name %>
diff --git a/app/views/layouts/no_chrome.rhtml b/app/views/layouts/no_chrome.rhtml
index 74c79b701..120ba6f28 100644
--- a/app/views/layouts/no_chrome.rhtml
+++ b/app/views/layouts/no_chrome.rhtml
@@ -1,6 +1,7 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE html>
<html lang="<%= I18n.locale %>">
<head>
+ <meta charset="utf-8">
<title>
<% if @title %>
<%=@title%> - <%= site_name %>
diff --git a/app/views/request/_describe_state.rhtml b/app/views/request/_describe_state.rhtml
index 5b6004e81..fde1cdfa7 100644
--- a/app/views/request/_describe_state.rhtml
+++ b/app/views/request/_describe_state.rhtml
@@ -3,7 +3,7 @@
<% form_for(:incoming_message, @info_request, :url => describe_state_url(:id => @info_request.id)) do |f| %>
<h2><%= _('What best describes the status of this request now?') %></h2>
- <hr> <!------------------------------------------------>
+ <hr>
<h3><%= _('This request is still in progress:') %></h3>
<% if @info_request.described_state != 'internal_review' %>
<div>
@@ -40,7 +40,7 @@
<%= render :partial => 'general/custom_state_transitions_pending', :locals => {:id_suffix => id_suffix } %>
- <hr> <!------------------------------------------------>
+ <hr>
<h3><%= _('This particular request is finished:') %></h3>
<% if @info_request.described_state == 'internal_review' %>
@@ -67,7 +67,7 @@
<%= render :partial => 'general/custom_state_transitions_complete', :locals => {:id_suffix => id_suffix } %>
- <hr> <!------------------------------------------------>
+ <hr>
<h3><%= _('Other:') %></h3>
<div>
diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.rhtml
index 94588c15b..af33d31a2 100644
--- a/app/views/request/_sidebar.rhtml
+++ b/app/views/request/_sidebar.rhtml
@@ -31,17 +31,20 @@
<h2><%= _("Act on what you've learnt") %></h2>
<div class="act_link">
- <% tweet_link = "https://twitter.com/share?url=#{h(request.url)}&via=#{h(Configuration::twitter_username)}&text='#{h(@info_request.title)}'&related=#{_('alaveteli_foi:The software that runs {{site_name}}', :site_name => h(site_name))}" %>
- <% link_to tweet_link do %>
+ <%
+ # Cast "related" to normal string because html safe string (from rails_xss gem) and CGI::escape
+ # interact badly with ':' character. Go figure! Might go away in rails 3
+ %>
+ <% link_to "https://twitter.com/share?" + {:url => request.url, :via => Configuration::twitter_username, :text => @info_request.title, :related => _('alaveteli_foi:The software that runs {{site_name}}', :site_name => site_name).to_str}.to_query do %>
<%= image_tag "twitter-16.png", :alt => "twitter icon" %>
+ <%= _("Tweet this request") %>
<% end %>
- <%= link_to _("Tweet this request"), tweet_link %>
</div>
<div class="act_link">
<% link_to "http://wordpress.com/" do %>
<%= image_tag "wordpress.png", :class => "rss" %>
+ <%= _("Start your own blog") %>
<% end %>
- <%= link_to _("Start your own blog"), "http://wordpress.com/"%>
</div>
<%= render :partial => 'request/next_actions' %>
diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml
index d25da8141..4766c981b 100644
--- a/app/views/request/new.rhtml
+++ b/app/views/request/new.rhtml
@@ -37,7 +37,7 @@
<div id="request_header">
<div id="request_header_body">
- <label class="form_label" for="info_request_public_body_id"><%= _('To:') %></label>
+ <label class="form_label"><%= _('To:') %></label>
<span id="to_public_body"><%=h(@info_request.public_body.name)%></span>
<div class="form_item_note">
<% if @info_request.public_body.info_requests.size > 0 %>
diff --git a/config/environment.rb b/config/environment.rb
index 268a44e65..4621c6a02 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -134,7 +134,6 @@ require 'ruby19.rb'
require 'activesupport_cache_extensions.rb'
require 'timezone_fixes.rb'
require 'use_spans_for_errors.rb'
-require 'make_html_4_compliant.rb'
require 'activerecord_errors_extensions.rb'
require 'willpaginate_extension.rb'
require 'sendmail_return_path.rb'
diff --git a/lib/make_html_4_compliant.rb b/lib/make_html_4_compliant.rb
deleted file mode 100644
index 8926d5873..000000000
--- a/lib/make_html_4_compliant.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# Monkeypatch! Output HTML 4.0 compliant code, using method described in this
-# ticket: http://dev.rubyonrails.org/ticket/6009
-
-ActionView::Helpers::TagHelper.module_eval do
- def tag(name, options = nil, open = false, escape = true)
- "<#{name}#{tag_options(options, escape) if options}#{open ? ">" : ">"}".html_safe
- end
-end
diff --git a/public/down.default.html b/public/down.default.html
index c01e8fa19..ce4887b51 100644
--- a/public/down.default.html
+++ b/public/down.default.html
@@ -1,6 +1,7 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE html>
<html lang="en-gb">
<head>
+ <meta charset="utf-8">
<title>
WhatDoTheyKnow - make and browse Freedom of Information (FOI) requests
</title>
diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css
index 1a6aa1d84..2823f3978 100644
--- a/public/stylesheets/main.css
+++ b/public/stylesheets/main.css
@@ -1743,3 +1743,7 @@ text-decoration:underline;
.request_listing a,.body_listing a,.user_listing a,.request_short_listing a,h2 a,.feed_link a {
text-decoration:none;
}
+
+.big {
+ font-size: larger;
+}
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index b04ed4b54..e05ef75dd 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -186,79 +186,12 @@ def get_fixtures_xapian_index()
ActsAsXapian.db_path = temp_path
end
-# Validate an entire HTML page
-def validate_html(html)
- $tempfilecount = $tempfilecount + 1
- tempfilename = File.join(Dir::tmpdir, "railshtmlvalidate."+$$.to_s+"."+$tempfilecount.to_s+".html")
- File.open(tempfilename, "w+") do |f|
- f.puts html
- end
- if not system($html_validation_script, *($html_validation_script_options +[tempfilename]))
- raise "HTML validation error in " + tempfilename + " HTTP status: " + @response.response_code.to_s
- end
- File.unlink(tempfilename)
- return true
-end
-
-# Validate HTML fragment by wrapping it as the <body> of a page
-def validate_as_body(html)
- validate_html('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' +
- "<html><head><title>Test</title></head><body>#{html}</body></html>")
-end
-
def basic_auth_login(request, username = nil, password = nil)
username = Configuration::admin_username if username.nil?
password = Configuration::admin_password if password.nil?
request.env["HTTP_AUTHORIZATION"] = "Basic " + Base64::encode64("#{username}:#{password}")
end
-# Monkeypatch! Validate HTML in tests.
-$html_validation_script_found = false
-Configuration::utility_search_path.each do |d|
- $html_validation_script = File.join(d, "validate")
- $html_validation_script_options = ["--charset=utf-8"]
- if File.file? $html_validation_script and File.executable? $html_validation_script
- $html_validation_script_found = true
- break
- end
-end
-if $tempfilecount.nil?
- $tempfilecount = 0
- if $html_validation_script_found
- module ActionController
- module TestProcess
- # Hook into the process function, so can automatically get HTML after each request
- alias :original_process :process
- def is_fragment
- # XXX there must be a better way of doing this!
- return @request.query_parameters["action"] == "search_typeahead"
- end
- def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
- self.original_process(action, parameters, session, flash, http_method)
- # Don't try validating the admin interface.
- # TODO: Make the admin interface valid html5
- return if @request.parameters["controller"] =~ /admin_/
- # don't validate auto-generated HTML
- return if @request.query_parameters["action"] == "get_attachment_as_html"
- # XXX Is there a better way to check this than calling a private method?
- return unless @response.template.controller.instance_eval { integrate_views? }
- # And then if HTML, not a redirect (302, 301)
- if @response.content_type == "text/html" && ! [301,302,401].include?(@response.response_code)
- if !is_fragment
- validate_html(@response.body)
- else
- # it's a partial
- validate_as_body(@response.body)
- end
- end
- end
- end
- end
- else
- puts "WARNING: HTML validation script " + $html_validation_script + " not found"
- end
-end
-
# to_ary differs in Ruby 1.8 and 1.9
# @see http://yehudakatz.com/2010/01/02/the-craziest-fing-bug-ive-ever-seen/
def safe_mock_model(model, args = {})
diff --git a/spec/views/public_body/show.rhtml_spec.rb b/spec/views/public_body/show.rhtml_spec.rb
index b68b3f43b..23e92dedd 100644
--- a/spec/views/public_body/show.rhtml_spec.rb
+++ b/spec/views/public_body/show.rhtml_spec.rb
@@ -38,11 +38,6 @@ describe "when viewing a body" do
response.should be_success
end
- it "should be valid HTML" do
- render "public_body/show"
- validate_as_body response.body
- end
-
it "should show the body's name" do
render "public_body/show"
response.should have_tag("h1", "Test Quango")