diff options
Diffstat (limited to 'app/views/general')
-rw-r--r-- | app/views/general/_advanced_search_tips.rhtml | 49 | ||||
-rw-r--r-- | app/views/general/_credits.rhtml | 2 | ||||
-rw-r--r-- | app/views/general/_footer.rhtml | 6 | ||||
-rw-r--r-- | app/views/general/_frontpage_intro_sentence.rhtml | 7 | ||||
-rw-r--r-- | app/views/general/_frontpage_search_examples.es.rhtml | 1 | ||||
-rw-r--r-- | app/views/general/_frontpage_search_examples.rhtml | 1 | ||||
-rw-r--r-- | app/views/general/_localised_datepicker.rhtml | 18 | ||||
-rw-r--r-- | app/views/general/_orglink.rhtml | 2 | ||||
-rw-r--r-- | app/views/general/_topnav.rhtml | 10 | ||||
-rw-r--r-- | app/views/general/advanced_search.rhtml | 0 | ||||
-rw-r--r-- | app/views/general/blog.rhtml | 101 | ||||
-rw-r--r-- | app/views/general/exception_caught.rhtml | 35 | ||||
-rw-r--r-- | app/views/general/frontpage.rhtml | 77 | ||||
-rw-r--r-- | app/views/general/search.rhtml | 302 |
14 files changed, 386 insertions, 225 deletions
diff --git a/app/views/general/_advanced_search_tips.rhtml b/app/views/general/_advanced_search_tips.rhtml new file mode 100644 index 000000000..520cce89b --- /dev/null +++ b/app/views/general/_advanced_search_tips.rhtml @@ -0,0 +1,49 @@ +<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> + <li><%= _('Use OR (in capital letters) where you don\'t mind which word, e.g. <strong><code>commons OR lords</code></strong>') %> + <li><%= _('Use quotes when you want to find an exact phrase, e.g. <strong><code>"Liverpool City Council"</code></strong>') %></li> + <li><%= _('<strong><code>status:</code></strong> to select based on the status or historical status of the request, see the <a href="{{statuses_url}}">table of statuses</a> below.', :statuses_url => "#statuses") %></li> + <li><%= _('<strong><code>variety:</code></strong> to select type of thing to search for, see the <a href="{{varieties_url}}">table of varieties</a> below.', :varieties_url => "#varieties") %></li> + <li><%= _('<strong><code>requested_from:home_office</code></strong> to search requests from the Home Office, typing the name as in the URL.')%></li> + <li><%= _('<strong><code>requested_by:julian_todd</code></strong> to search requests made by Julian Todd, typing the name as in the URL.') %></li> + <li><%= _('<strong><code>commented_by:tony_bowden</code></strong> to search annotations made by Tony Bowden, typing the name as in the URL.')%></li> + <li><%= _('<strong><code>request:</code></strong> to restrict to a specific request, typing the title as in the URL.')%> + <li><%= _('<strong><code>filetype:pdf</code></strong> to find all responses with PDF attachments. Or try these: <code>{{list_of_file_extensions}}</code>', :list_of_file_extensions => IncomingMessage.get_all_file_extensions)%></li> + <li><%= _('Type <strong><code>01/01/2008..14/01/2008</code></strong> to only show things that happened in the first two weeks of January.')%></li> + <li><%= _('<strong><code>tag:charity</code></strong> to find all public bodies or requests with a given tag. You can include multiple tags, + and tag values, e.g. <code>tag:openlylocal AND tag:financial_transaction:335633</code>. Note that by default any of the tags + can be present, you have to put <code>AND</code> explicitly if you only want results them all present.')%></li> + <li><%= _('Read about <a href="{{advanced_search_url}}">advanced search operators</a>, such as proximity and wildcards.', :advanced_search_url => "http://www.xapian.org/docs/queryparser.html") %></li> + </ul> + + <h2 id="statuses"><%= _('Table of statuses') %></h2> + <p><%= _("All the options below can use <strong>status</strong> or <strong>latest_status</strong> before the colon. For example, <strong>status:not_held</strong> will match requests which have <em>ever</em> been marked as not held; <strong>latest_status:not_held</strong> will match only requests that are <em>currently</em> marked as not held.") %></p> + + <table class="status_table"> + <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> + <p><%= _("All the options below can use <strong>variety</strong> or <strong>latest_variety</strong> before the colon. For example, <strong>variety:sent</strong> will match requests which have <em>ever</em> been sent; <strong>latest_variety:sent</strong> will match only requests that are <em>currently</em> marked as sent.") %></p> + <table class="status_table"> + <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> diff --git a/app/views/general/_credits.rhtml b/app/views/general/_credits.rhtml index 8c519ce7e..b1a9ce05e 100644 --- a/app/views/general/_credits.rhtml +++ b/app/views/general/_credits.rhtml @@ -1 +1 @@ -| <%= _('Powered by <a href="http://www.alaveteli.org/">Alaveteli</a>.') %> +| <%= _('Powered by <a href="http://www.alaveteli.org/">Alaveteli</a>') %> diff --git a/app/views/general/_footer.rhtml b/app/views/general/_footer.rhtml new file mode 100644 index 000000000..2f6c30f5f --- /dev/null +++ b/app/views/general/_footer.rhtml @@ -0,0 +1,6 @@ +<div id="footer"> + <%= link_to _("Contact {{site_name}}", :site_name => site_name), help_contact_url %> +| <img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="http://www.twitter.com/<%= MySociety::Config.get('TWITTER_USERNAME') %>"><%= _("Follow us on twitter") %></a> +<%= render :partial => 'general/credits' %> +</div> +<div class="after-footer"> </div> diff --git a/app/views/general/_frontpage_intro_sentence.rhtml b/app/views/general/_frontpage_intro_sentence.rhtml index 2c3bcaf83..70b47ad06 100644 --- a/app/views/general/_frontpage_intro_sentence.rhtml +++ b/app/views/general/_frontpage_intro_sentence.rhtml @@ -1,3 +1,4 @@ -First, type in the <strong>name of the UK public authority</strong> you'd -<br>like information from. <strong>By law, they have to respond</strong> -(<a href="<%= help_about_url %>">why?</a>). +<h2> + Your <strong>Right to Know</strong> +</h2> +<p>Every citizen has the right to access information held by public authorities. <strong>By law, they have to respond</strong>. <a href="<%= help_about_url %>">Find out more about freedom of information.</a></p> diff --git a/app/views/general/_frontpage_search_examples.es.rhtml b/app/views/general/_frontpage_search_examples.es.rhtml new file mode 100644 index 000000000..63c7c3c1e --- /dev/null +++ b/app/views/general/_frontpage_search_examples.es.rhtml @@ -0,0 +1 @@ +por ejemplo <a href="/es/search/El%20Geraldine%20Quango">El Geraldine Quango</a>, <a href="/search/fancy%20dog">Fancy Dog</a>. diff --git a/app/views/general/_frontpage_search_examples.rhtml b/app/views/general/_frontpage_search_examples.rhtml new file mode 100644 index 000000000..359a132e2 --- /dev/null +++ b/app/views/general/_frontpage_search_examples.rhtml @@ -0,0 +1 @@ +for example <a href="/search/Geraldine%20Quango">Geraldine Quango</a> or <a href="/search/fancy%20dog">Fancy Dog</a>. 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/_orglink.rhtml b/app/views/general/_orglink.rhtml index 20d0d6ce4..7d74dbaac 100644 --- a/app/views/general/_orglink.rhtml +++ b/app/views/general/_orglink.rhtml @@ -1,2 +1,2 @@ <%-# Put the link to your organisation here, or leave blank -%> -<a href="http://www.alaveteli.org">an Alaveteli site</a> +<%= link_to image_tag('logo.png'), frontpage_url, :id=>'logo' %> diff --git a/app/views/general/_topnav.rhtml b/app/views/general/_topnav.rhtml new file mode 100644 index 000000000..619ff3593 --- /dev/null +++ b/app/views/general/_topnav.rhtml @@ -0,0 +1,10 @@ +<div id="topnav"> + <ul id="navigation"> + <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] != 'blog' %>"><%= link_to _("Home"), frontpage_url %></li> + <li class="<%= 'selected' if params[:controller] == 'request' and ['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("Make a request"), select_authority_url, :id => 'make-request-link' %></li> + <li class="<%= 'selected' if params[:controller] == 'request' and !['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("View requests"), request_list_successful_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] == 'general' and params[:action] == 'blog' %>"><%= link_to _("Read blog"), blog_url %></li> + <li class="<%= 'selected' if params[:controller] == 'help' %>"><%= link_to _("Help"), help_about_url %></li> + </ul> +</div>
\ No newline at end of file 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..98636a653 100644 --- a/app/views/general/blog.rhtml +++ b/app/views/general/blog.rhtml @@ -1,56 +1,63 @@ -<% @title = "#{site_name} blog and tweets" %> +<% @title = _("{{site_name}} blog and tweets", :site_name => site_name) %> -<h1><%=@title %></h1> - <img src="/images/twitter.png" alt="twitter icon" valign="middle"> <a href="http://www.twitter.com/<%= MySociety::Config.get('TWITTER_USERNAME') %>">Follow us on twitter</a> - <img src="/images/rss.png" alt="RSS icon" valign="middle"> <a href="<%= MySociety::Config.get('BLOG_FEED') %>">Subscribe to blog</a> <% if !@twitter_user.empty? %> -<div id="twitter"> -<script src="http://widgets.twimg.com/j/2/widget.js"></script> -<script> -new TWTR.Widget({ - version: 2, - type: 'profile', - rpp: 15, - interval: 6000, - width: 'auto', - height: 500, - theme: { - shell: { - background: '#eaeaea', - color: '#000000' +<div id="right_column"> + <div class="act_link"> + <h2><%= _("Stay up to date") %></h2> + <img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="http://www.twitter.com/<%= @twitter_user %>"><%= _("Follow us on twitter") %></a><br/><br/> + <img src="/images/feed-16.png" alt="RSS icon" valign="middle"> <a href="<%= @feed_url %>"><%= _("Subscribe to blog") %></a> + </div> + <div id="twitter"> + <script src="http://widgets.twimg.com/j/2/widget.js"></script> + <script type="text/javascript"> + new TWTR.Widget({ + version: 2, + type: 'profile', + rpp: 15, + interval: 6000, + width: 'auto', + height: 500, + theme: { + shell: { + background: '#eaeaea', + color: '#000000' + }, + tweets: { + background: '#ffffff', + color: '#000000', + links: '#0b004a' + } }, - tweets: { - background: '#ffffff', - color: '#000000', - links: '#0b004a' + features: { + scrollbar: false, + loop: false, + live: false, + hashtags: true, + timestamp: true, + avatars: true, + behavior: 'all' } - }, - features: { - scrollbar: false, - loop: false, - live: false, - hashtags: true, - timestamp: true, - avatars: true, - behavior: 'all' - } -}).render().setUser('<%=@twitter_user %>').start(); -</script> - + }).render().setUser('<%=@twitter_user %>').start(); + </script> + </div> </div> <% end %> -<div id="blog"> - <% for item in @blog_items: %> - <div class="blog_post"> - <h2><a href="<%=item['link']%>"><%=h item['title'] %></a></h2> - <p class="subtitle">Posted on <%= simple_date(Time.parse(item['pubDate'][0])) %> by <%=h item['creator'] %></p> - <div><%= item['encoded'] %></div> - <p><em> - <a href="<%=item['comments'][0]%>"><%=item['comments'][1]%> comments</a> - </em> - </p> - </div> - <% end %> +<div id="left_column"> + <h1><%=@title %></h1> + + <div id="blog"> + <% for item in @blog_items: %> + <div class="blog_post"> + <h2 id="<%= Time.parse(item['pubDate'][0]).to_i %>"><a href="<%=item['link']%>"><%=h item['title'] %></a></h2> + <p class="subtitle"><%= _("Posted on {{date}} by {{author}}", :date=>simple_date(Time.parse(item['pubDate'][0])), :author=>item['creator']) %></p> + <div><%= item['encoded'] %></div> + <p><em> + <a href="<%=item['comments'][0]%>"><%= _("{{number_of_comments}} comments", :number_of_comments=>item['comments'][1]) %></a> + </em> + </p> + </div> + <% end %> + </div> </div> diff --git a/app/views/general/exception_caught.rhtml b/app/views/general/exception_caught.rhtml index ca36b592b..b266b53a1 100644 --- a/app/views/general/exception_caught.rhtml +++ b/app/views/general/exception_caught.rhtml @@ -1,17 +1,24 @@ -<h1><%= _("Sorry, we couldn't find that page") %></h1> +<div id="error-page"> + <% if @status == 404 %> + <h1><%= _("Sorry, we couldn't find that page") %></h1> -<p><%= _("The page either doesn't exist, or is broken. Things you can try now:")%></p> + <p><%= _("The page doesn't exist. Things you can try now:")%></p> -<ul> -<li><%= _("Check for mistakes if you typed or copied the address.")%></li> -<li><%= _("Search the site to find what you were looking for.")%> - <% form_tag({:controller => "general", :action => "search_redirect"}, {:id => "search_form"}) do %> - <%= text_field_tag 'query', params[:query], { :size => 30 } %> - <%= submit_tag _("Search") %> - <% end %> -</li> -<li><%= _('<a href="%s">Contact us</a> to tell us about the problem</li>') % [help_contact_path] %> -<li><%= _('Go to our <a href="%s">front page</a></li>') % ["/"] %> -</ul> + <ul> + <li><%= _("Check for mistakes if you typed or copied the address.")%></li> + <li><%= _("Search the site to find what you were looking for.")%> + <% form_tag({:controller => "general", :action => "search_redirect"}, {:id => "search_form"}) do %> + <%= text_field_tag 'query', params[:query], { :size => 30 } %> + <%= submit_tag _("Search") %> + <% end %> + </li> + </ul> + <% else %> + <h1><%= _("Sorry, there was a problem processing this page") %></h1> + <p><%= _('You have found a bug. Please <a href="{{contact_url}}">contact us</a> to tell us about the problem', :contact_url => help_contact_path) %></p> -<p id="error_technical_details"><%= _("<strong>Technical details:</strong>")%> <%=@exception_class ? @exception_class : _("Unknown")%></p> + <% end %> + <h2><%= _('Technical details') %></h2> + <p><strong><%=@exception_class ? @exception_class : _("Unknown")%></strong></p> + <p><strong><%=@exception_message %></strong></p> +</div> diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml index abed0294e..35751b6a4 100644 --- a/app/views/general/frontpage.rhtml +++ b/app/views/general/frontpage.rhtml @@ -1,33 +1,42 @@ -<% view_cache :ttl => 5.minutes, :tag => I18n.locale do %> - -<div id="frontpage_search"> - <h1><%= _('Make or explore Freedom of Information requests') %></h1> - - <% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %> - <p> - <%= render :partial => 'frontpage_intro_sentence' %> - <br> - - <br> - <%= text_field_tag 'query', params[:query], { :size => 30 } %> - <%= hidden_field_tag 'bodies', 1 %> - <%= submit_tag _('Search') %> - <br> - <%= _('e.g.') %> - <% @search_examples.each_with_index do |name, i| %> - <%=link_to name, search_url(name, 'bodies')%><% if i < 2 %>, <% else %>. <% break %><% end %> - <% end %> - - <br> - <br> - <%= _('OR, <strong>search</strong> for information others have requested using {{site_name}}', :site_name => site_name) %> - </p> - <% end %> -</div> +<% view_cache :ttl => 5.minutes.to_i, :tag => I18n.locale do %> + <div id="frontpage_splash"> + <div id="left_column"> + <h1> + <%= _("Make a new<br/> + <strong>Freedom <span>of</span><br/> + Information<br/> + request</strong>") %> + </h1> + <a class="link_button_green_large" href="/select_authority"><%= _("Start now »") %></a> + </div> + <div id="right_column"> + <div id="frontpage_search_box"> + <h2> + <%= _("Search over<br/> + <strong>{{number_of_requests}} requests</strong> <span>and</span><br/> + <strong>{{number_of_authorities}} authorities</strong>", + :number_of_requests => InfoRequest.count, :number_of_authorities => PublicBody.count) %> + </h2> + <% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %> + <div> + <%= text_field_tag 'query', params[:query], { :size => 30 } %> + <%= submit_tag _('Search') %> + </div> + <% end %> + </div> + <div id="frontpage_right_to_know"> + <%= render :partial => 'frontpage_intro_sentence' %> + </div> + </div> + <div style="clear:both"></div> + </div> <div id="frontpage_examples"> <% if @popular_bodies.size > 0 %> <div id="examples_0"> + <h3><%= _("Who can I request information from?") %></h3> + <%= _("{{site_name}} covers requests to {{number_of_authorities}} authorities, including:", + :site_name => site_name, :number_of_authorities => PublicBody.count) %> <ul> <% for popular_body in @popular_bodies %> <li><%=public_body_link(popular_body)%> @@ -36,23 +45,27 @@ <% end%> </ul> <p><strong> - <%= link_to _('More authorities...'), list_public_bodies_default %> + <%= link_to _('Browse all authorities...'), list_public_bodies_default %> </strong></p> </div> <% end %> - <% if @successful_request_events.size > 0 %> <div id="examples_1"> + <h3><%= _("What information has been released?") %></h3> + <%= _("{{site_name}} users have made {{number_of_requests}} requests, including:", + :site_name => site_name, :number_of_requests => InfoRequest.count) %> <ul> - <% for event in @successful_request_events %> - <li><%=link_to h(excerpt(event.info_request.title, "", 30)), request_url(event.info_request)%> - <%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(event.described_at)) %> + <% for event in @request_events %> + <li> + <%= public_body_link(event.info_request.public_body) %> <%= _('answered a request about') %> + <%=link_to h(event.info_request.title), request_url(event.info_request)%> + <%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(event.described_at)) %> + <p class="excerpt" onclick="document.location.href='<%=request_url(event.info_request)%>'"><%= excerpt(event.info_request.title, "", 200) %></p> </li> <% end %> </ul> <p><strong><%=link_to _('More successful requests...'), request_list_successful_url %></strong></p> </div> - <% end %> </div> diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml index 1d934f65a..87a6ab446 100644 --- a/app/views/general/search.rhtml +++ b/app/views/general/search.rhtml @@ -1,166 +1,214 @@ <% @show_tips = @xapian_requests.nil? || (@total_hits == 0) %> +<% @include_request_link_in_authority_listing = true %> + +<%= render :partial => 'localised_datepicker' %> + <% 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 %> - -<% 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> - <p><% _('Can\'t find it? <a href="%s">Browse all</a> or <a href="%s">ask us to add it</a>.') % [list_public_bodies_default, "#{help_requesting_path}#missing_body"] %></p> - <p> +<div id="header_left"> + <% if @query.nil? %> + <h1><%= _("Search") %></h1> + <% else %> + <h1><%= _("Search results") %></h1> + <% end%> + + <% if @advanced %> + <div id="advanced-search"> + <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, @query, { :size => 60 } %> + <%= hidden_field_tag 'sortby', @inputted_sortby %> + <% if @bodies %> + <%= hidden_field_tag 'bodies', 1 %> + <% end %> + <%= submit_tag _("Search") %> + <%= link_to _('Simple search'), search_redirect_path %> + </p> + <% end %> </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") %> - <% if not @show_tips %> - <%= link_to _('Advanced search tips'), search_redirect_path %> - <% end %> - </p> -<% end %> - -<% if !@query.nil? %> - <p> - <%=link_to_unless @sortby == 'relevant', _("Show most relevant results first"), search_url(@query, 'relevant') %> - | - <%=link_to_unless @sortby == 'newest', _("Newest results first"), search_url(@query, 'newest') %> - <% if @sortby == 'described' %> - | <%= _('Recently described results first') %> - <% 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 %> + <%= submit_tag _("Search") %> + <%= link_to(_("Advanced search"), advanced_search_url) %> + </p> + + <div id="common-subfilters"> + <div id="variety-filter"> + <h3 class="title"><%= _("Showing") %></h3> + <% labels = [ + ["requests", _("requests")], + ["users", _("users")], + ["bodies", _("authorities")], + ["all", _("everything")]]%> + <% for variety, label in labels %> + <% if @variety_postfix != variety %> + <% if variety != "users" %> + <%= link_to label, search_url([params[:query], @common_query], variety, @sort_postfix) %> + <% else %> + <%= link_to label, search_url(params[:query], variety, @sort_postfix) %> + <% end %> + <% else %> + <%= label %> + <% end %> + <%= "|" unless variety == labels.last[0]%> + <% end %> + </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> + <h3 class="title"><%= _("Restrict to") %></h3> + <% [["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> + <h3 class="title"><%= _("Search in") %></h3> + <% [["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 id="date_range"> + <label class="form_label title" for="query"><%= _("Made between") %></label> + <%= text_field_tag(:request_date_after, params[:request_date_after], {:class => "use-datepicker", :size => 10}) %> + <label class="form_label" for="query"> <%= _("and") %></label> + <%= text_field_tag(:request_date_before, params[:request_date_before], {:class => "use-datepicker", :size => 10}) %> + </div> + </div> + <% end %> + + <div> + <%= submit_tag _("Filter") if @variety_postfix == "requests"%> + </div> + <% end # Search form%> + + <% end # if @advanced %> + + <% if !@query.nil? %> + <p id="search_controls"> + <%=link_to_unless @sortby == 'relevant', _("Show most relevant results first"), search_url(@query, @variety_postfix, 'relevant') %> + | + <%=link_to_unless @sortby == 'newest', _("Newest results first"), search_url(@query, @variety_postfix, 'newest') %> + <% if @sortby == 'described' %> + | <%= _('Recently described results first') %> + <% end %> </p> + <% end %> +</div> <!-- header left --> + +<% 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' } %> + </div> <% end %> -<% if @bodies && !@query.nil? && @xapian_bodies.results.size == 0 && @page == 1 %> - <h1><%= _('No public authorities found') %></h1> - <% if @spelling_correction %> - <p id="did_you_mean"><%= _('Did you mean: {{correction}}', - :correction => search_link(@spelling_correction, @postfix)) %></p> - <% end %> - <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 %> +<div style="clear:both;"></div> <% if @total_hits == 0 %> - <h1><%=@title %></h1> + <h2><%=@title %></h2> <% end %> <% if not @query.nil? %> - <% if @spelling_correction %> - <p id="did_you_mean"><%= _('Did you mean: {{correction}}', :correction => search_link(@spelling_correction, @postfix)) %></p> - <% end %> - - <% if (!@bodies || @xapian_requests.results.size == 0) && @track_thing && (@xapian_bodies.results.size > 0 || @xapian_users.results.size > 0 || @total_hits == 0)%> - <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %> - <% end %> - - <% 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> + <div class="results_section"> + <% if @xapian_bodies_hits > 0 %> + <% if @xapian_bodies_hits == 1 && @page == 1 %> + <h2 class="publicbody_results"><%= _('One public authority found') %></h2> <% 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> + <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 %> - <% for result in @xapian_bodies.results %> + <div class="results_block"> + <% for result in @xapian_bodies.results %> <%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %> - <% end %> + <% end %> + </div> <%= will_paginate WillPaginate::Collection.new(@page, @bodies_per_page, @xapian_bodies.matches_estimated) %> - <% end %> + <% elsif @bodies && !@query.nil? && @xapian_bodies.results.size == 0 && @page == 1 %> + <h2 class="publicbody_results"><%= _('No public authorities found') %></h2> + <% if @spelling_correction %> + <p id="did_you_mean"><%= _('Did you mean: {{correction}}', :correction => search_link(@spelling_correction, @postfix)) %></p> + <% end %> + <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 %> + </div> - <% if @xapian_users.results.size > 0 %> - <% if @xapian_users.results.size == 1 && @page == 1 %> - <h1><%= _("One person matching ‘{{user_search_query}}’", :user_search_query => h(@query)) %></h1> + <div class="results_section"> + <% if @xapian_users_hits > 0 %> + <% if @xapian_users_hits == 1 && @page == 1 %> + <h2 class="person_results"><%= _("One person found") %></h2> <% else %> - <h1><%= _("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)) %></h1> + <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 %> - <% for result in @xapian_users.results %> + <div class="results_block"> + <% for result in @xapian_users.results %> <%= render :partial => 'user/user_listing_single', :locals => { :display_user => result[:model] } %> - <% end %> - - <%= will_paginate WillPaginate::Collection.new(@page, @users_per_page, @xapian_users.matches_estimated) %> - <% end %> + <% end %> + </div> + <% end %> + </div> - <% if @xapian_requests.results.size > 0 %> - <% if @xapian_requests.results.size == 1 && @page == 1 %> - <h1><%= _("One FOI request matching ‘{{user_search_query}}’", :user_search_query => h(@query)) %></h1> + <div class="results_section"> + <% if @xapian_requests_hits > 0 %> + <% if @xapian_requests_hits == 1 && @page == 1 %> + <h2 class="foi_results"><%= _("One FOI request found") %></h2> <% 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> + <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 %> - <% if @track_thing %> - <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %> - <% end %> - - <% for result in @xapian_requests.results %> + <div class="results_block"> + <% for result in @xapian_requests.results %> <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> - <% end %> + <% end %> + </div> <%= will_paginate WillPaginate::Collection.new(@page, @requests_per_page, @xapian_requests.matches_estimated) %> - <% if @track_thing %> - <p></p> - <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %> - <% end %> - <% end %> + <% end %> + </div> <% end %> -<% if @show_tips %> - <h2><%= _("Advanced search tips")%></h2> - <ul> - <li><%= _("Enter words that you want to find separated by spaces, e.g. <strong>climbing lane</strong>") %></li> - <li><%= _('Use OR (in capital letters) where you don\'t mind which word, e.g. <strong><code>commons OR lords</code></strong>') %> - <li><%= _('Use quotes when you want to find an exact phrase, e.g. <strong><code>"Liverpool City Council"</code></strong>') %></li> - <li><%= _('<strong><code>status:</code></strong> to select based on the status or historical status of the request, see the <a href="{{statuses_url}}">table of statuses</a> below.', :statuses_url => "#statuses") %></li> - <li><%= _('<strong><code>variety:</code></strong> to select type of thing to search for, see the <a href="{{varieties_url}}">table of varieties</a> below.', :varieties_url => "#varieties") %></li> - <li><%= _('<strong><code>requested_from:home_office</code></strong> to search requests from the Home Office, typing the name as in the URL.')%></li> - <li><%= _('<strong><code>requested_by:julian_todd</code></strong> to search requests made by Julian Todd, typing the name as in the URL.') %></li> - <li><%= _('<strong><code>commented_by:tony_bowden</code></strong> to search annotations made by Tony Bowden, typing the name as in the URL.')%></li> - <li><%= _('<strong><code>request:</code></strong> to restrict to a specific request, typing the title as in the URL.')%> - <li><%= _('<strong><code>filetype:pdf</code></strong> to find all responses with PDF attachments. Or try these: <code>{{list_of_file_extensions}}</code>', :list_of_file_extensions => IncomingMessage.get_all_file_extensions)%></li> - <li><%= _('Type <strong><code>01/01/2008..14/01/2008</code></strong> to only show things that happened in the first two weeks of January.')%></li> - <li><%= _('<strong><code>tag:charity</code></strong> to find all public bodies or requests with a given tag. You can include multiple tags, - and tag values, e.g. <code>tag:openlylocal AND tag:financial_transaction:335633</code>. Note that by default any of the tags - can be present, you have to put <code>AND</code> explicitly if you only want results them all present.')%></li> - <li><%= _('Read about <a href="{{advanced_search_url}}">advanced search operators</a>, such as proximity and wildcards.', :advanced_search_url => "http://www.xapian.org/docs/queryparser.html") %></li> - </ul> - - <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> - </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> - </table> - +<% if @advanced %> + <%= render :partial => 'general/advanced_search_tips' %> <% end %> |