aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2008-09-03 00:48:54 +0000
committerfrancis <francis>2008-09-03 00:48:54 +0000
commite6dcdf0e884b8ce51504fe7f99b35891e5766f4b (patch)
treeccd29e9c2e8efd06d0d2656792dd182e7669adbe
parent3f1ddfe615bce2cb1b0856c69a3e3c9fc966311a (diff)
Playing with a new frontpage.
-rw-r--r--app/controllers/general_controller.rb6
-rw-r--r--app/views/general/new_frontpage.rhtml26
-rw-r--r--config/routes.rb3
-rw-r--r--public/stylesheets/main.css26
4 files changed, 59 insertions, 2 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>
+
diff --git a/config/routes.rb b/config/routes.rb
index 1d2f8374f..d97285f23 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: routes.rb,v 1.68 2008-09-02 17:44:15 francis Exp $
+# $Id: routes.rb,v 1.69 2008-09-03 00:48:55 francis Exp $
ActionController::Routing::Routes.draw do |map|
@@ -16,6 +16,7 @@ ActionController::Routing::Routes.draw do |map|
map.with_options :controller => 'general' do |general|
general.frontpage '/', :action => 'frontpage'
+ general.new_frontpage '/new_frontpage', :action => 'new_frontpage'
general.auto_complete_for_public_body_query 'auto_complete_for_public_body_query', :action => 'auto_complete_for_public_body_query'
general.search_redirect '/search', :action => 'search_redirect'
diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css
index f6a5fa48f..4a811e995 100644
--- a/public/stylesheets/main.css
+++ b/public/stylesheets/main.css
@@ -270,6 +270,32 @@ dt
dd { margin: 0.6em 0 2em 4em; width: 33em; }
/*---------------- content : recent requests sidebar */
+#frontpage_search
+{
+ text-align: center;
+ margin: 3em 0em 1em 0em;
+ padding: 1em;
+ background-color: #e0e0e0;
+}
+#frontpage_examples li
+{
+ list-style-type: none;
+}
+#frontpage_examples ul
+{
+ width: 34%;
+ margin: 0 0 0 0;
+ padding: 1em 0em 1em 0em;
+}
+#frontpage_examples ul#examples_0 {
+ float: left;
+ margin-left: 20%;
+}
+#frontpage_examples ul#examples_1 {
+ float: right;
+ margin-right: 10%;
+}
+
#find_information
{
width: 18em;