aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/general
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/general')
-rw-r--r--app/views/general/_public_body_query.rhtml5
-rw-r--r--app/views/general/frontpage.rhtml69
-rw-r--r--app/views/general/search.rhtml30
3 files changed, 104 insertions, 0 deletions
diff --git a/app/views/general/_public_body_query.rhtml b/app/views/general/_public_body_query.rhtml
new file mode 100644
index 000000000..77efdfcc1
--- /dev/null
+++ b/app/views/general/_public_body_query.rhtml
@@ -0,0 +1,5 @@
+<ul>
+<% for public_body in @public_bodies %>
+<li><%=h public_body.name %></li>
+<% end %>
+</ul>
diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml
new file mode 100644
index 000000000..e3fb54ca8
--- /dev/null
+++ b/app/views/general/frontpage.rhtml
@@ -0,0 +1,69 @@
+<%= render :partial => 'help/alpha_notice' %>
+
+<div id="make_requests">
+ <h1>Make requests for information from the UK Government</h1>
+
+ <% if @public_bodies.size == 0 and @query_made %>
+ <div id="error">
+ Sorry! We couldn't find any public bodies with that in their names.
+ Either <a href="/body">browse them all</a> or
+ <a href="/help/contact">ask us to add the one you want</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 body 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]=' + 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 bodies 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">Browse all</a> or <a href="/help/contact">ask us to add it</a>.
+ </p>
+ <% end %>
+</div>
+
+<div id="find_information">
+ <h1>Explore information that others requested</h1>
+ <% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %>
+ <p>
+ <%= text_field_tag 'query', params[:query], { :size => 20 } %>
+ <%= submit_tag "Search" %>
+ </p>
+ <% end %>
+ <%= render :partial => 'request/request_listing', :locals => { :info_requests => @info_requests } %>
+ <p><a href="/list">View all information</a></p>
+</div>
diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml
new file mode 100644
index 000000000..5d848c66a
--- /dev/null
+++ b/app/views/general/search.rhtml
@@ -0,0 +1,30 @@
+<% @title = "Freedom of Information requests matching '" + h(params[:query]) + "'" %>
+
+<% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %>
+ <p>
+ <%= text_field_tag 'query', params[:query], { :size => 40 } %>
+ <%= submit_tag "Search" %>
+ </p>
+<% end %>
+
+<h1><%=@title%></h1>
+
+<% if @search_results.empty? %>
+ None found.
+<% else %>
+ <% for search_result in @search_results %>
+ <% if search_result.class.to_s == 'InfoRequest' %>
+ <%= render :partial => 'request/request_listing_single', :locals => { :info_request => search_result } %>
+ <% elsif search_result.class.to_s == 'OutgoingMessage' %>
+ <%= render :partial => 'request/request_listing_single', :locals => { :info_request => search_result.info_request } %>
+ <% elsif search_result.class.to_s == 'IncomingMessage' %>
+ <%= render :partial => 'request/request_listing_single', :locals => { :info_request => search_result.info_request } %>
+ <% else %>
+ <p><strong>Unknown search result type <%=search_result.class.to_s%></strong></p>
+ <% end %>
+ <% end %>
+<% end %>
+
+<%
+#= will_paginate(@info_requests)
+%>