aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/general_controller.rb43
-rw-r--r--app/views/general/frontpage.rhtml79
-rw-r--r--app/views/layouts/default.rhtml2
-rw-r--r--config/routes.rb3
4 files changed, 5 insertions, 122 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 3cd9504eb..7dc8389e5 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.39 2008-09-05 09:30:23 francis Exp $
+# $Id: general_controller.rb,v 1.40 2008-09-08 01:58:55 francis Exp $
class GeneralController < ApplicationController
@@ -16,55 +16,18 @@ class GeneralController < ApplicationController
render :partial => "public_body_query"
end
- # Actual front page
- def frontpage
- # Public body search on the left
- @public_bodies = []
- @query_made = false
- if params[:public_body] and params[:public_body][:query]
- # Try and do exact match - redirect if it is made
- @public_body = PublicBody.find_by_name(params[:public_body][:query])
- if not @public_body.nil?
- redirect_to public_body_url(@public_body)
- end
- # Otherwise use search engine to find public body
- @public_bodies = public_body_query(params[:public_body][:query])
- @query_made = true
- end
-
- # Get all successful requests for display on the right
- query = 'variety:response (status:successful OR status:partially_successful)'
- sortby = "described"
- @xapian_object = perform_search([InfoRequestEvent], query, sortby, 'request_collapse', 3)
- end
-
# New, improved front page!
def new_frontpage
# This is too slow
#@popular_bodies = PublicBody.find(:all, :select => "*, (select count(*) from info_requests where info_requests.public_body_id = public_bodies.id) as c", :order => "c desc", :limit => 32)
+ # Just hardcode some popular authorities for now
@popular_bodies = PublicBody.find(:all, :conditions => ["url_name in ('bbc', 'dwp', 'dh', 'local_government_ombudsmen', 'royal_mail_group', 'mod', 'lambeth_borough_council', 'edinburgh_council')"])
-# <li><a href="/body/bbc">British Broadcasting Corporation</a> </li>
- #
- # <li><a href="/body/home_office">Home Office</a> </li>
- #
- # <li><a href="/body/dwp">Department for Work and Pensions</a> </li>
- #
- # <li><a href="/body/local_government_ombudsmen">Local Government Ombudsmen</a> </li>
- #
- # <li><a href="/body/cabinet_office">Cabinet Office</a> </li>
- ##
- # <li><a href="/body/mod">Ministry of Defence</a> </li>
- #
- # <li><a href="/body/dh">Department of Health</a> </li>
- #
- ## <li><a href="/body/fco">Foreign and Commonwealth Office</a> </li>
-
# This is too slow
#@random_requests = InfoRequest.find(:all, :order => "random()", :limit => 8, :conditions => ["described_state = ? and prominence = ?", 'successful', 'normal'] )
- # Get somesuccessful requests
+ # Get some successful requests
query = 'variety:response (status:successful OR status:partially_successful)'
sortby = "described"
@xapian_object = perform_search([InfoRequestEvent], query, sortby, 'request_collapse', 8)
diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml
deleted file mode 100644
index 121758bbe..000000000
--- a/app/views/general/frontpage.rhtml
+++ /dev/null
@@ -1,79 +0,0 @@
-<div id="make_requests">
- <h1>Make requests in public for UK government information</h1>
-
- <% if @public_bodies.size == 0 and @query_made %>
- <div id="error">
- Sorry! We couldn't find any public authorities with that in their names.
- Either <a href="/body/list/other">browse them all</a> or
- <a href="/help/about#missing_body">help us add it</a>.
- </div>
- <% end %>
-
- <% form_tag({:action => :frontpage}, :method => 'get', :id => 'public_body_form', :class => 'plaque' ) do %>
- <p>
- <label for="public_body_query">Find the public authority you would like information from:</label>
- </p>
-
- <!-- Autocomplete field, which submits form when user picks entry -->
- <div>
- <%= text_field_with_auto_complete 'public_body', 'query', {}, { :skip_style => true, :frequency => 0.1,
- :after_update_element =>
- "function(element,value) {
- parent.window.location = '/?public_body[query]=' + encode(element.value)
- }"
- } %>
- </div>
- <div class="public_body_search_note">
- Type to search e.g. Health, Business, Scotland
- </div>
-
- <!-- Show search button if javascript isn't there -->
- <p id="public_body_query_button">
- <%= submit_tag "Search" %>
- </p>
- <script type="text/javascript">
- Element.toggle('public_body_query_button')
- </script>
-
- <% if @public_bodies.size > 0 %>
- <div id="public_body_search">
- <ul>
- <strong>Public authorities found</strong>
- <% for public_body in @public_bodies %>
- <li>
- <%= link_to h(public_body.name), new_request_to_body_url(:public_body_id => public_body.id.to_s) %>
- </li>
- <% end %>
- </ul>
- </div>
- <% end %>
-
- <p>
- Can't find it? <a href="/body/list/other">Browse all</a> or <a href="/help/about#missing_body">ask us to add it</a>.
- </p>
- <% end %>
-</div>
-
-<div id="find_information">
- <h1>Explore government information that others received</h1>
- <% if @xapian_object.results.empty? %>
- <p>None yet.</p>
- <% else %>
- <% for result in @xapian_object.results %>
- <% if result[:model].class.to_s == 'InfoRequestEvent' %>
- <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
- <% else %>
- <p><strong>Unexpected search result type <%=result[:model].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 } %>
- <%= submit_tag "Search" %>
- </p>
- <% end %>
-</div>
-
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml
index 4d3a0952e..0d2fba5f8 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.rhtml
@@ -1,7 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-gb">
<head>
- <%= javascript_include_tag :defaults %>
+ <!-- <%= javascript_include_tag :defaults %> -->
<script type="text/javascript" src="/jslib/spell/spellChecker.js"></script>
<title>
<% if @title %>
diff --git a/config/routes.rb b/config/routes.rb
index bb82d50cb..4f8de5fe5 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.70 2008-09-05 09:05:06 francis Exp $
+# $Id: routes.rb,v 1.71 2008-09-08 01:58:55 francis Exp $
ActionController::Routing::Routes.draw do |map|
@@ -15,7 +15,6 @@ ActionController::Routing::Routes.draw do |map|
# Keep in mind you can assign values other than :controller and :action
map.with_options :controller => 'general' do |general|
- general.frontpage '/old_frontpage', :action => 'frontpage'
general.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'