diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/general_controller.rb | 6 | ||||
-rw-r--r-- | app/views/general/new_frontpage.rhtml | 26 |
2 files changed, 31 insertions, 1 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index fba593aa3..c688992c0 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.32 2008-08-19 19:49:22 francis Exp $ +# $Id: general_controller.rb,v 1.33 2008-09-03 00:48:54 francis Exp $ class GeneralController < ApplicationController @@ -38,6 +38,10 @@ class GeneralController < ApplicationController @xapian_object = perform_search([InfoRequestEvent], query, sortby, 'request_collapse', 3) end + # New, improved front page! + def new_frontpage + @popular_bodies = PublicBody.find(:all, :select => "*, (select count(*) from info_requests where info_requests.public_body_id = id) as c", :order => "c desc", :limit => 16).in_groups_of(8) + end # Just does a redirect from ?query= search to /query def search_redirect diff --git a/app/views/general/new_frontpage.rhtml b/app/views/general/new_frontpage.rhtml new file mode 100644 index 000000000..4cb1ff4e7 --- /dev/null +++ b/app/views/general/new_frontpage.rhtml @@ -0,0 +1,26 @@ +<div id="frontpage_search"> + <h1>Make or explore Freedom of Information requests</h1> + + <% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %> + <p> + <strong>First, type in the name of the authority + <br>or anything to search for</strong> + <br> + <%= text_field_tag 'query', params[:query], { :size => 30 } %> + <%= submit_tag "Search" %> + <br> + e.g. <%=link_to 'Liverpool', search_url('liverpool')%>, <%=link_to 'MRSA', search_url('mrsa')%>, <%=link_to 'Treasury', search_url('treasury')%> + </p> + <% end %> +</div> + +<div id="frontpage_examples"> + <% for i in [0, 1] %> + <ul id="examples_<%=i%>"> + <% for popular_body in @popular_bodies[i] %> + <li><%=public_body_link(popular_body)%></li> + <% end%> + </ul> + <% end %> +</div> + |