aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-09-01 12:54:30 +0100
committerSeb Bacon <seb.bacon@gmail.com>2011-09-01 12:54:30 +0100
commit7833dfbf9833f6fd42b05c36d308d016ae614be2 (patch)
tree85a32e6bc9331682b703f358940d9ecf952f5775
parent28e683adb5c27df7bcdf782e290de64bca0039df (diff)
final set of fixes to get tests to pass, post-new-design
-rw-r--r--app/controllers/general_controller.rb15
-rw-r--r--app/views/admin_public_body/_form.rhtml10
-rw-r--r--app/views/general/frontpage.rhtml5
-rw-r--r--app/views/request/new.rhtml3
4 files changed, 20 insertions, 13 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 1ddf3acff..004136163 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -50,11 +50,18 @@ class GeneralController < ApplicationController
query = 'variety:response (status:successful OR status:partially_successful)'
# query = 'variety:response' # XXX debug
sortby = "described"
- xapian_object = perform_search([InfoRequestEvent], query, sortby, 'request_title_collapse', 8)
- @successful_request_events = xapian_object.results.map { |r| r[:model] }
- @successful_request_events = @successful_request_events.sort_by { |e| e.described_at }.reverse
+ max_count = 5
+ xapian_object = perform_search([InfoRequestEvent], query, sortby, 'request_title_collapse', max_count)
+ @request_events = xapian_object.results.map { |r| r[:model] }
+ @request_events = @request_events.sort_by { |e| e.described_at }.reverse
+ if @request_events.count < max_count
+ query = 'variety:sent'
+ xapian_object = perform_search([InfoRequestEvent], query, sortby, 'request_title_collapse', max_count-@request_events.count)
+ more_events = xapian_object.results.map { |r| r[:model] }
+ @request_events += more_events.sort_by { |e| e.described_at }.reverse
+ end
rescue
- @successful_request_events = []
+ @request_events = []
end
end
end
diff --git a/app/views/admin_public_body/_form.rhtml b/app/views/admin_public_body/_form.rhtml
index dc7732fc1..6a9013071 100644
--- a/app/views/admin_public_body/_form.rhtml
+++ b/app/views/admin_public_body/_form.rhtml
@@ -26,19 +26,19 @@
<div id="div-locale-<%=locale.to_s%>">
<%= t.hidden_field :locale, :value => locale.to_s %>
- <p><label for="public_body_name">Name</label><br/>
+ <p><label for="<%= form_tag_id(t.object_name, :name) %>">Name</label><br/>
<%= t.text_field :name, :size => 60, :id => form_tag_id(t.object_name, :name) %></p>
- <p><label for="public_body_short_name">Short name <small>(only put in abbreviations which are really used, otherwise leave blank. Short or long name is used in the URL - don't worry about breaking URLs through renaming, as the history is used to redirect)</small></label><br/>
+ <p><label for="<%= form_tag_id(t.object_name, :short_name) %>">Short name <small>(only put in abbreviations which are really used, otherwise leave blank. Short or long name is used in the URL - don't worry about breaking URLs through renaming, as the history is used to redirect)</small></label><br/>
<%= t.text_field :short_name, :size => 60, :id => form_tag_id(t.object_name, :short_name) %></p>
- <p><label for="public_body_request_email">Request email <small>(set to <strong>blank</strong> (empty string) if can't find an address; these emails are <strong>public</strong> as anyone can view with a CAPTCHA)</small></label><br/>
+ <p><label for="<%= form_tag_id(t.object_name, :request_email) %>">Request email <small>(set to <strong>blank</strong> (empty string) if can't find an address; these emails are <strong>public</strong> as anyone can view with a CAPTCHA)</small></label><br/>
<%= t.text_field :request_email, :size => 40, :id => form_tag_id(t.object_name, :request_email) %></p>
- <p><label for="public_body_publication_scheme">Publication scheme URL</label><br/>
+ <p><label for="<%= form_tag_id(t.object_name, :publication_scheme) %>">Publication scheme URL</label><br/>
<%= t.text_field :publication_scheme, :size => 60, :id => form_tag_id(t.object_name, :publication_scheme) %></p>
- <p><label for="public_body_notes">Public notes</label> <small>(HTML, for users to consider when making FOI requests to the authority)</small><br/>
+ <p><label for="<%= form_tag_id(t.object_name, :notes) %>">Public notes</label> <small>(HTML, for users to consider when making FOI requests to the authority)</small><br/>
<%= t.text_area :notes, :rows => 3, :cols => 60, :id => form_tag_id(t.object_name, :notes) %></p>
</div>
<%
diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml
index ecb5720c2..3b1088411 100644
--- a/app/views/general/frontpage.rhtml
+++ b/app/views/general/frontpage.rhtml
@@ -53,11 +53,10 @@
<div id="examples_1">
<h3><%= _("What information has been released?") %></h3>
- <%= _("{{site_name}} users have made {{number_of_requests}} requests:",
+ <%= _("{{site_name}} users have made {{number_of_requests}} requests, including:",
:site_name => site_name, :number_of_requests => InfoRequest.count) %>
<ul>
-
- <% for event in @successful_request_events %>
+ <% for event in @request_events %>
<li>
<%= public_body_link(event.info_request.public_body) %> answered a request about
<%=link_to h(event.info_request.title), request_url(event.info_request)%>
diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml
index 9538065ed..f58cbdd94 100644
--- a/app/views/request/new.rhtml
+++ b/app/views/request/new.rhtml
@@ -26,14 +26,15 @@
<% else %>
<%= _('<strong>search</strong> the authority\'s web site ...') %>
<% end %>
+ </p>
<% if !@info_request.public_body.calculated_home_page.nil? %>
- <br>
<p>
&nbsp; &nbsp; &nbsp; &nbsp; <%= text_field_tag 'q', params[:q], { :size => 20 } %>
<%= hidden_field_tag 'as_sitesearch', @info_request.public_body.calculated_home_page %>
<%= submit_tag _("Search") %>
</p>
<% end %>
+ <p>
... <%= _('to check that the info isn\'t already published.') %>
</p>
<% end %>