diff options
Diffstat (limited to 'app/views/request')
-rw-r--r-- | app/views/request/_after_actions.rhtml | 10 | ||||
-rw-r--r-- | app/views/request/_correspondence.rhtml | 20 | ||||
-rw-r--r-- | app/views/request/_followup.rhtml | 37 | ||||
-rw-r--r-- | app/views/request/_next_actions.rhtml | 1 | ||||
-rw-r--r-- | app/views/request/_request_filter_form.rhtml | 53 | ||||
-rw-r--r-- | app/views/request/_request_listing_via_event.rhtml | 29 | ||||
-rw-r--r-- | app/views/request/_search_ahead.rhtml | 12 | ||||
-rw-r--r-- | app/views/request/_sidebar.rhtml | 32 | ||||
-rw-r--r-- | app/views/request/list.rhtml | 53 | ||||
-rw-r--r-- | app/views/request/new.rhtml | 232 | ||||
-rw-r--r-- | app/views/request/preview.rhtml | 10 | ||||
-rw-r--r-- | app/views/request/select_authority.rhtml | 68 | ||||
-rw-r--r-- | app/views/request/show.rhtml | 2 | ||||
-rw-r--r-- | app/views/request/simple_correspondence.rhtml | 45 |
14 files changed, 378 insertions, 226 deletions
diff --git a/app/views/request/_after_actions.rhtml b/app/views/request/_after_actions.rhtml index 797ecaea5..205b738de 100644 --- a/app/views/request/_after_actions.rhtml +++ b/app/views/request/_after_actions.rhtml @@ -13,19 +13,21 @@ <%= link_to _('Update the status of this request'), '#describe_state_form_1' %> </li> <% end %> + <li> + <%= link_to _("Download a zip file of all correspondence"), download_entire_request_url(:url_title => @info_request.url_title) %> + </li> </ul> </div> <div id="owner_actions"> <strong><%= _('{{info_request_user_name}} only:',:info_request_user_name=>h(@info_request.user.name)) %></strong> <ul> + <li> <% if @last_response.nil? %> - <%= link_to "Send follow up to " + OutgoingMailer.name_for_followup(@info_request, @last_response), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "#followup" %> + <%= link_to _("Send a followup"), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "#followup" %> <% else %> - <% foi_cache(:controller => "request", :action => "show_response", :id => @info_request.id, :incoming_message_id => @last_response.id, :only_path => true, :template => "_after_actions", :section => "reply_to_link") do %> - <%= link_to "Reply to " + OutgoingMailer.name_for_followup(@info_request, @last_response), show_response_url(:id => @info_request.id, :incoming_message_id => @last_response.id) + "#followup" %> - <% end %> + <%= link_to _("Write a reply"), show_response_url(:id => @info_request.id, :incoming_message_id => @last_response.id) + "#followup" %> <% end %> </li> <% if !@old_unclassified %> diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml index 4e46347b8..9a198ad7d 100644 --- a/app/views/request/_correspondence.rhtml +++ b/app/views/request/_correspondence.rhtml @@ -1,3 +1,4 @@ +<div class="ff-print-fix"></div> <% if !info_request_event.nil? && info_request_event.event_type == 'response' incoming_message = info_request_event.incoming_message @@ -5,11 +6,10 @@ end if not incoming_message.nil? %> - <div class="correspondence" id="incoming-<%=incoming_message.id.to_s%>"> - <% foi_cache(:controller => "request", :action => "show_response", :id => @info_request.id, :incoming_message_id => incoming_message.id, :only_path => true, :template => "_correspondence", :section => "incoming_message_bubble", :collapse => @collapse_quotes ? nil : 'no' ) do %> + <div class="incoming correspondence" id="incoming-<%=incoming_message.id.to_s%>"> <h2> <% if !incoming_message.safe_mail_from.nil? && incoming_message.safe_mail_from.strip != @info_request.public_body.name.strip %> - <%=h incoming_message.safe_mail_from %><br> + <%= _("From:") %> <%=h incoming_message.safe_mail_from %><br> <% end %> <% if incoming_message.safe_mail_from.nil? || (incoming_message.mail_from_domain == @info_request.public_body.request_email_domain) %> <%=h @info_request.public_body.name %><br> @@ -18,25 +18,22 @@ if not incoming_message.nil? </h2> <%= render :partial => 'bubble', :locals => { :incoming_message => incoming_message, :body => incoming_message.get_body_for_html_display(@collapse_quotes), :attachments => incoming_message.get_attachments_for_display } %> - <% end %> <p class="event_actions"> <% if !@user.nil? && @user.admin_page_links? %> <%= link_to "Admin", admin_url("request/show_raw_email/" + incoming_message.raw_email_id.to_s) %> | <% end %> - <%= link_to _("Link to this"), incoming_message_url(incoming_message) %> | - <%= link_to _("Reply to this message"), show_response_url(:id => incoming_message.info_request.id, :incoming_message_id => incoming_message.id) + "#followup" %> - + <%= link_to _("Link to this"), incoming_message_url(incoming_message), :class => "link_to_this" %> </p> </div> <% elsif [ 'sent', 'followup_sent' ].include?(info_request_event.event_type) outgoing_message = info_request_event.outgoing_message %> - <div class="correspondence" id="outgoing-<%=outgoing_message.id.to_s%>"> + <div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>"> <h2> - <%=h @info_request.user.name %><br> + <%= _("From:") %> <%=h @info_request.user.name %><br> <br><%= simple_date(info_request_event.created_at) %> </h2> @@ -54,12 +51,11 @@ elsif [ 'sent', 'followup_sent' ].include?(info_request_event.event_type) <% end %> --> - <%= link_to _("Link to this"), outgoing_message_url(outgoing_message) %> | - <%= link_to _("Send follow up"), show_response_no_followup_url(:id => outgoing_message.info_request.id, :incoming_message_id => nil) + "#followup" %> + <%= link_to _("Link to this"), outgoing_message_url(outgoing_message), :class => "link_to_this" %> </p> </div> <% elsif [ 'resent', 'followup_resent' ].include?(info_request_event.event_type) %> - <div class="correspondence" id="outgoing-<%=outgoing_message.id.to_s%>"> + <div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>"> <h2> <%= simple_date(info_request_event.created_at) %> </h2> diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.rhtml index a15f2912d..be57ac9ef 100644 --- a/app/views/request/_followup.rhtml +++ b/app/views/request/_followup.rhtml @@ -1,17 +1,44 @@ <div id="followup"> - + <% if (incoming_message.nil? || !incoming_message.valid_to_reply_to?) + name_for_followup = _("the main FOI contact at {{public_body}}", :public_body => h(OutgoingMailer.name_for_followup(@info_request, nil))) + else + name_for_followup = h(OutgoingMailer.name_for_followup(@info_request, incoming_message)) + end %> <% if @internal_review %> - <h1><%= _('Request an internal review from') %> <%=h OutgoingMailer.name_for_followup(@info_request, nil) %> + <h1><%= _('Request an internal review from {{person_or_body}}', :person_or_body => name_for_followup) %> </h1> <% elsif incoming_message.nil? || !incoming_message.valid_to_reply_to? %> - <h2><%= _('Send a public follow up message to') %> <%=h OutgoingMailer.name_for_followup(@info_request, nil) %> + <h2><%= _('Send a public follow up message to {{person_or_body}}', :person_or_body => name_for_followup) %> </h2> <% else %> - <h2><%= _('Send a public reply to') %> - <%=h OutgoingMailer.name_for_followup(@info_request, incoming_message) %> + <h2><%= _('Send a public reply to {{person_or_body}}', :person_or_body => name_for_followup) %> </h2> <% end %> +<% if @info_request.who_can_followup_to(incoming_message).count > 0 %> +<div id="other_recipients"> + <%= _("Don't want to address your message to {{person_or_body}}? You can also write to:", :person_or_body => name_for_followup) %> + <ul> +<% @info_request.who_can_followup_to(incoming_message).each do |name, email, id| %> + <% if id.nil? && !incoming_message.nil? && incoming_message.valid_to_reply_to? %> + <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil)) %></li> + <% else %> + <% if !id.nil? %> + <% if @info_request.public_body.request_email == email %> + <% if !incoming_message.nil? %> + <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil)) %></li> + <% end %> + <% else %> + <li><%= link_to name, show_response_url(:id => @info_request.id, :incoming_message_id => id)%></li> + <% end %> + <% else %> + <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil)) %></li> + <% end %> + <% end %> +<% end %> +</ul> +</div> +<% end %> <% if @info_request.allow_new_responses_from == 'nobody' %> <p><%= _('Follow ups and new responses to this request have been stopped to prevent spam. Please <a href="{{url}}">contact us</a> if you are {{user_link}} and need to send a follow up.',:user_link=>user_link(@info_request.user), :url=>help_contact_path) %></p> <% else %> diff --git a/app/views/request/_next_actions.rhtml b/app/views/request/_next_actions.rhtml new file mode 100644 index 000000000..f318df6e4 --- /dev/null +++ b/app/views/request/_next_actions.rhtml @@ -0,0 +1 @@ +<!-- Consider listing websites that users might find useful here (in your theme) --> diff --git a/app/views/request/_request_filter_form.rhtml b/app/views/request/_request_filter_form.rhtml index 33b7bfb27..fa760bf74 100644 --- a/app/views/request/_request_filter_form.rhtml +++ b/app/views/request/_request_filter_form.rhtml @@ -1,32 +1,9 @@ <%= 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 %> + <% form_tag(request.path, :method => "get", :id=>"filter_requests_form") do %> <div class="list-filter-item"> - <%= label_tag(:query, _("Search for:")) %> + <%= label_tag(:query, _("Keywords"), :class=>"form_label title") %> <%= text_field_tag(:query, params[:query]) %> </div> <% if false # don't think we want this, but leaving as an example %> @@ -43,13 +20,33 @@ </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}) %> - + <%= label_tag(:query, _("Made between"), :class=>"form_label title") %> + <%= text_field_tag(:request_date_after, params[:request_date_after], {:class => "use-datepicker", :size => 10}) %> + <%= label_tag(:query, _("and"), :class=>"form_label") %> <%= text_field_tag(:request_date_before, params[:request_date_before], {:class => "use-datepicker", :size => 10}) %> </div> + <div class="list-filter-item"> + <h3 class="title"><%= _("Showing") %></h3> + <% statuses = [["all", _("all requests")], + ["successful", _("successful requests")], + ["unsuccessful", _("unsuccessful requests")], + ["awaiting", _("unresolved requests")]] %> + <% for status, label in statuses %> + <% 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 + '#results' %> + <% else %> + <%= link_to label, url_for(:controller => "request", :action => "list", :view => status) + "?" + request.query_string + '#results' %> + <% end %> + <% else %> + <%= label %> + <% end %> + <%= "|" unless statuses.last[0] == status %> + <% end %> + </div> <div class="list-filter-item"> - <%= submit_tag("Search") %> + <%= submit_tag(_("Search")) %> </div> <% end %> </div> diff --git a/app/views/request/_request_listing_via_event.rhtml b/app/views/request/_request_listing_via_event.rhtml index afacabea5..e7c378cec 100644 --- a/app/views/request/_request_listing_via_event.rhtml +++ b/app/views/request/_request_listing_via_event.rhtml @@ -3,7 +3,8 @@ end %> <div class="request_listing"> - <span class="head"> + <div class="request_left"> + <span class="head"> <% if event.is_incoming_message? %> <%= link_to highlight_words(info_request.title, @highlight_words), incoming_message_url(event.incoming_message) %> <% elsif event.is_outgoing_message? and event.event_type == 'followup_sent' %> @@ -13,18 +14,9 @@ end %> <% else %> <%= link_to highlight_words(info_request.title, @highlight_words), request_url(info_request) %> <% end %> - </span> - <span class="desc"> - <%= highlight_and_excerpt(event.search_text_main(true), @highlight_words, 150) %> - </span> - - <span class="bottomline icon_<%= info_request.calculate_status %>"> - - <strong> - <%= info_request.display_status %> - </strong><br> - - <% if event.event_type == 'sent' %> + </span> + <div class="requester"> + <% if event.event_type == 'sent' %> <%= _('Request sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>user_link_absolute(info_request.user),:date=>simple_date(event.created_at )) %> <% elsif event.event_type == 'followup_sent' %> <%=event.display_status %> @@ -37,6 +29,17 @@ end %> <% else %> <% raise _("unknown event type indexed ") + event.event_type %> <% end %> + </div> + <span class="bottomline icon_<%= info_request.calculate_status %>"> + <strong> + <%= info_request.display_status %> + </strong><br> </span> + </div> + <div class="request_right"> + <span class="desc"> + <%= highlight_and_excerpt(event.search_text_main(true), @highlight_words, 150) %> + </span> + </div> </div> diff --git a/app/views/request/_search_ahead.rhtml b/app/views/request/_search_ahead.rhtml new file mode 100644 index 000000000..9c49680c3 --- /dev/null +++ b/app/views/request/_search_ahead.rhtml @@ -0,0 +1,12 @@ +<div id="request_search_ahead_results"> + <% if @xapian_requests.results.size > 0 %> + <h3><%= _("Possibly related requests:") %></h3> + <% end %> + <% for result in @xapian_requests.results %> + <%= render :partial => 'request/request_listing_short_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> + <% end %> + + <p> + <a id="body-site-search-link" target="_blank"><%= _("Or search in their website for this information.") %></a> + </p> +</div> diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.rhtml index 2b9652d9c..2a9b5a73f 100644 --- a/app/views/request/_sidebar.rhtml +++ b/app/views/request/_sidebar.rhtml @@ -1,38 +1,32 @@ -<div id="request_sidebar"> - <h2><%= _('Track this request') %></h2> +<div id="right_column"> + <h2><%= _('Follow this request') %></h2> + + <% follower_count = TrackThing.count(:all, :conditions => ["info_request_id = ?", @info_request.id]) + 1 %> + <p><%= n_("There is %d person following this request", "There are %d people following this request", follower_count) % follower_count %></p> <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => @info_request.user == @user, :location => 'sidebar' } %> <h2><%= _("Act on what you've learnt") %></h2> + <div class="act_link"> - <%= link_to '<img src="/images/helpmeinvestigate.png" alt="" class="rss">', "http://helpmeinvestigate.com/"%> - <%= link_to 'Get help investigating', "http://helpmeinvestigate.com/"%> - </div> - <div class="act_link"> - <%= link_to '<img src="/images/writetothem.png" alt="" class="rss">', "http://www.writetothem.com"%> - <%= link_to 'Write to your politician', "http://www.writetothem.com"%> - </div> - <div class="act_link"> - <%= link_to '<img src="/images/pledgebank.png" alt="" class="rss">', "http://www.pledgebank.com"%> - <%= link_to 'Pledge with others', "http://www.pledgebank.com"%> + <% tweet_link = "http://twitter.com/share?url=#{h(request.url)}&via=#{h(MySociety::Config.get('TWITTER_USERNAME', ''))}&text='#{h(@info_request.title)}'&related=#{_('alaveteli_foi:The software that runs {{site_name}}', :site_name => h(site_name))}" %> + <%= link_to '<img src="/images/twitter-16.png" alt="twitter icon">', tweet_link %> + <%= link_to _("Tweet this request"), tweet_link %> </div> - <!-- <div class="act_link"> - <%= link_to '<img src="/images/petitions.png" alt="" class="rss">', "http://petitions.number10.gov.uk"%> - <%= link_to 'Petition the PM', "http://petitions.number10.gov.uk"%> - </div> --> <div class="act_link"> <%= link_to '<img src="/images/wordpress.png" alt="" class="rss">', "http://wordpress.com/"%> - <%= link_to 'Start your own blog', "http://wordpress.com/"%> + <%= link_to _("Start your own blog"), "http://wordpress.com/"%> </div> + <%= render :partial => 'request/next_actions' %> <% view_cache :ttl => 1.day, :tag => ['similar', @info_request.id, I18n.locale] do %> <% if !@xapian_similar.nil? && @xapian_similar.results.size > 0 %> - <h2><% _('Similar requests')%></h2> + <h2><%= _('Similar requests')%></h2> <% for result in @xapian_similar.results %> <%= render :partial => 'request/request_listing_short_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> <% end %> <% if @xapian_similar_more %> - <p><%= link_to "More similar requests", request_similar_url(@info_request) %></p> + <p><%= link_to _("More similar requests"), request_similar_url(@info_request) %></p> <% end %> <!-- Important terms: <%= @xapian_similar.important_terms.join(" ") %> --> <% end %> diff --git a/app/views/request/list.rhtml b/app/views/request/list.rhtml index a434566ac..0137cb6dd 100644 --- a/app/views/request/list.rhtml +++ b/app/views/request/list.rhtml @@ -1,30 +1,35 @@ +<div id="header_left"> + <h1><%=@title%></h1> + <%= render :partial => 'request/request_filter_form' %> +</div> -<h1><%=@title%></h1> +<div id="header_right"> + <h2><%= _("Follow these requests") %></h2> + <% if @track_thing %> + <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %> + <% end %> +</div> -<%= render :partial => 'request/request_filter_form' %> +<div style="clear:both"></div> -<% if @track_thing %> - <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %> -<% end %> - -<% view_cache :ttl => 5.minutes, :tag => [@view, @page, I18n.locale] do %> - <% if @list_results.empty? %> - <p> <%= _('No requests of this sort yet.')%></p> - <% else %> - <% for result in @list_results%> - <% if result.class.to_s == 'InfoRequestEvent' %> - <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result, :info_request => result.info_request } %> - <% else %> - <p><strong><%= _('Unexpected search result type') %> <%=result.class.to_s%></strong></p> +<div class="results_section"> + <% view_cache :ttl => 5.minutes, :tag => [@view, @page, I18n.locale] do %> + <% if @list_results.empty? %> + <p> <%= _('No requests of this sort yet.')%></p> + <% else %> + <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' %> + <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result, :info_request => result.info_request } %> + <% else %> + <p><strong><%= _('Unexpected search result type') %> <%=result.class.to_s%></strong></p> + <% end %> <% end %> - <% end %> - <% end %> - - <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @matches_estimated) %> -<% end %> + </div> + <% end %> -<% if @track_thing %> - <p></p> - <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %> -<% end %> + <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @matches_estimated) %> + <% end %> +</div> diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml index b8625a8e6..2e554a20b 100644 --- a/app/views/request/new.rhtml +++ b/app/views/request/new.rhtml @@ -1,116 +1,120 @@ +<script type="text/javascript" src="/javascripts/ba-throttle-debounce.js"></script> +<script type="text/javascript"> + $(document).ready(function(){ + // Avoid triggering too often (on each keystroke) by using the debounce jQuery plugin: + // http://benalman.com/projects/jquery-throttle-debounce-plugin/ + $("#typeahead_search").keypress($.debounce( 300, function() { + $("#typeahead_response").load("<%=search_ahead_url%>?q="+encodeURI(this.value), function() { + // When following links in typeahead results, open new tab/window + $("#typeahead_response a").attr("target","_blank"); + + // Update the public body site search link + $("#body-site-search-link").attr("href", "http://www.google.com/#q="+encodeURI($("#typeahead_search").val())+ + "+site:<%= @info_request.public_body.calculated_home_page %>"); + }); + })); + + }); +</script> + <% @title = _("Make an {{law_used_short}} request to '{{public_body_name}}'",:law_used_short=>h(@info_request.law_used_short),:public_body_name=>h(@info_request.public_body.name)) %> -<% if @existing_request %> - <div class="errorExplanation" id="errorExplanation"><ul> - <li> - <%= _('{{existing_request_user}} already - created the same request on {{date}}. You can either view the <a href="{{existing_request}}">existing request</a>, - or edit the details below to make a new but similar request.',:existing_request_user=>user_or_you_capital_link(@existing_request.user), :date=>simple_date(@existing_request.created_at), :existing_request=>request_url(@existing_request)) %> - </li> - </ul></div> -<% end %> + <h1><%= _('2. Ask for Information') %></h1> + + <% if @existing_request %> + <div class="errorExplanation" id="errorExplanation"><ul> + <li> + <%= _('{{existing_request_user}} already + created the same request on {{date}}. You can either view the <a href="{{existing_request}}">existing request</a>, + or edit the details below to make a new but similar request.',:existing_request_user=>user_or_you_capital_link(@existing_request.user), :date=>simple_date(@existing_request.created_at), :existing_request=>request_url(@existing_request)) %> + </li> + </ul></div> + <% end %> -<%= foi_error_messages_for :info_request, :outgoing_message %> + <%= foi_error_messages_for :info_request, :outgoing_message %> -<div id="request_advice"> - <h1><%= _('Read this before writing your {{info_request_law_used_full}} request', :info_request_law_used_full=>h(@info_request.law_used_full)) %></h1> - <ul> - <li> - <% form_tag("http://www.google.co.uk/search", {:id => "search_body_website_form", :method => "get"} ) do %> - <p> - <%= _('First,') %> - <% if !@info_request.public_body.publication_scheme.empty? %> - <%= _('<strong>browse</strong> the authority\'s <a href="%s">publication scheme</a> or <strong>search</strong> their web site ...') % [@info_request.public_body.publication_scheme] %> + <% form_for(:info_request, @info_request, :html => { :id => 'write_form' } ) do |f| %> + + <div id="request_header"> + <div id="request_header_body"> + <label class="form_label" for="info_request_public_body_id"><%= _('To:') %></label> + <span id="to_public_body"><%=h(@info_request.public_body.name)%></span> + <div class="form_item_note"> + <% if @info_request.public_body.info_requests.size > 0 %> + <%= _("Browse <a href='{{url}}'>other requests</a> to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_url(@info_request.public_body)) %> <% else %> - <%= _('<strong>search</strong> the authority\'s web site ...') %> + <%= _("Browse <a href='{{url}}'>other requests</a> for examples of how to word your request.", :url=>request_list_url) %> <% end %> - <% if !@info_request.public_body.calculated_home_page.nil? %> - <br> - <%= text_field_tag 'q', params[:q], { :size => 20 } %> - <%= hidden_field_tag 'as_sitesearch', @info_request.public_body.calculated_home_page %> - <%= submit_tag _("Search") %> - <% end %> - <br> - ... <%= _('to check that the info isn\'t already published.') %> - </p> - <% end %> - </li> + </div> - <li> - <% if @info_request.public_body.info_requests.size > 0 %> - <%= _("Browse <a href='{{url}}'>other requests</a> to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_url(@info_request.public_body)) %> - <% else %> - <%= _('Browse <a href="%s">other requests</a> for examples of how to word your request.') % [request_list_url] %> + <div id="request_header_text"> + <% if @info_request.public_body.has_notes? %> + <h3><%= _('Special note for this authority!') %></h3> + <p><%= @info_request.public_body.notes_as_html %></p> + <% end %> + </div> + + <% if @info_request.public_body.eir_only? %> + <h3><%= _('Please ask for environmental information only') %></h3> + + <p><%= _('The Freedom of Information Act <strong>does not apply</strong> to') %> <%=h(@info_request.public_body.name)%>. + <%= _('However, you have the right to request environmental + information under a different law') %> (<a href="/help/requesting#eir">explanation</a>). + <%= _('This covers a very wide spectrum of information about the state of + the <strong>natural and built environment</strong>, such as:') %> + + <ul> + <li><%= _('Air, water, soil, land, flora and fauna (including how these effect + human beings)') %></li> + <li><%= _('Information on emissions and discharges (e.g. noise, energy, + radiation, waste materials)') %></li> + <li><%= _('Human health and safety') %></li> + <li><%= _('Cultural sites and built structures (as they may be affected by the + environmental factors listed above)') %></li> + <li><%= _('Plans and administrative measures that affect these matters') %></li> + </ul> + + <p><%= _('Please only request information that comes under those categories, <strong>do not waste your + time</strong> or the time of the public authority by requesting unrelated information.') %></p> <% end %> - </li> - <li><%= _('Write your request in <strong>simple, precise language</strong>.') %></li> - <li><%= _('Ask for <strong>specific</strong> documents or information, this site is not suitable for general enquiries.') %></li> - <li><%= _('Keep it <strong>focused</strong>, you\'ll be more likely to get what you want (<a href="%s">why?</a>).') % [help_requesting_path + '#focused'] %></li> - <li><%= _('This site is <strong>public</strong>. Everything you type and any response will be published.') %></li> - </ul> - - <% if @info_request.public_body.has_notes? %> - <h1><%= _('Special note for this authority!') %></h1> - <ul> - <li><p><%= @info_request.public_body.notes_as_html %></p></li> - </ul> - <% end %> + </div> - <% if @info_request.public_body.eir_only? %> - <h1><%= _('Please ask for environmental information only') %></h1> + <div id="request_header_subject"> + <p> + <label class="form_label" for="typeahead_search"><%= _('Summary:') %></label> + <%= f.text_field :title, :size => 50, :id =>"typeahead_search" %> + </p> + <div class="form_item_note"> + (<%= _("a one line summary of the information you are requesting, \n\t\t\te.g.") %> + <% if @info_request.law_used == 'eir' %> + <%= _("'Pollution levels over time for the River Tyne'") %> + <% else %> + <%= _("'Crime statistics by ward level for Wales'") %> + <% end %> + ) + </div> + </div> - <p><%= _('The Freedom of Information Act <strong>does not apply</strong> to') %> <%=h(@info_request.public_body.name)%>. - <%= _('However, you have the right to request environmental - information under a different law') %> (<a href="/help/requesting#eir">explanation</a>). - <%= _('This covers a very wide spectrum of information about the state of - the <strong>natural and built environment</strong>, such as:') %> - + <div id="typeahead_response"> + </div> + </div> + + <div id="request_advice"> <ul> - <li><%= _('Air, water, soil, land, flora and fauna (including how these effect - human beings)') %></li> - <li><%= _('Information on emissions and discharges (e.g. noise, energy, - radiation, waste materials)') %></li> - <li><%= _('Human health and safety') %></li> - <li><%= _('Cultural sites and built structures (as they may be affected by the - environmental factors listed above)') %></li> - <li><%= _('Plans and administrative measures that affect these matters') %></li> + <li><%= _('Write your request in <strong>simple, precise language</strong>.') %></li> + <li><%= _('Ask for <strong>specific</strong> documents or information, this site is not suitable for general enquiries.') %></li> + <li><%= _('Keep it <strong>focused</strong>, you\'ll be more likely to get what you want (<a href="%s">why?</a>).') % [help_requesting_path + '#focused'] %></li> </ul> + </div> - <p><%= _('Please only request information that comes under those categories, <strong>do not waste your - time</strong> or the time of the public authority by requesting unrelated information.') %></p> - <% end %> -</div> - -<% form_for(:info_request, @info_request, :html => { :id => 'write_form' } ) do |f| %> - - <div id="request_form"> - <h1> - <label class="form_label" for="info_request_public_body_id"><%= _('To:') %></label> - <span id="to_public_body"><%=h(@info_request.public_body.name)%></span> - </h1> - - <p> - <label class="form_label" for="info_request_title"><%= _('Summary:') %></label> - <%= f.text_field :title, :size => 50 %> - </p> - <div class="form_item_note"> - (<%= _('a one line summary of the information you are requesting, - e.g.') %> - <% if @info_request.law_used == 'eir' %> - <%= _("'Pollution levels over time for the River Tyne'") %> - <% else %> - <%= _("'Crime statistics by ward level for Wales'") %> - <% end %> - ) - </div> - - <% fields_for :outgoing_message do |o| %> - <p> - <label class="form_label" for="outgoing_message_body"><%= _('Your request:') %></label> - <%= o.text_area :body, :rows => 20, :cols => 60 %> - </p> - <% end %> - + <div id="request_form"> + <% fields_for :outgoing_message do |o| %> + <p> + <label class="form_label" for="outgoing_message_body"><%= _('Your request:') %></label> + <%= o.text_area :body, :rows => 20, :cols => 60 %> + </p> + <% end %> + <% if !@user %> <p class="form_note"> <%= _('Everything that you enter on this page, including <strong>your name</strong>, @@ -126,18 +130,18 @@ this website forever (<a href="%s">why?</a>).') % [help_privacy_path+"#public_request"] %> </p> <% end %> - - <p class="form_note"> - <%= _('<strong> Can I request information about myself?</strong> - <a href="%s">No! (Click here for details)</a>') % [help_requesting_path+"#data_protection"] %> - </p> - - <div class="form_button"> - <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> - <%= hidden_field_tag(:submitted_new_request, 1 ) %> - <%= hidden_field_tag(:preview, 1 ) %> - <%= submit_tag _("Preview your public request") %> - </div> + + <p class="form_note"> + <%= _("<strong> Can I request information about myself?</strong>\n" + + "\t\t\t<a href=\"%s\">No! (Click here for details)</a>") % [help_requesting_path+"#data_protection"] %> + </p> + + <div class="form_button"> + <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> + <%= hidden_field_tag(:submitted_new_request, 1 ) %> + <%= hidden_field_tag(:preview, 1 ) %> + <%= submit_tag _("Preview your public request") %> + </div> <% if !@info_request.tag_string.empty? %> <p class="form_note"> @@ -148,8 +152,8 @@ <strong>Tags:</strong> <%=h @info_request.tag_string %> </p> <% end %> - - </div> + + </div> <% end %> diff --git a/app/views/request/preview.rhtml b/app/views/request/preview.rhtml index 6f6ecb2f9..45b6a3dc1 100644 --- a/app/views/request/preview.rhtml +++ b/app/views/request/preview.rhtml @@ -2,7 +2,7 @@ <% form_for(:info_request, @info_request, :html => { :id => 'preview_form' } ) do |f| %> - <h1><%= _('Now preview your request') %></h1> + <h1><%= _('3. Now check your request') %></h1> <ul> <li><%= _('Check you haven\'t included any <strong>personal information</strong>.') %></li> <li><%= _('Your name, request and any responses will appear in <strong>search engines</strong> @@ -37,14 +37,12 @@ <%= f.hidden_field(:tag_string) %> <%= hidden_field_tag(:submitted_new_request, 1) %> <%= hidden_field_tag(:preview, 0 ) %> - <%= submit_tag _("Re-edit this request"), :name => 'reedit' %> - <%= submit_tag _("Send public ") + h(@info_request.law_used_full) + " request", :name => 'submit' %> + <%= submit_tag _("Edit this request"), :name => 'reedit', :id => 'reedit_button' %> + <%= submit_tag _("Send request"), :name => 'submit', :id => 'submit_button' %> </p> <% if !@info_request.tag_string.empty? %> <p><strong><%= _('Tags:') %></strong> <%=h @info_request.tag_string %></p> <% end %> -<% end %> - - +<% end %>
\ No newline at end of file diff --git a/app/views/request/select_authority.rhtml b/app/views/request/select_authority.rhtml new file mode 100644 index 000000000..55ebc40c4 --- /dev/null +++ b/app/views/request/select_authority.rhtml @@ -0,0 +1,68 @@ +<script type="text/javascript" src="/javascripts/ba-throttle-debounce.js"></script> +<script type="text/javascript"> + $(document).ready(function(){ + $("#authority_preview").hide(); + + // Avoid triggering too often (on each keystroke) by using the debounce jQuery plugin: + // http://benalman.com/projects/jquery-throttle-debounce-plugin/ + $("#query").keypress($.debounce( 300, function() { + // Do a type ahead search and display results + $("#typeahead_response").load("<%=search_ahead_bodies_url%>?q="+encodeURI(this.value), function() { + $("#authority_preview").hide(); // Hide the preview, since results have changed + + }); + })); + // We're using the existing body list: we intercept the clicks on the titles to + // display a preview on the right hand side of the screen + $("#typeahead_response a").live('click', function() { + $("#authority_preview").load(this.href+" #public_body_show", function() { + $("#authority_preview").show(); + $("#authority_preview #header_right").hide(); + }); + return false; + }); + }); +</script> + +<% @title = _("Select the authority to write to") %> + + <h1 style="clear: left"><%= _('1. Select an authority') %></h1> + + <div id="authority_selection"> + <% form_tag({:controller => "request", :action => "select_authority"}, {:id => "search_form", :method => "get"}) do %> + <p> + <p> + <%= _('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="%s">why?</a>).') % help_about_url %> + </p> + <%= text_field_tag 'query', params[:query], { :size => 30 } %> + <%= hidden_field_tag 'bodies', 1 %> + <%= submit_tag _('Search') %> + </p> + <% end %> + <div id="typeahead_response"> + <% if !@xapian_requests.nil? %> + <% if @xapian_requests.results.size > 0 %> + <h3><%= _('Top search results:') %></h3> + <p> + <%= _('Select one to see more information about the authority.')%> + </p> + <% else %> + <h3><%= _('No results found.') %></h3> + <% end %> + <div id="authority_search_ahead_results"> + <% for result in @xapian_requests.results %> + <%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %> + <% end %> + </div> + <% end %> + + + + </div> + </div> + + <div id="authority_preview"> + </div> + diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index 2897a3564..c5d040fb7 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -22,7 +22,7 @@ <%= render :partial => 'sidebar' %> -<div id="request_main"> +<div id="left_column"> <h1><%=h(@info_request.title)%></h1> <% if @info_request.user.profile_photo %> diff --git a/app/views/request/simple_correspondence.rhtml b/app/views/request/simple_correspondence.rhtml new file mode 100644 index 000000000..45b90b84b --- /dev/null +++ b/app/views/request/simple_correspondence.rhtml @@ -0,0 +1,45 @@ +<%= _('This is a plain-text version of the Freedom of Information request "{{request_title}}". The latest, full version is available online at {{full_url}}', :request_title => @info_request.title, :full_url => "http://#{MySociety::Config.get('DOMAIN')}#{show_request_path(:url_title=>@info_request.url_title)}") %>. + +<% for info_request_event in @info_request_events %> +<% + incoming_message = nil + if info_request_event.visible + if !info_request_event.nil? && info_request_event.event_type == 'response' + incoming_message = info_request_event.incoming_message + end + + + if not incoming_message.nil? + if !incoming_message.safe_mail_from.nil? && incoming_message.safe_mail_from.strip != @info_request.public_body.name.strip %> +<%= _('From:') %> <%= incoming_message.safe_mail_from %><% end + if incoming_message.safe_mail_from.nil? || (incoming_message.mail_from_domain == @info_request.public_body.request_email_domain) %>, <%= @info_request.public_body.name %><% end %> +<%= _('To:') %> <%= @info_request.user.name %> +<%= _('Date:') %> <%= simple_date(incoming_message.sent_at) %> + +<%= incoming_message.get_body_for_quoting %> +<% incoming_message.get_attachments_for_display.each do |a| %> + <%= _('Attachment:') %> <%= a.display_filename %> (<%= a.display_size %>) + <% end %> +<% +elsif [ 'sent', 'followup_sent' ].include?(info_request_event.event_type) + outgoing_message = info_request_event.outgoing_message + %> +<%= _('From:') %> <%= @info_request.user.name %> +<%= _('To:') %> <%= @info_request.public_body.name %> +<%= _('Date:') %> <%= simple_date(info_request_event.created_at) %> +<% + text = outgoing_message.body.strip + outgoing_message.remove_privacy_sensitive_things!(text) %> + +<%= text %> +<% elsif [ 'resent', 'followup_resent' ].include?(info_request_event.event_type) %> +<%= _('Date:') %> <%= simple_date(info_request_event.created_at) %> +Sent <% if info_request_event.outgoing_message.message_type == 'initial_request' %> request <% elsif info_request_event.outgoing_message.message_type == 'followup' %> a follow up <% else %> <% raise "unknown message_type" %><% end %> to <%= public_body_link(@info_request.public_body) %> again<% if not info_request_event.same_email_as_previous_send? %>, using a new contact address<% end %>. + +<% elsif info_request_event.event_type == 'comment' + comment = info_request_event.comment +%> +<%= _("{{username}} left an annotation:", :username =>comment.user.name) %> (<%= simple_date(comment.created_at || Time.now) %>) +<%= comment.body.strip %> +<% end %> +-------------------------------<% end %><% end %> |