aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/application.rb6
-rw-r--r--app/controllers/general_controller.rb6
-rw-r--r--app/views/general/frontpage.rhtml19
3 files changed, 22 insertions, 9 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb
index c92e084a7..a7ed76772 100644
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -6,7 +6,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: application.rb,v 1.33 2008-04-01 00:36:56 francis Exp $
+# $Id: application.rb,v 1.34 2008-04-01 05:43:40 francis Exp $
class ApplicationController < ActionController::Base
@@ -125,7 +125,7 @@ class ApplicationController < ActionController::Base
end
# Function for search
- def perform_search(query, sortby)
+ def perform_search(query, sortby, per_page = 25)
@query = query
@sortby = sortby
@@ -141,7 +141,7 @@ class ApplicationController < ActionController::Base
end
# Peform the search
- @per_page = 20
+ @per_page = per_page
@page = (params[:page] || "1").to_i
solr_object = InfoRequestEvent.multi_solr_search(@query, :models => [ PublicBody, User ],
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 6930b1ddd..21450fddc 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -5,7 +5,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: general_controller.rb,v 1.15 2008-04-01 00:36:56 francis Exp $
+# $Id: general_controller.rb,v 1.16 2008-04-01 05:43:40 francis Exp $
class GeneralController < ApplicationController
@@ -33,7 +33,9 @@ class GeneralController < ApplicationController
end
# Get all successful requests for display on the right
- @info_requests = InfoRequest.find :all, :order => "created_at desc", :conditions => "prominence = 'normal' and described_state in ('successful', 'partially_successful')", :limit => 3
+ query = 'variety:response (status:successful OR status:partially_successful)'
+ sortby = "newest"
+ perform_search(query, sortby, 3)
end
diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml
index 563a2609a..6001dba0f 100644
--- a/app/views/general/frontpage.rhtml
+++ b/app/views/general/frontpage.rhtml
@@ -1,7 +1,7 @@
<%= render :partial => 'help/alpha_notice' %>
<div id="make_requests">
- <h1>Make requests for information from the UK Government</h1>
+ <h1>Make requests in public for UK government information</h1>
<% if @public_bodies.size == 0 and @query_made %>
<div id="error">
@@ -57,9 +57,20 @@
</div>
<div id="find_information">
- <h1>Explore information that others requested</h1>
- <%= render :partial => 'request/request_listing', :locals => { :info_requests => @info_requests } %>
- <p><%=link_to "View more successful requests", request_list_url(:view => 'successful') %></p>
+ <h1>Explore government information that others received</h1>
+ <% if @search_results.empty? %>
+ <p>None yet.</p>
+ <% else %>
+ <% for search_result in @search_results %>
+ <% if search_result.class.to_s == 'InfoRequestEvent' %>
+ <%= render :partial => 'request/request_listing_via_event', :locals => { :event => search_result, :info_request => search_result.info_request } %>
+ <% else %>
+ <p><strong>Unexpected search result type <%=search_result.class.to_s%></strong></p>
+ <% end %>
+ <% end %>
+ <% end %>
+
+ <p><%=link_to "More recent successful responses", request_list_url(:view => 'successful') %></p>
<% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %>
<p>
<%= text_field_tag 'query', params[:query], { :size => 20 } %>