aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/general/_public_body_query.rhtml (renamed from app/views/request/_public_body_query.rhtml)0
-rw-r--r--app/views/general/frontpage.rhtml (renamed from app/views/request/frontpage.rhtml)8
-rw-r--r--app/views/general/search.rhtml30
-rw-r--r--app/views/request/_request_listing.rhtml25
-rw-r--r--app/views/request/_request_listing_single.rhtml18
5 files changed, 62 insertions, 19 deletions
diff --git a/app/views/request/_public_body_query.rhtml b/app/views/general/_public_body_query.rhtml
index 77efdfcc1..77efdfcc1 100644
--- a/app/views/request/_public_body_query.rhtml
+++ b/app/views/general/_public_body_query.rhtml
diff --git a/app/views/request/frontpage.rhtml b/app/views/general/frontpage.rhtml
index 508f5105c..e3fb54ca8 100644
--- a/app/views/request/frontpage.rhtml
+++ b/app/views/general/frontpage.rhtml
@@ -58,6 +58,12 @@
<div id="find_information">
<h1>Explore information that others requested</h1>
- <%= render :partial => 'request_listing', :locals => { :info_requests => @info_requests } %>
+ <% 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)
+%>
diff --git a/app/views/request/_request_listing.rhtml b/app/views/request/_request_listing.rhtml
index 4c31f470a..ebfbc60a4 100644
--- a/app/views/request/_request_listing.rhtml
+++ b/app/views/request/_request_listing.rhtml
@@ -1,19 +1,8 @@
-<% for info_request in info_requests %>
- <p class="request_listing">
- <%= request_link(info_request) %>
-
- <br>
- <%=h excerpt(info_request.initial_request_text, "", 300) %>
- <br>
-
- <span class="request_listing_bottomline">
- <strong>
- <%= info_request.display_status %>
- </strong>
-
- Requested from <%= public_body_link(info_request.public_body) %>
- by <%= user_link(info_request.user) %>
- on <%= simple_date(info_request.created_at) %>.
- </span>
- </p>
+<% if info_requests.empty? %>
+ None found.
+<% else %>
+ <% for info_request in info_requests %>
+ <%= render :partial => 'request/request_listing_single', :locals => { :info_request => info_request } %>
+ <% end %>
<% end %>
+
diff --git a/app/views/request/_request_listing_single.rhtml b/app/views/request/_request_listing_single.rhtml
new file mode 100644
index 000000000..b91d9c640
--- /dev/null
+++ b/app/views/request/_request_listing_single.rhtml
@@ -0,0 +1,18 @@
+<p class="request_listing">
+ <%= request_link(info_request) %>
+
+ <br>
+ <%=h excerpt(info_request.initial_request_text, "", 300) %>
+ <br>
+
+ <span class="request_listing_bottomline">
+ <strong>
+ <%= info_request.display_status %>
+ </strong>
+
+ Requested from <%= public_body_link(info_request.public_body) %>
+ by <%= user_link(info_request.user) %>
+ on <%= simple_date(info_request.created_at) %>.
+ </span>
+</p>
+