diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/admin_public_body/_form.rhtml | 82 | ||||
-rw-r--r-- | app/views/admin_public_body/_tag_help.rhtml | 18 | ||||
-rw-r--r-- | app/views/admin_public_body/edit.rhtml | 41 | ||||
-rw-r--r-- | app/views/admin_public_body/import_csv.rhtml | 7 | ||||
-rw-r--r-- | app/views/admin_public_body/new.rhtml | 26 | ||||
-rw-r--r-- | app/views/admin_public_body/show.rhtml | 11 | ||||
-rw-r--r-- | app/views/general/_localised_datepicker.rhtml | 18 | ||||
-rw-r--r-- | app/views/general/advanced_search.rhtml | 0 | ||||
-rw-r--r-- | app/views/general/blog.rhtml | 2 | ||||
-rw-r--r-- | app/views/general/search.rhtml | 170 | ||||
-rw-r--r-- | app/views/layouts/admin.rhtml | 6 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 5 | ||||
-rw-r--r-- | app/views/public_body/list.rhtml | 9 | ||||
-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 | 12 |
16 files changed, 361 insertions, 111 deletions
diff --git a/app/views/admin_public_body/_form.rhtml b/app/views/admin_public_body/_form.rhtml index b1516be2e..191b29e89 100644 --- a/app/views/admin_public_body/_form.rhtml +++ b/app/views/admin_public_body/_form.rhtml @@ -2,48 +2,60 @@ <!--[form:public_body]--> -<div id="tag_help"> - <h2>List of tags</h2> - <% first_row = true %> - <% for row in PublicBodyCategories::CATEGORIES_WITH_HEADINGS %> - <% if row.instance_of?(Array) %> - <% if row[0] != 'other' %> - <strong><%= row[0] %></strong>=<%= row[1] %> - <br/> - <% end %> - <% elsif row != 'Miscellaneous' %> - <% if not first_row %> - <% else %> - <% first_row = false %> - <% end %> - <h3><%=h row%></h3> - <% end %> +<div id="div-locales"> + <ul> + <% for locale in I18n.available_locales do %> + <li><a href="#div-locale-<%=locale.to_s%>"><%=locale_name(locale.to_s)%></a></li> <% end %> + </ul> + +<% + for locale in I18n.available_locales do + if locale==I18n.default_locale # The default locale is submitted as part of the bigger object... + prefix = 'public_body' + object = @public_body + else # ...but additional locales go "on the side" + prefix = "public_body[translated_versions][]" + object = @public_body.new_record? ? + PublicBody::Translation.new : + @public_body.translation(locale.to_s) || PublicBody::Translation.new + end + + fields_for prefix, object do |t| +%> + <div id="div-locale-<%=locale.to_s%>"> + <%= t.hidden_field :locale, :value => locale.to_s %> + + <p><label for="public_body_name">Name</label><br/> + <%= t.text_field :name, :size => 60 %></p> + + <p><label for="public_body_short_name">Short name <small>(only put in abbreviations which are really used, otherwise leave blank. Short or long name is used in the URL - don't worry about breaking URLs through renaming, as the history is used to redirect)</small></label><br/> + <%= t.text_field :short_name, :size => 60 %></p> + + <p><label for="public_body_request_email">Request email <small>(set to <strong>blank</strong> (empty string) if can't find an address; these emails are <strong>public</strong> as anyone can view with a CAPTCHA)</small></label><br/> + <%= t.text_field :request_email, :size => 40 %></p> + + <p><label for="public_body_publication_scheme">Publication scheme URL</label><br/> + <%= t.text_field :publication_scheme, :size => 60 %></p> + + <p><label for="public_body_notes">Public notes</label> <small>(HTML, for users to consider when making FOI requests to the authority)</small><br/> + <%= t.text_area :notes, :rows => 3, :cols => 60 %></p> + </div> +<% + end + end +%> </div> -<p><label for="public_body_name">Name</label><br/> -<%= text_field 'public_body', 'name', :size => 60 %></p> - -<p><label for="public_body_short_name">Short name <small>(only put in abbreviations which are really used, otherwise leave blank. Short or long name is used in the URL - don't worry about breaking URLs through renaming, as the history is used to redirect)</small></label><br/> -<%= text_field 'public_body', 'short_name', :size => 60 %></p> - -<p><label for="public_body_request_email">Request email <small>(set to <strong>blank</strong> (empty string) if can't find an address; these emails are <strong>public</strong> as anyone can view with a CAPTCHA)</small></label><br/> -<%= text_field 'public_body', 'request_email', :size => 40 %></p> +<h3>Common Fields</h3> <p><label for="public_body_tag_string">Tags <small>(space separated; see list of tags on the right; also <strong>not_apply</strong> if FOI and EIR no longer apply to authority, <strong>eir_only</strong> if EIR but not FOI applies to authority, <strong>defunct</strong> if the authority no longer exists; charity:NUMBER if a registered charity)</small></label><br/> -<%= text_field 'public_body', 'tag_string', :size => 60 %></p> +<%= f.text_field :tag_string, :size => 60 %></p> <p><label for="public_body_home_page">Home page <small>(of whole authority, not just their FOI page; set to <strong>blank</strong> (empty string) to guess it from the email)</small></label><br/> -<%= text_field 'public_body', 'home_page', :size => 60 %></p> - -<p><label for="public_body_publication_scheme">Publication scheme URL</label><br/> -<%= text_field 'public_body', 'publication_scheme', :size => 60 %></p> - -<p><label for="public_body_notes">Public notes</label> <small>(HTML, for users to consider when making FOI requests to the authority)</small><br/> -<%= text_area 'public_body', 'notes', :rows => 3, :cols => 60 %></p> +<%= f.text_field :home_page, :size => 60 %></p> <p><label for="public_body_last_edit_comment"><strong>Comment</strong> for this edit</label> <small>(put URL or other source of new info)</small><br/> -<%= text_area 'public_body', 'last_edit_comment', :rows => 3, :cols => 60 %></p> -<!--[eoform:public_body]--> - +<%= f.text_area :last_edit_comment, :rows => 3, :cols => 60 %></p> +<!--[eoform:public_body]--> diff --git a/app/views/admin_public_body/_tag_help.rhtml b/app/views/admin_public_body/_tag_help.rhtml new file mode 100644 index 000000000..7954ff992 --- /dev/null +++ b/app/views/admin_public_body/_tag_help.rhtml @@ -0,0 +1,18 @@ +<div id="tag_help"> + <h2>List of tags</h2> + <% first_row = true %> + <% for row in PublicBodyCategories::CATEGORIES_WITH_HEADINGS %> + <% if row.instance_of?(Array) %> + <% if row[0] != 'other' %> + <strong><%= row[0] %></strong>=<%= row[1] %> + <br/> + <% end %> + <% elsif row != 'Miscellaneous' %> + <% if not first_row %> + <% else %> + <% first_row = false %> + <% end %> + <h3><%=h row%></h3> + <% end %> + <% end %> +</div>
\ No newline at end of file diff --git a/app/views/admin_public_body/edit.rhtml b/app/views/admin_public_body/edit.rhtml index 005ec93ce..b91f15a2e 100644 --- a/app/views/admin_public_body/edit.rhtml +++ b/app/views/admin_public_body/edit.rhtml @@ -1,23 +1,30 @@ - - <h1><%=@title%></h1> -<% form_tag '../update/' + @public_body.id.to_s do %> - <%= render :partial => 'form' %> - <p><%= submit_tag 'Save', :accesskey => 's' %></p> -<% end %> +<script type="text/javascript"> + $(function() { + $("#div-locales").tabs(); + }); +</script> -<p> -<%= link_to 'Show', '../show/' + @public_body.id.to_s %> | -<%= link_to 'List all', '../list' %> -</p> +<%= render :partial => 'tag_help' %> -<% if @public_body.info_requests.size == 0 %> - <% form_tag('../destroy/' + @public_body.id.to_s) do %> - <p> - <%= hidden_field_tag(:public_body_id, { :value => @public_body.id } ) %> - <%= submit_tag "Destroy " + @public_body.name %> (this is permanent!) - </p> +<div id="public_body_form"> + <% form_for @public_body, :url => {:action => 'update'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> + <p><%= f.submit 'Save', :accesskey => 's' %></p> <% end %> -<% end %> + <p> + <%= link_to 'Show', '../show/' + @public_body.id.to_s %> | + <%= link_to 'List all', '../list' %> + </p> + + <% if @public_body.info_requests.size == 0 %> + <% form_tag('../destroy/' + @public_body.id.to_s) do %> + <p> + <%= hidden_field_tag(:public_body_id, { :value => @public_body.id } ) %> + <%= submit_tag "Destroy " + @public_body.name %> (this is permanent!) + </p> + <% end %> + <% end %> +</div> diff --git a/app/views/admin_public_body/import_csv.rhtml b/app/views/admin_public_body/import_csv.rhtml index 50a4b951a..3bcc4bf41 100644 --- a/app/views/admin_public_body/import_csv.rhtml +++ b/app/views/admin_public_body/import_csv.rhtml @@ -23,16 +23,19 @@ <p><strong>CSV file format:</strong> A first row with the list of fields, starting with '#', is optional but highly recommended. The fields 'name' - and 'email' are required; additionaly, translated values are supported by + and 'request_email' are required; additionaly, translated values are supported by adding the locale name to the field name, e.g. 'name.es', 'name.de'... Example: </p> <blockquote> - #id,name,email,name.es<br/> + #id,name,request_email,name.es<br/> 1,An Authority,a@example.com,Un organismo<br/> 2,Another One,another@example.com,Otro organismo<br/> </blockquote> + <p>Supported files: name (i18n), short_name (i18n), request_email (i18n), notes (i18n), + publication_scheme (i18n), home_page.</p> + <p><strong>Note:</strong> Choose <strong>dry run</strong> to test, without actually altering the database. Choose <strong>upload</strong> to actually make the changes. In either case, you will be shown any errors, or details diff --git a/app/views/admin_public_body/new.rhtml b/app/views/admin_public_body/new.rhtml index 95208b5b3..b859fdf6a 100644 --- a/app/views/admin_public_body/new.rhtml +++ b/app/views/admin_public_body/new.rhtml @@ -2,11 +2,21 @@ <h1><%=@title%></h1> -<% form_tag 'create' do %> - <%= render :partial => 'form' %> - <p><%= submit_tag "Create" %></p> -<% end %> - -<p> -<%= link_to 'List all', 'list' %> -</p> +<script type="text/javascript"> + $(function() { + $("#div-locales").tabs(); + }); +</script> + +<%= render :partial => 'tag_help' %> + +<div id="public_body_form"> + <% form_for :public_body, @public_body, :url => {:action => "create"} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> + <p><%= f.submit "Create" %></p> + <% end %> + + <p> + <%= link_to 'List all', 'list' %> + </p> +</div> diff --git a/app/views/admin_public_body/show.rhtml b/app/views/admin_public_body/show.rhtml index c1292c63a..643ccf5e8 100644 --- a/app/views/admin_public_body/show.rhtml +++ b/app/views/admin_public_body/show.rhtml @@ -12,7 +12,7 @@ <% if column.name == 'home_page' and !column.name.empty? %> <%= link_to(h(@public_body.send(column.name)), @public_body.send(column.name)) %> <% elsif column.name == 'request_email' and !column.name.empty? %> - <%= link_to(h(@public_body.send(column.name)), "mailto:" + @public_body.send(column.name)) %> + <%= link_to(h(@public_body.send(column.name)), "mailto:#{@public_body.send(column.name)}") %> <% if !@public_body.is_requestable? %> (not requestable due to: <%=h @public_body.not_requestable_reason %><% if @public_body.is_followupable? %>; but followupable<% end %>) <% end %> @@ -32,7 +32,14 @@ </p> <p> - <%= link_to 'Public page', main_url(public_body_url(@public_body)) %> + <%= + # url_name can be missing if the name hasn't been set for this locale + if !@public_body.url_name.nil? + link_to 'Public page', main_url(public_body_url(@public_body)) + else + 'Public page not available' + end + %> | <%= link_to 'Edit', '../edit/' + @public_body.id.to_s %> </p> diff --git a/app/views/general/_localised_datepicker.rhtml b/app/views/general/_localised_datepicker.rhtml new file mode 100644 index 000000000..5fdd63644 --- /dev/null +++ b/app/views/general/_localised_datepicker.rhtml @@ -0,0 +1,18 @@ +<script type="text/javascript"> + $(function() { + $(".use-datepicker").datepicker( + {closeText: '<%= _("Done") %>', + prevText: '<%= _("Prev") %>', + nextText: '<%= _("Next") %>', + currentText: '<%= _("Today") %>', + monthNames: <%= I18n.translate('date.month_names')[1..-1].to_json %>, + monthNamesShort: <%= I18n.translate('date.abbr_month_names')[1..-1].to_json %>, + dayNames: <%= I18n.translate('date.day_names').to_json %>, + dayNamesShort: <%= I18n.translate('date.abbr_day_names').to_json %>, + dayNamesMin: <%= I18n.translate('date.abbr_day_names').collect{|x| x[0..0]}.to_json %>, + weekHeader: '<%= _("Wk") %>', + dateFormat: '<%= I18n.translate('date.formats.default').sub("%Y", "yy").sub("%m", "mm").sub("%d", "dd").gsub("-", "/") %>'} + ); + }); +</script> + diff --git a/app/views/general/advanced_search.rhtml b/app/views/general/advanced_search.rhtml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/app/views/general/advanced_search.rhtml diff --git a/app/views/general/blog.rhtml b/app/views/general/blog.rhtml index c9387c24f..f5bd66ebd 100644 --- a/app/views/general/blog.rhtml +++ b/app/views/general/blog.rhtml @@ -6,7 +6,7 @@ <% if !@twitter_user.empty? %> <div id="twitter"> <script src="http://widgets.twimg.com/j/2/widget.js"></script> -<script> +<script type="text/javascript"> new TWTR.Widget({ version: 2, type: 'profile', diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml index cc522b367..cc89c28cd 100644 --- a/app/views/general/search.rhtml +++ b/app/views/general/search.rhtml @@ -2,6 +2,16 @@ <% @include_request_link_in_authority_listing = true %> +<%= render :partial => 'localised_datepicker' %> + +<% if @query.nil? %> + <% @title = _("Search Freedom of Information requests, public authorities and users") %> +<% elsif @total_hits == 0 %> + <% @title = _('There were no requests matching your query.') %> +<% else %> + <% @title = _("Results page {{page_number}}", :page_number => @page.to_s) %> +<% end%> + <div id="header_left"> <% if @query.nil? %> <h1>Search</h1> @@ -9,19 +19,108 @@ <h1>Search results</h1> <% end%> - <% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %> - <p> - <%= text_field_tag 'query', @query, { :size => 40 } %> + <% if @advanced %> + <p><%= _('To use the advanced search, combine phrases and labels as described in the search tips below.') %></p> + <% form_tag(advanced_search_url, :method => "get") do %> + <p> + <%= text_field_tag :query, params[:query], { :size => 40 } %> <%= hidden_field_tag 'sortby', @inputted_sortby %> <% if @bodies %> <%= hidden_field_tag 'bodies', 1 %> <% end %> <%= image_submit_tag 'button-search.png', :title=>"Search" %> - <% if not @show_tips %> - <%= link_to _('Advanced search tips'), search_redirect_path %> + <%= link_to _('Simple search'), search_redirect_path %> + </p> + <% end %> + <% else %> + <% form_tag(request.url, {:method => "get", :id => "search_form"}) do %> + <p> + <%= text_field_tag 'query', params[:query], { :size => 40 } %> + <%= hidden_field_tag 'sortby', @inputted_sortby %> + <% if @bodies %> + <%= hidden_field_tag 'bodies', 1 %> <% end %> + <%= image_submit_tag 'button-search.png', :title=>"Search" %> </p> +<fieldset> + <legend> + <%= _("Filters:") %> + </legend> +<div id="common-subfilters"> + <div id="variety-filter"> + <ul> + <% for variety, label in [ + ["all", _("everything")], + ["requests", _("requests")], + ["users", _("users")], + ["bodies", _("authorities")]]%> + <li> + <% if @variety_postfix != variety %> + <% if variety != "users" %> + <%= link_to label, search_url([params[:query], @common_query], variety, @sort_postfix), :method => :get %> + <% else %> + <%= link_to label, search_url(params[:query], variety, @sort_postfix), :method => :get %> + <% end %> + <% else %> + <%= label %> + <% end %> + </li> + <% end %> + </ul> + </div> + +<% if false %> +<%-# Commented out for now as tags are of limited use when users can't see them. This will change in the future! -%> +<% if @variety_postfix != "users" %> + <div> + <%= label_tag(:query, _("Tags (separated by a space):")) %><%= text_field_tag(:tags, params[:tags], { :size => 20 }) %> + <% for tag in InfoRequest.get_tags %> + <%= tag.name_and_value %> + <% end %> + </div> +<% end %> +<% end %> +</div> + +<% if @variety_postfix == "requests" %> +<div id="requests-subfilters"> + <div> + <%= _("Only show:") %> <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> + <%= _("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> + 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> +<% end %> + <%= submit_tag("Filter") %> + </fieldset> <% end %> + <p><%= link_to(_("Advanced search"), advanced_search_url) %></p> +<% end %> + + <% if !@query.nil? %> <p id="search_controls"> @@ -35,7 +134,7 @@ <% end %> </div> -<% if @track_thing %> +<% if @track_thing && (@xapian_bodies_hits > 0 || @xapian_users_hits > 0 || @total_hits == 0)%> <div id="header_right"> <h2>Track this search</h2> <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %> @@ -50,11 +149,11 @@ <% if not @query.nil? %> <div class="results_section"> - <% if @xapian_bodies.results.size > 0 %> - <% if @xapian_bodies.results.size == 1 && @page == 1 %> + <% if @xapian_bodies_hits > 0 %> + <% if @xapian_bodies_hits == 1 && @page == 1 %> <h2 class="publicbody_results"><%= _('One public authority found') %></h2> <% else %> - <h2 class="publicbody_results"><%= _('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)) %></h2> + <h2 class="publicbody_results"><%= _('Public authorities {{start_count}} to {{end_count}} of {{total_count}}', :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) %></h2> <% end %> <div class="results_block"> @@ -74,11 +173,11 @@ </div> <div class="results_section"> - <% if @xapian_users.results.size > 0 %> - <% if @xapian_users.results.size == 1 && @page == 1 %> + <% if @xapian_users_hits > 0 %> + <% if @xapian_users_hits == 1 && @page == 1 %> <h2 class="person_results"><%= _("One person found") %></h2> <% else %> - <h2 class="person_results"><%= _("People {{start_count}} to {{end_count}} of {{total_count}} for ‘{{user_search_query}}’", :start_count => ((@page-1)*@users_per_page+1).to_s, :end_count => [@page*@users_per_page, @xapian_users.matches_estimated].min.to_s, :total_count => @xapian_users.matches_estimated.to_s, :user_search_query => h(@query)) %></h2> + <h2 class="person_results"><%= _("People {{start_count}} to {{end_count}} of {{total_count}}", :start_count => ((@page-1)*@users_per_page+1).to_s, :end_count => [@page*@users_per_page, @xapian_users.matches_estimated].min.to_s, :total_count => @xapian_users.matches_estimated.to_s) %></h2> <% end %> <div class="results_block"> @@ -92,11 +191,11 @@ </div> <div class="results_section"> - <% if @xapian_requests.results.size > 0 %> - <% if @xapian_requests.results.size == 1 && @page == 1 %> + <% if @xapian_requests_hits > 0 %> + <% if @xapian_requests_hits == 1 && @page == 1 %> <h2 class="foi_results"><%= _("One FOI request found") %></h2> <% else %> - <h2 class="foi_results"><%= _("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)) %></h2> + <h2 class="foi_results"><%= _("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) %></h2> <% end %> <div class="results_block"> @@ -110,7 +209,10 @@ </div> <% end %> -<% if @show_tips %> +<% if @advanced %> + +<div id="advanced-search-tips"> + <a name="show-tips"></a> <h2><%= _("Advanced search tips")%></h2> <ul> <li><%= _("Enter words that you want to find separated by spaces, e.g. <strong>climbing lane</strong>") %></li> @@ -132,28 +234,30 @@ <h2 id="statuses"><%= _('Table of statuses') %></h2> <table class="status_table"> - <tr><td><strong><%=search_link('status:waiting_response')%></strong></td><td><%= _('Waiting for the public authority to reply') %></td></tr> - <tr><td><strong><%=search_link('status:not_held')%></strong></td><td><%= _('The public authority does not have the information requested') %></td></tr> - <tr><td><strong><%=search_link('status:rejected')%></strong></td><td><%= _('The request was refused by the public authority') %></td></tr> - <tr><td><strong><%=search_link('status:partially_successful')%></strong></td><td><%= _('Some of the information requested has been received') %></td></tr> - <tr><td><strong><%=search_link('status:successful')%></strong></td><td><%= _('All of the information requested has been received') %></td></tr> - <tr><td><strong><%=search_link('status:waiting_clarification')%></strong></td><td><%= _('The public authority would like part of the request explained') %></td></tr> - <tr><td><strong><%=search_link('status:gone_postal')%></strong></td><td><%= _('The public authority would like to / has responded by post') %></td></tr> - <tr><td><strong><%=search_link('status:internal_review')%></strong></td><td><%= _('Waiting for the public authority to complete an internal review of their handling of the request') %></td></tr> - <tr><td><strong><%=search_link('status:error_message')%></strong></td><td><%= _('Received an error message, such as delivery failure.') %></td></tr> - <tr><td><strong><%=search_link('status:requires_admin')%></strong></td><td><%= _('A strange reponse, required attention by the {{site_name}} team', :site_name=>site_name) %></td></tr> - <tr><td><strong><%=search_link('status:user_withdrawn')%></strong></td><td><%= _('The requester has abandoned this request for some reason') %></td></tr> + <tr><td><strong><%=search_link('status:waiting_response', nil, nil, true)%></strong></td><td><%= _('Waiting for the public authority to reply') %></td></tr> + <tr><td><strong><%=search_link('status:not_held', nil, nil, true)%></strong></td><td><%= _('The public authority does not have the information requested') %></td></tr> + <tr><td><strong><%=search_link('status:rejected', nil, nil, true)%></strong></td><td><%= _('The request was refused by the public authority') %></td></tr> + <tr><td><strong><%=search_link('status:partially_successful', nil, nil, true)%></strong></td><td><%= _('Some of the information requested has been received') %></td></tr> + <tr><td><strong><%=search_link('status:successful', nil, nil, true)%></strong></td><td><%= _('All of the information requested has been received') %></td></tr> + <tr><td><strong><%=search_link('status:waiting_clarification', nil, nil, true)%></strong></td><td><%= _('The public authority would like part of the request explained') %></td></tr> + <tr><td><strong><%=search_link('status:gone_postal', nil, nil, true)%></strong></td><td><%= _('The public authority would like to / has responded by post') %></td></tr> + <tr><td><strong><%=search_link('status:internal_review', nil, nil, true)%></strong></td><td><%= _('Waiting for the public authority to complete an internal review of their handling of the request') %></td></tr> + <tr><td><strong><%=search_link('status:error_message', nil, nil, true)%></strong></td><td><%= _('Received an error message, such as delivery failure.') %></td></tr> + <tr><td><strong><%=search_link('status:requires_admin', nil, nil, true)%></strong></td><td><%= _('A strange reponse, required attention by the {{site_name}} team', :site_name=>site_name) %></td></tr> + <tr><td><strong><%=search_link('status:user_withdrawn', nil, nil, true)%></strong></td><td><%= _('The requester has abandoned this request for some reason') %></td></tr> </table> <h2 id="varieties"><%= _('Table of varieties') %></h2> <table class="status_table"> - <tr><td><strong><%=search_link('variety:sent')%></strong></td><td><%= _('Original request sent') %></td></tr> - <tr><td><strong><%=search_link('variety:followup_sent')%></strong></td><td><%= _('Follow up message sent by requester') %></td></tr> - <tr><td><strong><%=search_link('variety:response')%></strong></td><td><%= _('Response from a public authority') %></td></tr> - <tr><td><strong><%=search_link('variety:comment')%></strong></td><td><%= _('Annotation added to request') %></td></tr> - <tr><td><strong><%=search_link('variety:authority')%></strong></td><td><%= _('A public authority') %></td></tr> - <tr><td><strong><%=search_link('variety:user')%></strong></td><td><%= _('A {{site_name}} user', :site_name=>site_name) %></td></tr> + <tr><td><strong><%=search_link('variety:sent', nil, nil, true)%></strong></td><td><%= _('Original request sent') %></td></tr> + <tr><td><strong><%=search_link('variety:followup_sent', nil, nil, true)%></strong></td><td><%= _('Follow up message sent by requester') %></td></tr> + <tr><td><strong><%=search_link('variety:response', nil, nil, true)%></strong></td><td><%= _('Response from a public authority') %></td></tr> + <tr><td><strong><%=search_link('variety:comment', nil, nil, true)%></strong></td><td><%= _('Annotation added to request') %></td></tr> + <tr><td><strong><%=search_link('variety:authority', nil, nil, true)%></strong></td><td><%= _('A public authority') %></td></tr> + <tr><td><strong><%=search_link('variety:user', nil, nil, true)%></strong></td><td><%= _('A {{site_name}} user', :site_name=>site_name) %></td></tr> </table> +</div> + <% end %> diff --git a/app/views/layouts/admin.rhtml b/app/views/layouts/admin.rhtml index f0e9a7019..42ca5dbbb 100644 --- a/app/views/layouts/admin.rhtml +++ b/app/views/layouts/admin.rhtml @@ -3,6 +3,10 @@ <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8" > <title><%= site_name %> admin<%= @title ? ":" : "" %> <%=@title%></title> + + <%= 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 'admin', :title => "Main", :rel => "stylesheet" %> </head> <body> @@ -30,6 +34,6 @@ <% end %> <%= yield %> - + </body> </html> diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 4565da5b8..61cf1e0ab 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -17,10 +17,11 @@ </title> <link rel="shortcut icon" href="/favicon.ico"> - <%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet" %> <%= stylesheet_link_tag 'fonts', :rel => "stylesheet" %> <%= stylesheet_link_tag 'theme', :rel => "stylesheet" %> + <%= javascript_include_tag 'jquery.js', 'jquery-ui.min' %> + <%= stylesheet_link_tag 'admin-theme/jquery-ui-1.8.15.custom.css', :rel => 'stylesheet'%> <!--[if LT IE 7]> <style type="text/css">@import url("/stylesheets/ie6.css");</style> <![endif]--> @@ -94,7 +95,7 @@ <div id="topnav"> <ul id="navigation"> <li class="<%= 'selected' if params[:controller] == 'general' %>"><%= link_to _("Make a request"), frontpage_url %></li> - <li class="<%= 'selected' if params[:controller] == 'request' %>"><%= link_to _("View requests"), request_list_successful_url %></li> + <li class="<%= 'selected' if params[:controller] == 'request' %>"><%= link_to _("View requests"), request_list_all_url %></li> <li class="<%= 'selected' if params[:controller] == 'public_body' %>"><%= link_to _("View authorities"), list_public_bodies_default %></li> <li class="<%= 'selected' if params[:controller] == 'blog' %>"><%= link_to _("Read blog"), blog_url %></li> <li class="<%= 'selected' if params[:controller] == 'help' %>"><%= link_to _("Help"), help_about_url %></li> diff --git a/app/views/public_body/list.rhtml b/app/views/public_body/list.rhtml index 912f2696a..65c24430d 100644 --- a/app/views/public_body/list.rhtml +++ b/app/views/public_body/list.rhtml @@ -38,6 +38,15 @@ <h1>Public authorities</h1> <h2 class="publicbody_results"><%= _('Found {{count}} public bodies {{description}}', :count=>@public_bodies.size, :description=>@description) %></h2> + +<% form_tag(request.url, :method => "get") do %> + <div> + <%= label_tag(:public_body_query, _("Search:")) %> + <%= text_field_tag(:public_body_query, params[:public_body_query]) %> + <%= submit_tag(_("Search")) %> + </div> +<% end %> + <%= render :partial => 'body_listing', :locals => { :public_bodies => @public_bodies } %> <%= will_paginate(@public_bodies) %><br/> diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index cfdf37935..f82ffa41e 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -65,7 +65,7 @@ </div> <div style="clear:both"> </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> @@ -83,13 +83,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..33b7bfb27 --- /dev/null +++ b/app/views/request/_request_filter_form.rhtml @@ -0,0 +1,55 @@ +<%= render :partial => 'general/localised_datepicker' %> + +<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> + <% form_tag(request.path, :method => "get") do %> + <div class="list-filter-item"> + <%= label_tag(:query, _("Search for:")) %> + <%= text_field_tag(:query, params[:query]) %> + </div> +<% if false # don't think we want this, but leaving as an example %> + <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> +<% end %> + <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 fcd4cfbf2..28dc55cdf 100644 --- a/app/views/request/list.rhtml +++ b/app/views/request/list.rhtml @@ -1,11 +1,7 @@ + <div id="header_left"> <h1><%=@title%></h1> - - <p> - <i>Showing:</i> - <%= link_to_unless (@view == 'successful'), 'Successful requests', request_list_successful_url(:view => 'successful') %> | - <%= link_to_unless (@view == 'recent'), 'Successful requests', request_list_recent_url(:view => 'recent') %> - </p> + <%= render :partial => 'request/request_filter_form' %> </div> <div id="header_right"> @@ -22,7 +18,7 @@ <% if @list_results.empty? %> <p> <%= _('No requests of this sort yet.')%></p> <% else %> - <h2 class="foi_results"><%= _('2 FOI requests found') %></h2> + <h2 class="foi_results"><%= _('{{count}} FOI requests found', :count => @list_results.size) %></h2> <div class="results_block"> <% for result in @list_results%> <% if result.class.to_s == 'InfoRequestEvent' %> @@ -36,4 +32,4 @@ <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @matches_estimated) %> <% end %> -</div>
\ No newline at end of file +</div> |