diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/general/search.rhtml | 71 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 5 | ||||
-rw-r--r-- | app/views/public_body/list.rhtml | 10 | ||||
-rw-r--r-- | app/views/public_body/show.rhtml | 10 | ||||
-rw-r--r-- | app/views/request/_request_filter_form.rhtml | 55 | ||||
-rw-r--r-- | app/views/request/list.rhtml | 37 |
6 files changed, 127 insertions, 61 deletions
diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml index 1d934f65a..c66c41774 100644 --- a/app/views/general/search.rhtml +++ b/app/views/general/search.rhtml @@ -2,15 +2,15 @@ <% if @query.nil? %> <% @title = _("Search Freedom of Information requests, public authorities and users") %> - <h1><%=@title%></h1> <% elsif @total_hits == 0 %> - <%= _("Nothing found for ‘{{search_terms}}’", :search_terms => h(@query)) %> + <% @title = _('There were no requests matching your query.') %> <% else %> <% @title = _("Results page {{page_number}}", :page_number => @page.to_s) %> <% end%> - <% @include_request_link_in_authority_listing = true %> +<h1><%=@title%></h1> + <% if @bodies && (@page == 1 || @xapian_bodies.results.size > 0) %> <div id="stepwise_instructions"> <p><strong><%=_("Next, select the public authority you'd like to make the request from.") %></strong></p> @@ -19,19 +19,56 @@ </div> <% end %> -<% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %> - <p> - <%= text_field_tag 'query', @query, { :size => 40 } %> - <%= hidden_field_tag 'sortby', @inputted_sortby %> - <% if @bodies %> - <%= hidden_field_tag 'bodies', 1 %> - <% end %> - <%= submit_tag _("Search") %> +<script> + $(function() { + $(".use-datepicker").datepicker(); + }); +</script> + +<div id="list-filter"> + + <div class="list-search-item"> + <% form_tag(search_redirect_url, :method => "get") do %> + <%= label_tag(:query, _("Search for:")) %> + <%= text_field_tag(:query, params[:query], { :size => 40 }) %> + <%= submit_tag("Search") %> + </div> + <div class="list-filter-item"> + <%= _("Restrict search to:") %> <br /> + <% [["successful", _("successful requests")], + ["unsuccessful", _("unsuccessful requests")], + ["awaiting", _("unresolved requests")], + ["internal_review", _("internal reviews")]].each_with_index do |item, index| + + status, title = item %> + <%= check_box_tag "latest_status[]", status, params[:latest_status].nil? ? false : params[:latest_status].include?(status), :id => "latest_status_#{index}" %> + <%= label_tag("latest_status_#{index}", title) %> <br/> + <% end %> + </div> + <div class="list-filter-item"> + <%= _("Search for words in:") %> <br/> + <% [["sent", _("messages from users")], + ["response", _("messages from authorities")], + ["comment", _("comments")]].each_with_index do |item, index| + variety, title = item %> + + <%= check_box_tag "request_variety[]", variety, params[:request_variety].nil? ? true : params[:request_variety].include?(variety), :id => "request_variety_#{index}" %> + <%= label_tag("request_variety_#{index}", title) %> <br/> + <% end %> + </div> + <div class="list-filter-item"> + Search between dates: + <%= text_field_tag(:request_date_after, params[:request_date_after], {:class => "use-datepicker", :size => 10}) %> - + <%= text_field_tag(:request_date_before, params[:request_date_before], {:class => "use-datepicker", :size => 10}) %> + </div> +<% end %> + <% if not @show_tips %> <%= link_to _('Advanced search tips'), search_redirect_path %> <% end %> - </p> -<% end %> + + +</div> <% if !@query.nil? %> <p> @@ -53,10 +90,6 @@ <p><%= _('<a href="%s">Browse all</a> or <a href="%s">ask us to add one</a>.') % [list_public_bodies_default, help_requesting_path + '#missing_body'] %></p> <% end %> -<% if @total_hits == 0 %> - <h1><%=@title %></h1> -<% end %> - <% if not @query.nil? %> <% if @spelling_correction %> <p id="did_you_mean"><%= _('Did you mean: {{correction}}', :correction => search_link(@spelling_correction, @postfix)) %></p> @@ -68,7 +101,7 @@ <% if @xapian_bodies.results.size > 0 %> <% if @xapian_bodies.results.size == 1 && @page == 1 %> - <h1><%= _('One public authority matching ‘{{user_search_query}}’', :user_search_query => h(@query)) %></h1> + <h1><%= _('One public authority matching your search', :user_search_query => h(@query)) %></h1> <% else %> <h1><%= _('Public authorities {{start_count}} to {{end_count}} of {{total_count}} for {{user_search_query}}', :start_count => ((@page-1)*@bodies_per_page+1).to_s, :end_count => [@page*@bodies_per_page, @xapian_bodies.matches_estimated].min.to_s, :total_count => @xapian_bodies.matches_estimated.to_s, :user_search_query => h(@query)) %></h1> <% end %> @@ -98,7 +131,7 @@ <% if @xapian_requests.results.size == 1 && @page == 1 %> <h1><%= _("One FOI request matching ‘{{user_search_query}}’", :user_search_query => h(@query)) %></h1> <% else %> - <h1><%= _("FOI requests {{start_count}} to {{end_count}} of {{total_count}} for ‘{{user_search_query}}’", :start_count => ((@page-1)*@requests_per_page+1).to_s, :end_count => [@page*@requests_per_page, @xapian_requests.matches_estimated].min.to_s, :total_count => @xapian_requests.matches_estimated.to_s, :user_search_query => h(@query)) %></h1> + <h1><%= _("FOI requests {{start_count}} to {{end_count}} of {{total_count}}", :start_count => ((@page-1)*@requests_per_page+1).to_s, :end_count => [@page*@requests_per_page, @xapian_requests.matches_estimated].min.to_s, :total_count => @xapian_requests.matches_estimated.to_s, :user_search_query => h(@query)) %></h1> <% end %> <% if @track_thing %> diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 94ec5a956..e1e7a1e19 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -15,9 +15,10 @@ <%= site_name %> - <%= _('Make and browse Freedom of Information (FOI) requests') %> <% end %> </title> - + <link rel="shortcut icon" href="/favicon.ico"> - + <%= javascript_include_tag 'jquery.js', 'jquery-ui.min' %> + <%= stylesheet_link_tag 'admin-theme/jquery-ui-1.8.15.custom.css', :rel => 'stylesheet'%> <%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet" %> <!--[if LT IE 7]> <style type="text/css">@import url("/stylesheets/ie6.css");</style> diff --git a/app/views/public_body/list.rhtml b/app/views/public_body/list.rhtml index 5d88b1501..9c36d076b 100644 --- a/app/views/public_body/list.rhtml +++ b/app/views/public_body/list.rhtml @@ -38,14 +38,18 @@ <h1><%=@title%></h1> +<% form_tag(request.url, :method => "get") do %> + <%= label_tag(:public_body_query, _("Search:")) %> + <%= text_field_tag(:public_body_query, params[:public_body_query]) %> + <%= submit_tag(_("Search")) %> + <%= submit_tag(_("Show all")) %> +<% end %> + <p class="subtitle"> <%= @public_bodies.size %> <%= _('in total') %> (<%= _('<a href="%s">can\'t find the one you want?</a>') % [help_requesting_path + '#missing_body'] %>) </p> -<% if @tag.size == 1 %> - <p><%= render :partial => 'alphabet' %></p> -<% end %> <%= render :partial => 'body_listing', :locals => { :public_bodies => @public_bodies } %> <% if @tag.size == 1 && @public_bodies.size > 0 %> <p><%= render :partial => 'alphabet' %></p> diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index 36bba8851..92f07ef1c 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -64,7 +64,7 @@ </div> <% if !@xapian_requests.nil? %> - <% if @xapian_requests.results.empty? %> + <% if @public_body.info_requests.size == 0 %> <% if @public_body.eir_only? %> <h2><%= _('Environmental Information Regulations requests made using this site') %></h2> <p>Nobody has made any Environmental Information Regulations requests to <%=h(@public_body.name)%> using this site yet.</p> @@ -82,13 +82,19 @@ <%= @page_desc %> </h2> + <%= render :partial => 'request/request_filter_form' %> + <% for result in @xapian_requests.results %> <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> <% end %> <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @public_body.info_requests.size) %> - <p> <%= _('Only requests made using {{site_name}} are shown.', :site_name => site_name) %></p> + <% if @xapian_requests.results.empty? %> + <p><% _('There were no requests matching your query.')</p> + <% else %> + <p> <%= _('Only requests made using {{site_name}} are shown.', :site_name => site_name) %></p> + <% end %> <% end %> <% else %> diff --git a/app/views/request/_request_filter_form.rhtml b/app/views/request/_request_filter_form.rhtml new file mode 100644 index 000000000..e88ec2723 --- /dev/null +++ b/app/views/request/_request_filter_form.rhtml @@ -0,0 +1,55 @@ +<script> + $(function() { + $(".use-datepicker").datepicker(); + }); +</script> + +<div id="list-filter"> + <div class="list-filter-item"> + Showing: + <ul class="request-selector"> + <% for status, label in [["all", _("all requests")], + ["successful", _("successful requests")], + ["unsuccessful", _("unsuccessful requests")], + ["awaiting", _("unresolved requests")]] %> + <li> + <% if params[:view] != status %> + <% if params[:controller] == "public_body" %> + <%= link_to label, url_for(:controller => "public_body", :action => "show", :view => status, :url_name => @public_body.url_name) + "?#{request.query_string}" %> + <% else %> + <%= link_to label, url_for(:controller => "request", :action => "list", :view => status) + "?#{request.query_string}" %> + <% end %> + <% else %> + <%= label %> + <% end %> + </li> + <% end %> + </ul> + </div> + <div class="list-filter-item"> + <% form_tag({}, :method => "get") do %> + <%= label_tag(:query, _("Search for:")) %> + <%= text_field_tag(:query, params[:query]) %> + </div> + <div class="list-filter-item"> + <%= _("Search for words in:") %> <br/> + <% [["sent", _("messages from users")], + ["response", _("messages from authorities")], + ["comment", _("comments")]].each_with_index do |item, index| + variety, title = item %> + + <%= check_box_tag "request_variety[]", variety, params[:request_variety].nil? ? true : params[:request_variety].include?(variety), :id => "request_variety_#{index}" %> + <%= label_tag("request_variety_#{index}", title) %> <br/> + <% end %> + </div> + <div class="list-filter-item"> + Search between dates: + <%= text_field_tag(:request_date_after, params[:request_date_after], {:class => "use-datepicker", :size => 10}) %> - + <%= text_field_tag(:request_date_before, params[:request_date_before], {:class => "use-datepicker", :size => 10}) %> + </div> + + <div class="list-filter-item"> + <%= submit_tag("Search") %> + </div> +<% end %> +</div> diff --git a/app/views/request/list.rhtml b/app/views/request/list.rhtml index 50e98f6e1..a434566ac 100644 --- a/app/views/request/list.rhtml +++ b/app/views/request/list.rhtml @@ -1,42 +1,9 @@ -<div id="list-filter"> -<% form_tag({}, :method => "get") do %> - <%= label_tag(:query, "Search for:") %> - <%= text_field_tag(:query, params[:query]) %> <br/> - <% [["sent", "messages from users"], - ["response", "messages from authorities"], - ["comment", "comments"]].each_with_index do |item, index| - variety, title = item %> - - <%= check_box_tag "request_variety[]", variety, params[:request_variety].nil? ? true : params[:request_variety].include?(variety), :id => "request_variety_#{index}" %> - <%= label_tag("request_variety_#{index}", title) %> <br /> - <% end %> - <ul class="request-selector"> - <% for status in ["all", "successful", "unsuccessful", "awaiting"] %> - <li> - <% if params[:view] != status %> - <%= link_to "#{status} requests", url_for(:controller => "request", :action => "list", :view => status) + "?#{request.query_string}" %> - <% else %> - <%= status %> requests - <% end %> - </li> - <% end %> - </ul> - - <div class="filter-item last"> - between dates: - <input type="text" name="request_date_after" /> from<br> - <input type="text" name="request_date_before" /> to<br> - </div> - - - - <%= submit_tag("Search") %> -<% end %> -</div> <h1><%=@title%></h1> +<%= render :partial => 'request/request_filter_form' %> + <% if @track_thing %> <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %> <% end %> |