diff options
Diffstat (limited to 'app/views')
35 files changed, 351 insertions, 319 deletions
diff --git a/app/views/admin_general/admin.coffee b/app/views/admin_general/admin.coffee deleted file mode 100644 index 3d39369a4..000000000 --- a/app/views/admin_general/admin.coffee +++ /dev/null @@ -1,24 +0,0 @@ -jQuery -> - $('.locales a:first').tab('show') - $('.accordion-body').on('hidden', -> - $(@).prev().find('i').first().removeClass().addClass('icon-chevron-right') - ) - $('.accordion-body').on('shown', -> - $(@).prev().find('i').first().removeClass().addClass('icon-chevron-down')) - $('.toggle-hidden').live('click', -> - $(@).parents('td').find('div:hidden').show() - false) - $('#request_hidden_user_explanation_reasons input').live('click', -> - $('#request_hidden_user_subject, #request_hidden_user_explanation, #request_hide_button').show() - info_request_id = $('#hide_request_form').attr('data-info-request-id') - reason = $(this).val() - $('#request_hidden_user_explanation_field').attr("value", "[loading default text...]") - $.ajax "/hidden_user_explanation?reason=" + reason + "&info_request_id=" + info_request_id, - type: "GET" - dataType: "text" - error: (data, textStatus, jqXHR) -> - $('#request_hidden_user_explanation_field').attr("value", "Error: #{textStatus}") - success: (data, textStatus, jqXHR) -> - $('#request_hidden_user_explanation_field').attr("value", data) - ) - diff --git a/app/views/admin_general/admin.js b/app/views/admin_general/admin.js deleted file mode 100644 index 9daa51459..000000000 --- a/app/views/admin_general/admin.js +++ /dev/null @@ -1,32 +0,0 @@ -(function() { - jQuery(function() { - $('.locales a:first').tab('show'); - $('.accordion-body').on('hidden', function() { - return $(this).prev().find('i').first().removeClass().addClass('icon-chevron-right'); - }); - $('.accordion-body').on('shown', function() { - return $(this).prev().find('i').first().removeClass().addClass('icon-chevron-down'); - }); - $('.toggle-hidden').live('click', function() { - $(this).parents('td').find('div:hidden').show(); - return false; - }); - return $('#request_hidden_user_explanation_reasons input').live('click', function() { - var info_request_id, reason; - $('#request_hidden_user_subject, #request_hidden_user_explanation, #request_hide_button').show(); - info_request_id = $('#hide_request_form').attr('data-info-request-id'); - reason = $(this).val(); - $('#request_hidden_user_explanation_field').attr("value", "[loading default text...]"); - return $.ajax("/hidden_user_explanation?reason=" + reason + "&info_request_id=" + info_request_id, { - type: "GET", - dataType: "text", - error: function(data, textStatus, jqXHR) { - return $('#request_hidden_user_explanation_field').attr("value", "Error: " + textStatus); - }, - success: function(data, textStatus, jqXHR) { - return $('#request_hidden_user_explanation_field').attr("value", data); - } - }); - }); - }); -}).call(this); diff --git a/app/views/admin_general/admin_js.erb b/app/views/admin_general/admin_js.erb deleted file mode 100644 index c8788a452..000000000 --- a/app/views/admin_general/admin_js.erb +++ /dev/null @@ -1,34 +0,0 @@ -(function() { - - jQuery(function() { - $('.locales a:first').tab('show'); - $('.accordion-body').on('hidden', function() { - return $(this).prev().find('i').first().removeClass().addClass('icon-chevron-right'); - }); - $('.accordion-body').on('shown', function() { - return $(this).prev().find('i').first().removeClass().addClass('icon-chevron-down'); - }); - $('.toggle-hidden').live('click', function() { - $(this).parents('td').find('div:hidden').show(); - return false; - }); - return $('#request_hidden_user_explanation_reasons input').live('click', function() { - var info_request_id, reason; - $('#request_hidden_user_subject, #request_hidden_user_explanation, #request_hide_button').show(); - info_request_id = $('#hide_request_form').attr('data-info-request-id'); - reason = $(this).val(); - $('#request_hidden_user_explanation_field').attr("value", "[loading default text...]"); - return $.ajax("/hidden_user_explanation?reason=" + reason + "&info_request_id=" + info_request_id, { - type: "GET", - dataType: "text", - error: function(data, textStatus, jqXHR) { - return $('#request_hidden_user_explanation_field').attr("value", "Error: " + textStatus); - }, - success: function(data, textStatus, jqXHR) { - return $('#request_hidden_user_explanation_field').attr("value", data); - } - }); - }); - }); - -}).call(this); diff --git a/app/views/admin_general/index.html.erb b/app/views/admin_general/index.html.erb index b239a2b3f..976860fa7 100644 --- a/app/views/admin_general/index.html.erb +++ b/app/views/admin_general/index.html.erb @@ -164,7 +164,7 @@ <%= request_both_links(@request) %> </td> <td class="span2"> - <%=simple_date(@request.get_last_response_event.created_at)%> + <%=simple_date(@request.get_last_public_response_event.created_at)%> </td> </tr> <% end %> diff --git a/app/views/admin_general/timeline.html.erb b/app/views/admin_general/timeline.html.erb index 439ae1e68..c4ea4849b 100644 --- a/app/views/admin_general/timeline.html.erb +++ b/app/views/admin_general/timeline.html.erb @@ -34,7 +34,7 @@ <%= request_both_links(event.info_request) %> <% if event.event_type == 'edit' %> was edited by administrator <strong><%=h event.params[:editor] %></strong>. - <% for p in ['title', 'prominence', 'described_state', 'awaiting_description'] + <% for p in ['title', 'described_state', 'awaiting_description'] if event.params[p.to_sym] != event.params[('old_'+p).to_sym] %> Changed <%=p%> from '<%=h event.params[('old_'+p).to_sym]%>' to '<%=h event.params[p.to_sym] %>'. <% end diff --git a/app/views/admin_incoming_message/_intro.html.erb b/app/views/admin_incoming_message/_intro.html.erb new file mode 100644 index 000000000..1d5585f11 --- /dev/null +++ b/app/views/admin_incoming_message/_intro.html.erb @@ -0,0 +1,3 @@ +<% @title = "Incoming message #{incoming_message.id} of FOI request '#{incoming_message.info_request.title}'" %> +<h1>Incoming message <%= incoming_message.id %></h1> +<p>FOI request: <%= request_both_links(incoming_message.info_request) %></p> diff --git a/app/views/admin_incoming_message/edit.html.erb b/app/views/admin_incoming_message/edit.html.erb new file mode 100644 index 000000000..1088edcab --- /dev/null +++ b/app/views/admin_incoming_message/edit.html.erb @@ -0,0 +1,26 @@ +<%= render :partial => 'intro', :locals => {:incoming_message => @incoming_message } %> +<%= render :partial => 'admin_request/incoming_message_actions', :locals => { :incoming_message => @incoming_message } %> +<fieldset class="form-horizontal"> + <legend>Prominence</legend> + <%= form_tag admin_incoming_update_path(@incoming_message), :class => "form form-inline" do %> + + <div class="control-group"> + <label class="control-label" for="incoming_message_prominence"> Prominence</label> + <div class="controls"> + <%= select('incoming_message', "prominence", IncomingMessage.prominence_states) %> + </div> + </div> + + <div class="control-group"> + <label class="control-label" for="incoming_message_prominence_reason">Reason for prominence</label> + <div class="controls"> + <%= text_area "incoming_message", "prominence_reason", :rows => 5, :class => "span6" %> + </div> + </div> + + <div class="form-actions" > + <%= submit_tag 'Save', :class => "btn" %> + </div> + + <% end %> +</fieldset> diff --git a/app/views/admin_outgoing_message/edit.html.erb b/app/views/admin_outgoing_message/edit.html.erb new file mode 100644 index 000000000..d5f5f43bf --- /dev/null +++ b/app/views/admin_outgoing_message/edit.html.erb @@ -0,0 +1,50 @@ +<h1>Edit outgoing message</h1> + +<%= error_messages_for 'outgoing_message' %> + +<%= form_tag admin_outgoing_update_path(@outgoing_message) do %> + <div class="control-group"> + <label class="control-label" for="outgoing_message_prominence"> Prominence</label> + <div class="controls"> + <%= select('outgoing_message', "prominence", OutgoingMessage.prominence_states) %> + </div> + </div> + + <div class="control-group"> + <label class="control-label" for="outgoing_message_prominence_reason">Reason for prominence</label> + <div class="controls"> + <%= text_area "outgoing_message", "prominence_reason", :rows => 5, :class => "span6" %> + </div> + </div> + + <div class="control-group"> + <label class="control-label" for="outgoing_message_body">Body of message</label> + <div class="controls"> + <%= text_area 'outgoing_message', 'body', :rows => 10, :cols => 60 %> + </div> + + <p><strong>Note:</strong> This is mainly to be used to excise information + that users inadvertently put in their messages, not realising it would be + public. It will already have been sent to the public authority, and their + reply may also include that information and be automatically published on + this site. You could also use this to edit a message before resending it, but + only the edited version will be shown on the public page if you do that.</p> + +<div class="form-actions" > +<%= submit_tag 'Save', :accesskey => 's', :class => 'btn' %> +</div> +<% end %> + +<p> +<%= link_to 'Show', admin_request_show_path(@outgoing_message.info_request) %> | +<%= link_to 'List all', admin_request_list_path %> +</p> + +<%= form_tag admin_outgoing_destroy_path do %> + <div> + <%= hidden_field_tag 'outgoing_message_id', @outgoing_message.id %> + <%= submit_tag "Destroy outgoing message", :class => "btn btn-danger", :confirm => "This is permanent! Are you sure?" %> + </div> +<% end %> + + diff --git a/app/views/admin_request/_incoming_message_actions.html.erb b/app/views/admin_request/_incoming_message_actions.html.erb index 653e73337..4cf099b53 100644 --- a/app/views/admin_request/_incoming_message_actions.html.erb +++ b/app/views/admin_request/_incoming_message_actions.html.erb @@ -1,6 +1,6 @@ <fieldset class="form-horizontal"> <legend>Actions</legend> - <%= form_tag admin_request_redeliver_incoming_path, :class => "form form-inline" do %> + <%= form_tag admin_incoming_redeliver_path, :class => "form form-inline" do %> <div class="control-group"> <label class="control-label" for="url_title_<%= incoming_message.id %>">Redeliver message to one or more other requests</label> <div class="controls"> @@ -22,7 +22,7 @@ </div> </div> - <%= form_tag admin_request_destroy_incoming_path, :class => "form form-inline" do %> + <%= form_tag admin_incoming_destroy_path, :class => "form form-inline" do %> <div class="control-group"> <label class="control-label" for="destroy_message_<%= incoming_message.id %>">Destroy message</label> <div class="controls"> diff --git a/app/views/admin_request/edit_outgoing.html.erb b/app/views/admin_request/edit_outgoing.html.erb deleted file mode 100644 index a0c60520a..000000000 --- a/app/views/admin_request/edit_outgoing.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -<h1>Edit outgoing message</h1> - -<%= error_messages_for 'outgoing_message' %> - -<%= form_tag admin_request_update_outgoing_path(@outgoing_message) do %> - - <p><label for="outgoing_message_body">Body of message</label><br/> - <%= text_area 'outgoing_message', 'body', :rows => 10, :cols => 60 %></p> - - <p><strong>Note:</strong> This is mainly to be used to excise information - that users inadvertently put in their messages, not realising it would be - public. It will already have been sent to the public authority, and their - reply may also include that information and be automatically published on - this site. You could also use this to edit a message before resending it, but - only the edited version will be shown on the public page if you do that.</p> - - <p><%= submit_tag 'Save', :accesskey => 's' %></p> -<% end %> - -<p> -<%= link_to 'Show', admin_request_show_path(@outgoing_message.info_request) %> | -<%= link_to 'List all', admin_request_list_path %> -</p> - -<%= form_tag admin_request_destroy_outgoing_path do %> - <div> - <%= hidden_field_tag 'outgoing_message_id', @outgoing_message.id %> - Warning, this is permanent! ---> - <%= submit_tag "Destroy outgoing message" %> - </div> -<% end %> - - diff --git a/app/views/admin_request/show.html.erb b/app/views/admin_request/show.html.erb index e18e319be..83d9c3764 100644 --- a/app/views/admin_request/show.html.erb +++ b/app/views/admin_request/show.html.erb @@ -233,7 +233,7 @@ <div class="accordion-group"> <div class="accordion-heading"> <a href="#outgoing_<%=outgoing_message.id%>" data-toggle="collapse" data-parent="#outgoing_messages"><%= chevron_right %></a> - <%= link_to admin_request_edit_outgoing_path(outgoing_message) do %> + <%= link_to admin_outgoing_edit_path(outgoing_message) do %> #<%= outgoing_message.id %> -- <%= outgoing_message.status.humanize %> <%= outgoing_message.message_type.humanize %> <% end %> <blockquote> @@ -275,11 +275,16 @@ <hr> <h2>Incoming messages</h2> <div class="accordion" id="incoming_messages"> - <% for incoming_message in @info_request.incoming_messages.find(:all, :order => 'created_at') %> + <% for incoming_message in @info_request.incoming_messages %> <div class="accordion-group"> <div class="accordion-heading"> <a href="#incoming_<%=incoming_message.id%>" data-toggle="collapse" data-parent="#incoming_messages"><%= chevron_right %></a> - <%=incoming_message.id%> -- <%= h(incoming_message.mail_from) %> <%=_("at")%> <%=admin_value(incoming_message.sent_at)%> + <%= link_to admin_incoming_edit_path(incoming_message) do %> + <%=incoming_message.id%> + -- + <%= h(incoming_message.mail_from) %> + <%=_("at")%> <%=admin_value(incoming_message.sent_at)%> + <% end %> <blockquote class="incoming-message"> <% if !incoming_message.cached_main_body_text_folded.nil? %> <%= truncate(incoming_message.cached_main_body_text_folded.gsub('FOLDED_QUOTED_SECTION', ''), :length => 400) %> diff --git a/app/views/admin_request/show_raw_email.html.erb b/app/views/admin_request/show_raw_email.html.erb index 72c782ad6..da22b6069 100644 --- a/app/views/admin_request/show_raw_email.html.erb +++ b/app/views/admin_request/show_raw_email.html.erb @@ -1,9 +1,5 @@ -<% @title = "Incoming message #{@raw_email.incoming_message.id} of FOI request '#{@raw_email.incoming_message.info_request.title}'" %> +<%= render :partial => 'admin_incoming_message/intro', :locals => { :incoming_message => @raw_email.incoming_message } %> -<h1>Incoming message <%=@raw_email.incoming_message.id %></h1> - -<p> - FOI request: <%= request_both_links(@raw_email.incoming_message.info_request) %> <% if @holding_pen %> <br>This is in the holding pen because: <strong><%= @rejected_reason %></strong> <% if @public_bodies.size > 0 %> diff --git a/app/views/comment/_single_comment.html.erb b/app/views/comment/_single_comment.html.erb index 421a9d4ba..af1de0649 100644 --- a/app/views/comment/_single_comment.html.erb +++ b/app/views/comment/_single_comment.html.erb @@ -1,5 +1,5 @@ <div class="comment_in_request" id="comment-<%=comment.id.to_s%>"> - <% if comment.user && comment.user.profile_photo %> + <% if comment.user && comment.user.profile_photo && !@render_to_file %> <div class="user_photo_on_comment"> <img src="<%= get_profile_photo_url(:url_name => comment.user.url_name) %>" alt=""> </div> diff --git a/app/views/comment/_single_comment.text.erb b/app/views/comment/_single_comment.text.erb new file mode 100644 index 000000000..925e8b688 --- /dev/null +++ b/app/views/comment/_single_comment.text.erb @@ -0,0 +1,2 @@ +<%= _("{{username}} left an annotation:", :username =>comment.user.name) %> (<%= simple_date(comment.created_at || Time.now) %>) +<%= comment.body.strip %> diff --git a/app/views/general/_stylesheet_includes.html.erb b/app/views/general/_stylesheet_includes.html.erb index 9dd1f357d..416ddb825 100644 --- a/app/views/general/_stylesheet_includes.html.erb +++ b/app/views/general/_stylesheet_includes.html.erb @@ -1,16 +1,23 @@ - <%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet", :media => "all" %> - <%= stylesheet_link_tag 'fonts', :rel => "stylesheet", :media => "all" %> - <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "print" %> - <% if !params[:print_stylesheet].nil? %> - <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "all" %> - <% end %> - <%= 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]--> - <!--[if LT IE 8]> - <style type="text/css">@import url("/stylesheets/ie7.css");</style> - <![endif]--> - <% if AlaveteliConfiguration::force_registration_on_new_request %> - <%= stylesheet_link_tag 'jquery.fancybox-1.3.4', :rel => "stylesheet" %> - <% end %> +<%- if @render_to_file %> + <style> + <%= raw File.read(Rails.root.join('public', 'stylesheets', 'main.css')) %> + <%= raw File.read(Rails.root.join('public', 'stylesheets', 'print.css')) %> + </style> +<%- else %> + <%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet", :media => "all" %> + <%= stylesheet_link_tag 'fonts', :rel => "stylesheet", :media => "all" %> + <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "print" %> + <% if !params[:print_stylesheet].nil? %> + <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "all" %> + <% end %> + <%= 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]--> + <!--[if LT IE 8]> + <style type="text/css">@import url("/stylesheets/ie7.css");</style> + <![endif]--> + <% if AlaveteliConfiguration::force_registration_on_new_request %> + <%= stylesheet_link_tag 'jquery.fancybox-1.3.4', :rel => "stylesheet" %> + <% end %> +<% end %> diff --git a/app/views/layouts/_favicon.html.erb b/app/views/layouts/_favicon.html.erb new file mode 100644 index 000000000..4f3859d6c --- /dev/null +++ b/app/views/layouts/_favicon.html.erb @@ -0,0 +1 @@ +<link rel="shortcut icon" href="/favicon.ico"> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index a58913892..7722efad4 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -4,7 +4,7 @@ <meta http-equiv="content-type" content="text/html;charset=UTF-8" > <title><%= site_name %> admin<%= @title ? ":" : "" %> <%=@title%></title> - <%= javascript_include_tag '/javascripts/jquery.js', '/admin/javascripts/jquery-ui.min.js', '/admin/javascripts/bootstrap-collapse', '/admin/javascripts/bootstrap-tab', '/admin/javascripts/admin' %> + <%= javascript_include_tag '/javascripts/jquery.js', '/admin/javascripts/jquery-ui.min.js', '/admin/javascripts/bootstrap-collapse', '/admin/javascripts/bootstrap-tab', '/admin/javascripts/admin', '/javascripts/jquery_ujs' %> <%= stylesheet_link_tag 'admin-theme/jquery-ui-1.8.15.custom.css', :rel => 'stylesheet'%> <%= stylesheet_link_tag "/admin/stylesheets/admin", :title => "Main", :rel => "stylesheet" %> diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 472fa8ec1..5895becf7 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -10,7 +10,7 @@ <% end %> </title> - <link rel="shortcut icon" href="/favicon.ico"> + <%= render :partial => 'layouts/favicon' %> <%= render :partial => 'general/stylesheet_includes' %> <% if is_admin? %> diff --git a/app/views/public_body/statistics.html.erb b/app/views/public_body/statistics.html.erb new file mode 100644 index 000000000..840af0c10 --- /dev/null +++ b/app/views/public_body/statistics.html.erb @@ -0,0 +1,75 @@ +<% @title = _("Public Body Statistics") %> +<div id="main_content"> + <h1>Public Body Statistics</h1> + + <p><%= _("This page of public body statistics is currently \ +experimental, so there are some caveats that should be borne \ +in mind:") %></p> + + <ul> + + <li><%= _("The percentages are calculated with respect to \ +the total number of requests, which includes invalid \ +requests; this is a known problem that will be fixed in a \ +later release.") %></li> + + <li><%= _("The classification of requests (e.g. to say \ +whether they were successful or not) is done manually by users \ +and administrators of the site, which means that they are \ +subject to error.") %></li> + + <li><%= _("Requests are considered successful if they were \ +classified as either 'Successful' or 'Partially Successful'.") %></li> + + <li><%= _("Requests are considered overdue if they are in \ +the 'Overdue' or 'Very Overdue' states.") %></li> + + <li><%= _("The error bars shown are 95% confidence intervals \ +for the hypothesized underlying proportion (i.e. that which \ +you would obtain by making an infinite number of requests \ +through this site to that authority). In other words, the \ +population being sampled is all the current and future \ +requests to the authority through this site, rather than, \ +say, all requests that have been made to the public body by \ +any means.") %></li> + + </ul> + + <p><%= _("These graphs were partly inspired by \ +<a href=\"http://mark.goodge.co.uk/2011/08/number-crunching-whatdotheyknow/\">some \ +statistics that Mark Goodge produced for WhatDoTheyKnow</a>, so thanks \ +are due to him.") %></p> + + <% @graph_list.each do |graph_data| %> + <h3 class="public-body-ranking-title"><%= graph_data['title']%></h3> + <div class="public-body-ranking" id="<%= graph_data['id'] %>"> + <% if graph_data['x_values'] %> + <table border=0> + <thead> + <tr> + <th>Public Body</th> + <th><%= graph_data['y_axis'] %></th> + </tr> + </thead> + <tbody> + <% graph_data['x_ticks'].each_with_index do |pb_and_index, i| %> + <tr> + <td><%= pb_and_index[1] %></td> + <td class="statistic"><%= graph_data['y_values'][i].round %></td> + </tr> + <% end %> + </tbody> + </table> + <% else %> + <%= _("There was no data calculated for this graph yet.") %> + <% end %> + </div> + <% end %> + +<script type="text/javascript"> + var graphs_data = <%= @graph_list.to_json.html_safe %>; +</script> +<!--[if lte IE 8]><%= javascript_include_tag 'excanvas.min.js' %><![endif]--> +<%= javascript_include_tag 'jquery.flot.min.js', 'jquery.flot.errorbars.min.js', 'jquery.flot.axislabels.js', 'stats-graphs.js' %> + +</div> diff --git a/app/views/request/_after_actions.html.erb b/app/views/request/_after_actions.html.erb index b54a8f5fb..f780e3a37 100644 --- a/app/views/request/_after_actions.html.erb +++ b/app/views/request/_after_actions.html.erb @@ -15,11 +15,9 @@ <%= link_to _('Update the status of this request'), '#describe_state_form_1' %> </li> <% end %> - <% if @info_request.all_can_view? %> <li> <%= link_to _("Download a zip file of all correspondence"), download_entire_request_path(:url_title => @info_request.url_title) %> </li> - <% end %> </ul> </div> <% if ! @info_request.is_external? %> diff --git a/app/views/request/_correspondence.html.erb b/app/views/request/_correspondence.html.erb index 68711b259..872761749 100644 --- a/app/views/request/_correspondence.html.erb +++ b/app/views/request/_correspondence.html.erb @@ -1,80 +1,12 @@ <div class="ff-print-fix"></div> -<% -if !info_request_event.nil? && info_request_event.event_type == 'response' - incoming_message = info_request_event.incoming_message -end - -if not incoming_message.nil? -%> - <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 %> - <%= _("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> - <% end %> - <br><%= simple_date(incoming_message.sent_at) %> - </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 } %> - - <p class="event_actions"> - <% if !@user.nil? && @user.admin_page_links? %> - <%= link_to "Admin", admin_request_show_raw_email_path(incoming_message.raw_email_id) %> | - <% end %> - <%= link_to _("Link to this"), incoming_message_path(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="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>"> - - <h2> - <%= _("From:") %> <%=h @info_request.user_name %><br> - <br><%= simple_date(info_request_event.created_at) %> - </h2> - - <%= render :partial => 'bubble', :locals => { :body => outgoing_message.get_body_for_html_display(), :attachments => nil } %> - - <p class="event_actions"> - <% if outgoing_message.status == 'ready' && !@info_request.is_external? %> - <strong>Warning:</strong> This message has <strong>not yet been sent</strong> for an unknown reason. - <% end %> - - <!-- Can use this to get name of who followup was too, if say you - play with proper from display, but not sure needed - <% if outgoing_message.message_type == 'followup' && !outgoing_message.incoming_message_followup.nil? && !outgoing_message.incoming_message_followup.safe_mail_from.nil? %> - Follow up sent to: <%=h outgoing_message.incoming_message_followup.safe_mail_from %> - <% end %> - --> - - <%= link_to _("Link to this"), outgoing_message_path(outgoing_message), :class => "link_to_this" %> - </p> - </div> -<% elsif [ 'resent', 'followup_resent' ].include?(info_request_event.event_type) %> - <div class="outgoing correspondence" id="outgoing-<%=info_request_event.outgoing_message.id.to_s%>"> - <h2> - <%= simple_date(info_request_event.created_at) %> - </h2> - <p class="event_plain"> - 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 %>. - </p> - </div> -<% elsif info_request_event.event_type == 'comment' - comment = info_request_event.comment -%> - <%= render :partial => 'comment/single_comment', :locals => { :comment => comment } %> +<% case info_request_event.event_type %> +<% when 'response' %> + <%= render :partial => 'request/incoming_correspondence', :locals => { :incoming_message => info_request_event.incoming_message } %> +<% when 'sent', 'followup_sent' %> + <%= render :partial => 'request/outgoing_correspondence', :locals => { :outgoing_message => info_request_event.outgoing_message, :info_request_event => info_request_event }%> +<% when 'resent', 'followup_resent' %> + <%= render :partial => 'request/resent_outgoing_correspondence', :locals => { outgoing_message => info_request_event.outgoing_message, :info_request_event => info_request_event }%> +<% when 'comment' %> + <%= render :partial => 'comment/single_comment', :locals => { :comment => info_request_event.comment } %> <% end %> diff --git a/app/views/request/_hidden_correspondence.html.erb b/app/views/request/_hidden_correspondence.html.erb index 4c06f1f48..153164278 100644 --- a/app/views/request/_hidden_correspondence.html.erb +++ b/app/views/request/_hidden_correspondence.html.erb @@ -1,33 +1,13 @@ -<% if info_request_event.prominence == 'requester_only' %> - <% - if !info_request_event.nil? && info_request_event.event_type == 'response' - incoming_message = info_request_event.incoming_message - end - if not incoming_message.nil? - %> - <div class="correspondence" id="incoming-<%=incoming_message.id.to_s%>"> - <p> - <%= _('This response has been hidden. See annotations to find out why. - If you are the requester, then you may <a href="{{url}}">sign in</a> to view the response.', :url => signin_url(:r => request.fullpath).html_safe) %> - </p> - </div> - <% elsif [ 'sent', 'followup_sent', 'resent', 'followup_resent' ].include?(info_request_event.event_type) %> - <div class="correspondence" id="outgoing-<%=outgoing_message.id.to_s%>"> - <p> - <%= _('This outgoing message has been hidden. See annotations to - find out why. If you are the requester, then you may <a href="{{url}}">sign in</a> to view the response.', :url => signin_url(:r => request.fullpath).html_safe) %> - </p> - </div> - <% elsif info_request_event.event_type == 'comment' %> - <div class="comment_in_request" id="comment-<%=comment.id.to_s%>"> - <p><%= _('This comment has been hidden. See annotations to - find out why. If you are the requester, then you may <a href="{{url}}">sign in</a> to view the response.', :url => signin_url(:r => request.fullpath).html_safe) %> - </p> - </div> - <% end %> - -<% elsif info_request_event.prominence == 'hidden' %> - <% # show nothing when hidden %> -<% else %> - <% raise _("unexpected prominence on request event") %> -<% end %> +<p id="hidden_message"> + <%- if !message.prominence_reason.blank? %> + <%= _('This message has been hidden.') %> + <%= message.prominence_reason %> + <%= _('Please <a href="{{url}}">contact us</a> if you have any questions.', :url => help_contact_path.html_safe) %> + <%- else %> + <%= _("This message has been hidden. There are various reasons why we might have done this, sorry we can't be more specific here.") %> + <%= _('Please <a href="{{url}}">contact us</a> if you have any questions.', :url => help_contact_path.html_safe) %> + <%- end %> + <% if message.prominence == 'requester_only' %> + <%= _('If you are the requester, then you may <a href="{{url}}">sign in</a> to view the message.', :url => signin_url(:r => request.fullpath).html_safe) %> + <% end %> +</p> diff --git a/app/views/request/_hidden_correspondence.text.erb b/app/views/request/_hidden_correspondence.text.erb new file mode 100644 index 000000000..010b6b66d --- /dev/null +++ b/app/views/request/_hidden_correspondence.text.erb @@ -0,0 +1,5 @@ +<%- if !message.prominence_reason.blank? %> + <%= _('This message has been hidden.') %> <%= message.prominence_reason %> +<%- else %> + <%= _("This message has been hidden. There are various reasons why we might have done this, sorry we can't be more specific here.") %> +<%- end %> diff --git a/app/views/request/_incoming_correspondence.html.erb b/app/views/request/_incoming_correspondence.html.erb new file mode 100644 index 000000000..f39d650d8 --- /dev/null +++ b/app/views/request/_incoming_correspondence.html.erb @@ -0,0 +1,26 @@ +<div class="incoming correspondence <%= incoming_message.prominence %>" id="incoming-<%=incoming_message.id.to_s%>"> + <%- if not incoming_message.user_can_view?(@user) %> + <%= render :partial => 'request/hidden_correspondence', :locals => { :message => incoming_message }%> + <%- else %> + <%= render :partial => 'request/restricted_correspondence', :locals => {:message => incoming_message } %> + <h2> + <% if incoming_message.specific_from_name? %> + <%= _("From:") %> <%= incoming_message.safe_mail_from %><br> + <% end %> + <% if incoming_message.from_public_body? %> + <%= @info_request.public_body.name %><br> + <% end %> + <br><%= simple_date(incoming_message.sent_at) %> + </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 } %> + + <p class="event_actions"> + <% if !@user.nil? && @user.admin_page_links? %> + <%= link_to "Admin", admin_incoming_edit_path(incoming_message.id) %> | + <% end %> + <%= link_to _("Link to this"), incoming_message_path(incoming_message), :class => "link_to_this" %> + </p> + <%- end %> +</div> + diff --git a/app/views/request/_incoming_correspondence.text.erb b/app/views/request/_incoming_correspondence.text.erb new file mode 100644 index 000000000..33ddad926 --- /dev/null +++ b/app/views/request/_incoming_correspondence.text.erb @@ -0,0 +1,12 @@ +<%- if not incoming_message.user_can_view?(@user) %> + <%= render :partial => 'request/hidden_correspondence.text', :locals => { :message => incoming_message }%> +<%- else %> +<%= _('From:') %><% if incoming_message.specific_from_name? %> <%= incoming_message.safe_mail_from %><% end %><% if incoming_message.from_public_body? %>, <%= @info_request.public_body.name %><% end %> +<%= _('To:') %> <% if @info_request.user_name %><%= @info_request.user_name %><% else %><%= "[#{_('An anonymous user')}]"%><% end %> +<%= _('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 %> +<% end %> diff --git a/app/views/request/_outgoing_correspondence.html.erb b/app/views/request/_outgoing_correspondence.html.erb new file mode 100644 index 000000000..dced5c94c --- /dev/null +++ b/app/views/request/_outgoing_correspondence.html.erb @@ -0,0 +1,18 @@ +<div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>"> + <%- if not outgoing_message.user_can_view?(@user) %> + <%= render :partial => 'request/hidden_correspondence', :locals => { :message => outgoing_message }%> + <%- else %> + <%= render :partial => 'request/restricted_correspondence', :locals => {:message => outgoing_message } %> + <h2> + <%= _("From:") %> <%= @info_request.user_name %><br> + <br><%= simple_date(info_request_event.created_at) %> + </h2> + <%= render :partial => 'bubble', :locals => { :body => outgoing_message.get_body_for_html_display(), :attachments => nil } %> + <p class="event_actions"> + <% if outgoing_message.status == 'ready' && !@info_request.is_external? %> + <strong>Warning:</strong> This message has <strong>not yet been sent</strong> for an unknown reason. + <% end %> + <%= link_to _("Link to this"), outgoing_message_path(outgoing_message), :class => "link_to_this" %> + </p> + <%- end %> +</div> diff --git a/app/views/request/_outgoing_correspondence.text.erb b/app/views/request/_outgoing_correspondence.text.erb new file mode 100644 index 000000000..80c71cc01 --- /dev/null +++ b/app/views/request/_outgoing_correspondence.text.erb @@ -0,0 +1,8 @@ +<%- if not outgoing_message.user_can_view?(@user) %> + <%= render :partial => 'request/hidden_correspondence.text', :locals => { :message => outgoing_message }%> +<%- else %> + <%= _('From:') %> <% if @info_request.user_name %><%= @info_request.user_name %><% else %><%= "[#{_('An anonymous user')}]"%><% end %> + <%= _('To:') %> <%= @info_request.public_body.name %> + <%= _('Date:') %> <%= simple_date(info_request_event.created_at) %> + <%= outgoing_message.get_body_for_text_display %> +<%- end %> diff --git a/app/views/request/_resent_outgoing_correspondence.html.erb b/app/views/request/_resent_outgoing_correspondence.html.erb new file mode 100644 index 000000000..17b6b635b --- /dev/null +++ b/app/views/request/_resent_outgoing_correspondence.html.erb @@ -0,0 +1,16 @@ +<div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>"> + <h2> + <%= simple_date(info_request_event.created_at) %> + </h2> + <p class="event_plain"> + Sent + <% if outgoing_message.message_type == 'initial_request' %> + request + <% elsif 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 %>. + </p> +</div> diff --git a/app/views/request/_resent_outgoing_correspondence.text.erb b/app/views/request/_resent_outgoing_correspondence.text.erb new file mode 100644 index 000000000..d645e9488 --- /dev/null +++ b/app/views/request/_resent_outgoing_correspondence.text.erb @@ -0,0 +1,2 @@ +<%= _('Date:') %> <%= simple_date(info_request_event.created_at) %> +Sent <% if outgoing_message.message_type == 'initial_request' %> request <% elsif 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 %>. diff --git a/app/views/request/_restricted_correspondence.html.erb b/app/views/request/_restricted_correspondence.html.erb new file mode 100644 index 000000000..745c4ff0e --- /dev/null +++ b/app/views/request/_restricted_correspondence.html.erb @@ -0,0 +1,18 @@ +<% if message.prominence == 'hidden' %> + <p id="hidden_message"> + <%- if !message.prominence_reason.blank? %> + <%= _('This message has prominence \'hidden\'. {{reason}} You can only see it because you are logged in as a super user.', :reason => message.prominence_reason) %> + <%- else %> + <%= _('This message has prominence \'hidden\'. You can only see it because you are logged in as a super user.') %> + <%- end %> + </p> +<% end %> +<% if message.prominence == 'requester_only' %> + <p id="hidden_message"> + <%- if !message.prominence_reason.blank? %> + <%= _('This message is hidden, so that only you, the requester, can see it. {{reason}}', :reason => message.prominence_reason) %> + <%- else %> + <%= _('This message is hidden, so that only you, the requester, can see it. Please <a href="{{url}}">contact us</a> if you are not sure why.', :url => help_requesting_path.html_safe) %> + <%- end %> + </p> +<% end %> diff --git a/app/views/request/hidden_correspondence.html.erb b/app/views/request/hidden_correspondence.html.erb new file mode 100644 index 000000000..46bf3ee37 --- /dev/null +++ b/app/views/request/hidden_correspondence.html.erb @@ -0,0 +1,4 @@ +<% @title = _("Message has been removed") %> + +<h1><%=@title%></h1> +<%= render :partial => 'request/hidden_correspondence', :locals => { :message => @incoming_message } %> diff --git a/app/views/request/show.html.erb b/app/views/request/show.html.erb index 1d5b9977f..c520ce40c 100644 --- a/app/views/request/show.html.erb +++ b/app/views/request/show.html.erb @@ -25,8 +25,7 @@ <div id="left_column"> <h1><%=h(@info_request.title)%></h1> - - <% if !@info_request.is_external? && @info_request.user.profile_photo %> + <% if !@info_request.is_external? && @info_request.user.profile_photo && !@render_to_file %> <p class="user_photo_on_request"> <img src="<%= get_profile_photo_url(:url_name => @info_request.user.url_name) %>" alt=""> </p> @@ -49,7 +48,7 @@ <p id="request_status" class="request_icon_line icon_<%= @info_request.calculate_status %>"> <% if @info_request.awaiting_description %> - <% if @is_owning_user && !@info_request.is_external? %> + <% if @is_owning_user && !@info_request.is_external? && !@render_to_file %> <%= _('Please <strong>answer the question above</strong> so we know whether the ')%> <%= MySociety::Format.fancy_pluralize(@new_responses_count, 'recent response contains', 'recent responses contain') %> <%= _('useful information.') %> <% else %> @@ -147,4 +146,4 @@ <%= render :partial => 'after_actions' %> </div> -<%= render :partial => 'sidebar' %> +<%- if @sidebar %><%= render :partial => 'sidebar' %><% end %> diff --git a/app/views/request/show.text.erb b/app/views/request/show.text.erb new file mode 100644 index 000000000..29ac2987f --- /dev/null +++ b/app/views/request/show.text.erb @@ -0,0 +1,17 @@ +<%= _('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://#{AlaveteliConfiguration::domain}#{show_request_path(:url_title=>@info_request.url_title)}") %>. + +<% @info_request_events.each do |info_request_event| %> + <% if info_request_event.visible %> + <% case info_request_event.event_type %> + <% when 'response' %> + <%= render :partial => 'request/incoming_correspondence.text', :locals => { :incoming_message => info_request_event.incoming_message } %> + <% when 'sent', 'followup_sent' %> + <%= render :partial => 'request/outgoing_correspondence.text', :locals => { :outgoing_message => info_request_event.outgoing_message, :info_request_event => info_request_event }%> + <% when 'resent', 'followup_resent' %> + <%= render :partial => 'request/resent_outgoing_correspondence.text', :locals => { outgoing_message => info_request_event.outgoing_message, :info_request_event => info_request_event }%> + <% when 'comment' %> + <%= render :partial => 'comment/single_comment.text', :locals => { :comment => info_request_event.comment } %> + <% end %> +------------------------------- + <% end %> +<% end %> diff --git a/app/views/request/show_response.html.erb b/app/views/request/show_response.html.erb index a61359679..ace86cf4c 100644 --- a/app/views/request/show_response.html.erb +++ b/app/views/request/show_response.html.erb @@ -36,7 +36,7 @@ <dd> <%= _('To do that please send a private email to ') %><%=h(@postal_email_name)%> <<%=link_to h(@postal_email), "mailto:" + @postal_email%>> - <%= _('containing your postal address, and asking them to reply to this request. + <%= _('containing your postal address, and asking them to reply to this request. Or you could phone them.') %> <%= _('When you receive the paper response, please help @@ -63,16 +63,16 @@ <% end %> <% else %> <% if @incoming_message.recently_arrived %> - <h2><%= _('New response to {{law_used_short}} request',:law_used_short => h(@info_request.law_used_short))%> '<%= request_link @info_request %>'</h2> + <h2><%= _('New response to {{law_used_short}} request',:law_used_short => h(@info_request.law_used_short))%> '<%= request_link @info_request %>'</h2> <% else %> <h2>Response to <%=h(@info_request.law_used_short)%> request '<%= request_link @info_request %>'</h2> <% end %> <% end %> <% if @incoming_message.nil? %> - <%= render :partial => 'correspondence', :locals => { :info_request_event => @info_request.get_last_outgoing_event, :incoming_message => nil } %> + <%= render :partial => 'correspondence', :locals => { :info_request_event => @info_request.get_last_outgoing_event } %> <% else %> - <%= render :partial => 'correspondence', :locals => { :info_request_event => nil, :incoming_message => @incoming_message } %> + <%= render :partial => 'correspondence', :locals => { :info_request_event => @incoming_message.response_event } %> <% end %> <% end %> diff --git a/app/views/request/simple_correspondence.html.erb b/app/views/request/simple_correspondence.html.erb deleted file mode 100644 index 461fa3912..000000000 --- a/app/views/request/simple_correspondence.html.erb +++ /dev/null @@ -1,45 +0,0 @@ -<%= _('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://#{AlaveteliConfiguration::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:') %> <% if @info_request.user_name %><%= @info_request.user_name %><% else %><%= "[#{_('An anonymous user')}]"%><% end %> -<%= _('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:') %> <% if @info_request.user_name %><%= @info_request.user_name %><% else %><%= "[#{_('An anonymous user')}]"%><% end %> -<%= _('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 %> |