aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/admin_request
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/admin_request')
-rw-r--r--app/views/admin_request/_incoming_message_actions.rhtml55
-rw-r--r--app/views/admin_request/_some_requests.rhtml61
-rw-r--r--app/views/admin_request/edit.rhtml20
-rw-r--r--app/views/admin_request/edit_comment.rhtml8
-rw-r--r--app/views/admin_request/edit_outgoing.rhtml8
-rw-r--r--app/views/admin_request/hidden_user_explanation.rhtml3
-rw-r--r--app/views/admin_request/list.rhtml12
-rw-r--r--app/views/admin_request/list_old_unclassified.rhtml16
-rw-r--r--app/views/admin_request/show.rhtml542
-rw-r--r--app/views/admin_request/show_raw_email.rhtml58
10 files changed, 485 insertions, 298 deletions
diff --git a/app/views/admin_request/_incoming_message_actions.rhtml b/app/views/admin_request/_incoming_message_actions.rhtml
index 569132861..84c29dcc3 100644
--- a/app/views/admin_request/_incoming_message_actions.rhtml
+++ b/app/views/admin_request/_incoming_message_actions.rhtml
@@ -1,26 +1,45 @@
-<% form_tag '../redeliver_incoming' do %>
- <div>
- id or url_title of request (or a list of requests, comma-separated):
+<fieldset class="form-horizontal">
+ <legend>Actions</legend>
+ <% form_tag admin_request_redeliver_incoming_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">
<% if @info_requests && @info_requests.size == 1 %>
- <%= text_field_tag 'url_title', @info_requests[0].url_title, { :size => 20 } %>
+ <%= text_field_tag 'url_title', @info_requests[0].url_title, { :size => 20, :id => "url_title_#{incoming_message.id}" } %>
<% else %>
- <%= text_field_tag 'url_title', "", { :size => 20 } %>
+ <%= text_field_tag 'url_title', "", { :size => 20, :id => "url_title_#{incoming_message.id}" } %>
<% end %>
- <%= hidden_field_tag 'redeliver_incoming_message_id', incoming_message.id %>
- <%= submit_tag "Redeliver to another request" %>
+ <%= hidden_field_tag 'redeliver_incoming_message_id', incoming_message.id, :id => nil %>
+ <%= submit_tag "Redeliver to another request", :class => "btn" %>
+ <p class="help-block"><code>id</code> or <code>url_title</code>; you can supply more than one, separated by commas</p>
</div>
-<% end %>
-
-<p>
-<%= link_to 'FOI officer upload URL', '../generate_upload_url/' + incoming_message.info_request.id.to_s + "?incoming_message_id=" + incoming_message.id.to_s %>
-</p>
+ </div>
+ <% end %>
+ <div class="control-group">
+ <label class="control-label">Generate FOI officer upload URL</label>
+ <div class="controls">
+ <%= link_to 'Generate and take me there', admin_request_generate_upload_url_path(incoming_message.info_request, :incoming_message_id => incoming_message.id), :class => "btn" %>
+ </div>
+ </div>
-<% form_tag '../destroy_incoming' do %>
- <div>
- <%= hidden_field_tag 'incoming_message_id', incoming_message.id %>
- Warning, this is permanent! ---&gt;
- <%= submit_tag "Destroy message" %>
+ <% form_tag admin_request_destroy_incoming_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">
+ <%= hidden_field_tag 'incoming_message_id', incoming_message.id, :id => nil %>
+ <%= submit_tag "Destroy message", :class => "btn btn-danger", :confirm => "This is permanent! Are you sure?", :id => "destroy_message_#{incoming_message.id}" %>
+ </div>
</div>
-<% end %>
+ <% end %>
+ <% if @raw_email.nil? %>
+ <%# we're not on the raw_email page itself %>
+ <div class="control-group">
+ <label class="control-label">Inspect email</label>
+ <div class="controls">
+ <%= link_to "View raw email", admin_request_show_raw_email_path(incoming_message.raw_email_id), :class => "btn" %>
+ </div>
+ </div>
+ <% end %>
+</fieldset>
diff --git a/app/views/admin_request/_some_requests.rhtml b/app/views/admin_request/_some_requests.rhtml
index dc11e0f55..cff94956d 100644
--- a/app/views/admin_request/_some_requests.rhtml
+++ b/app/views/admin_request/_some_requests.rhtml
@@ -1,31 +1,32 @@
-<table>
- <tr>
- <th>Title</th>
- <th>Authority</th>
- <th>User</th>
- <% for column in InfoRequest.content_columns.map { |c| c.human_name } - [ "Url title", "Title" ] %>
- <th><%= column %></th>
+<div class="accordion" id="requests">
+ <% for info_request in info_requests %>
+ <div class="accordion-group">
+ <div class="accordion-heading accordion-toggle row">
+ <span class="item-title span6">
+ <a href="#request_<%=info_request.id%>" data-toggle="collapse" data-parent="requests"><%= chevron_right %></a>
+ <%= link_to(info_request.title, admin_request_show_path(info_request), :title => "view full details") %>
+ </span>
+ <span class="item-metadata span6">
+ <%= user_admin_link_for_request(info_request) %> <%= arrow_right %> <%= link_to("#{info_request.public_body.name}", admin_body_show_path(info_request.public_body)) %>, <%= time_ago_in_words(info_request.updated_at) %> ago
+ </span>
+ </div>
+ <div id="request_<%=info_request.id%>" class="item-detail accordion-body collapse row">
+ <% info_request.for_admin_column do | name, value, type | %>
+ <div>
+ <span class="span6">
+ <%= h name %>
+ </span>
+ <span class="span6">
+ <% if type == 'datetime' %>
+ <%= I18n.l(value, :format => "%e %B %Y %H:%M:%S") %>
+ (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(value)) %>)
+ <% else %>
+ <%=h value %>
+ <% end %>
+ </span>
+ </div>
+ <% end %>
+ </div>
+ </div>
<% end %>
- </tr>
-
-<% for info_request in info_requests %>
- <tr class="<%= cycle('odd', 'even') %>">
- <td><%= request_both_links(info_request) %></td>
- <td><%= public_body_both_links(info_request.public_body) %></td>
- <% if info_request.is_external? %>
- <% if info_request.external_user_name.nil? %>
- <td><i><%= _("Anonymous user") %></i></td>
- <% else %>
- <td><%= h(info_request.external_user_name) %></td>
- <% end %>
- <% else %>
- <td><%= user_both_links(info_request.user) %></td>
- <% end %>
- <% for column in InfoRequest.content_columns.map { |c| c.name } - [ "title", "url_title" ] %>
- <td><%=h info_request.send(column) %></td>
- <% end %>
- </tr>
-<% end %>
-</table>
-
-
+</div>
diff --git a/app/views/admin_request/edit.rhtml b/app/views/admin_request/edit.rhtml
index 8fa2a1fe2..1cf5d4f12 100644
--- a/app/views/admin_request/edit.rhtml
+++ b/app/views/admin_request/edit.rhtml
@@ -2,7 +2,7 @@
<%= error_messages_for 'info_request' %>
-<% form_tag '../update/' + @info_request.id.to_s do %>
+<% form_tag admin_request_update_path(@info_request) do %>
<p><label for="info_request_title"><strong>Title</strong></label> (warning: editing this will break URLs right now)<br/>
<%= text_field 'info_request', 'title', :size => 50 %></p>
@@ -22,16 +22,14 @@
</p>
<p><label for="info_request_described_state"><strong>Described state</strong></label>
- <%= select( 'info_request', "described_state", InfoRequest.enumerate_states ) %>;
+ <%= select( 'info_request', "described_state", InfoRequest.enumerate_states) %>
<label for="info_request_awaiting_description"><strong>Awaiting description</strong></label>
- <%= select('info_request', "awaiting_description", [["Yes - needs state updating",true],["No - state is up to date",false]]) %>
+ <%= select('info_request', "awaiting_description", [["Yes – needs state updating",true],["No – state is up to date",false]]) %>
<br/>(don't forget to change 'awaiting description' when you set described state)<br/>
</p>
-
- <p><label for="info_request_comments_allowed"><strong>Are comments allowed?</strong></label>
- <%= select('info_request', "comments_allowed", [["Yes – comments allowed", true], ["No – comments disabled", false]]) %>
- </p>
-
+ <p><label for="info_request_comments_allowed"><strong>Are comments allowed?</strong></label>
+ <%= select('info_request', "comments_allowed", [["Yes – comments allowed", true], ["No – comments disabled", false]]) %>
+ </p>
<p><label for="info_request_tag_string"><strong>Tags</strong> <small>(space separated, can use key:value)</small></label><br/>
<%= text_field 'info_request', 'tag_string', :size => 60 %></p>
@@ -45,13 +43,13 @@
<% end %>
<p>
-<%= link_to 'Show', '../show/' + @info_request.id.to_s %> |
-<%= link_to 'List all', '../list' %>
+<%= link_to 'Show', admin_request_show_path(@info_request) %> |
+<%= link_to 'List all', admin_request_list_path %>
</p>
<hr>
-<% form_tag '../destroy/' + @info_request.id.to_s do %>
+<% form_tag admin_request_destroy_path(@info_request) do %>
<p>
<strong>This is permanent and irreversible!</strong> <%= submit_tag 'Destroy request entirely' %>
<br>Use it mainly if someone posts private information, e.g. made a Data Protection request. It
diff --git a/app/views/admin_request/edit_comment.rhtml b/app/views/admin_request/edit_comment.rhtml
index ee43e849a..07031f5f2 100644
--- a/app/views/admin_request/edit_comment.rhtml
+++ b/app/views/admin_request/edit_comment.rhtml
@@ -2,13 +2,13 @@
<%= error_messages_for 'comment' %>
-<% form_tag '../update_comment/' + @comment.id.to_s do %>
+<% form_tag admin_request_update_comment_path(@comment) do %>
<p><label for="comment_body">Body of annotation</label><br/>
<%= text_area 'comment', 'body', :rows => 10, :cols => 60 %></p>
<p><label for="comment_visible">Visible</label>
- <%= select('comment', "visible", [["Yes - show comment",true],["No - hide comment",false]]) %>
+ <%= select('comment', "visible", [["Yes – show comment",true],["No – hide comment",false]]) %>
</p>
@@ -16,7 +16,7 @@
<% end %>
<p>
-<%= link_to 'Show', '../show/' + @comment.info_request.id.to_s %> |
-<%= link_to 'List all', '../list' %>
+<%= link_to 'Show', admin_request_show_path(@comment.info_request) %> |
+<%= link_to 'List all', admin_request_list_path %>
</p>
diff --git a/app/views/admin_request/edit_outgoing.rhtml b/app/views/admin_request/edit_outgoing.rhtml
index 4932cb52f..ab209be0d 100644
--- a/app/views/admin_request/edit_outgoing.rhtml
+++ b/app/views/admin_request/edit_outgoing.rhtml
@@ -2,7 +2,7 @@
<%= error_messages_for 'outgoing_message' %>
-<% form_tag '../update_outgoing/' + @outgoing_message.id.to_s do %>
+<% 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>
@@ -18,11 +18,11 @@
<% end %>
<p>
-<%= link_to 'Show', '../show/' + @outgoing_message.info_request.id.to_s %> |
-<%= link_to 'List all', '../list' %>
+<%= link_to 'Show', admin_request_show_path(@outgoing_message.info_request) %> |
+<%= link_to 'List all', admin_request_list_path %>
</p>
-<% form_tag '../destroy_outgoing' do %>
+<% form_tag admin_request_destroy_outgoing_path do %>
<div>
<%= hidden_field_tag 'outgoing_message_id', @outgoing_message.id %>
Warning, this is permanent! ---&gt;
diff --git a/app/views/admin_request/hidden_user_explanation.rhtml b/app/views/admin_request/hidden_user_explanation.rhtml
index 64387ffee..7084e986f 100644
--- a/app/views/admin_request/hidden_user_explanation.rhtml
+++ b/app/views/admin_request/hidden_user_explanation.rhtml
@@ -1,9 +1,10 @@
Dear <%= name_to %>,
-Your request '<%= info_request.title %>' at <%= info_request_url %> has been reviewed by moderators.
+Your request '<%= info_request.title.html_safe %>' at <%= info_request_url %> has been reviewed by moderators.
We consider it <% if reason == 'not_foi' %>is not a valid FOI request<% else %>to be vexatious<% end%>, and have therefore hidden it from other users. You will still be able to view it while logged in to the site. Please reply to this email if you would like to discuss this decision further.
Yours,
The <%= site_name %> team.
+
diff --git a/app/views/admin_request/list.rhtml b/app/views/admin_request/list.rhtml
index cb328543e..10b39d3a2 100644
--- a/app/views/admin_request/list.rhtml
+++ b/app/views/admin_request/list.rhtml
@@ -1,15 +1,13 @@
-<% @title = 'Listing FOI/EIR requests' %>
+<% @title = _("Listing FOI requests") %>
<h1><%=@title%></h1>
-<% form_tag("", :method => "get") do %>
- <p>
- <%= text_field_tag 'query', params[:query], { :size => 30 } %>
- <%= submit_tag "Search" %> (substring search, titles only)
- </p>
+<% form_tag({}, :method => "get", :class => "form form-search") do %>
+ <%= text_field_tag 'query', params[:query], { :size => 30, :class => "input-large search-query" } %>
+ <%= submit_tag "Search", :class => "btn" %> (substring search, titles only)
<% end %>
<%= render :partial => 'some_requests', :locals => { :info_requests => @info_requests } %>
-<%= will_paginate(@info_requests) %>
+<%= will_paginate(@info_requests, :class => "paginator") %>
diff --git a/app/views/admin_request/list_old_unclassified.rhtml b/app/views/admin_request/list_old_unclassified.rhtml
deleted file mode 100644
index 2e75c2174..000000000
--- a/app/views/admin_request/list_old_unclassified.rhtml
+++ /dev/null
@@ -1,16 +0,0 @@
-<% @title = "Unclassified responses" %>
-
-<h1><%=@title%></h1>
-
-<p>Classify responses that are still unclassified <%=InfoRequest::OLD_AGE_IN_DAYS.inspect %> after response:</p>
-<ul>
-<% for @request in @info_requests %>
- <li>
- <%= request_both_links(@request) %>
- &ndash; <%=simple_date(@request.get_last_response_event.created_at)%>
- </li>
-<% end %>
-</ul>
-<%= will_paginate(@info_requests) %>
-
-
diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml
index 2541fd323..1401a7b94 100644
--- a/app/views/admin_request/show.rhtml
+++ b/app/views/admin_request/show.rhtml
@@ -1,230 +1,386 @@
-<% @title = "FOI request - " + h(@info_request.title) %>
-<%= javascript_include_tag :defaults %>
+<% @title = _("FOI request – {{title}}", :title => h(@info_request.title)) %>
<h1><%=@title%></h1>
-<% form_tag '../move_request', { :class => "inline" } do %>
-<p>
-<%= hidden_field_tag 'info_request_id', @info_request.id %>
-<% for column in InfoRequest.content_columns %>
- <strong><%= column.human_name %>:</strong> <%=h @info_request.send(column.name) %>
- <% if column.name == 'described_state' %>
- <strong>Calculated status:</strong> <%= @info_request.calculate_status %>
- <br/><strong>Initial request last sent at:</strong> <%=@info_request.date_initial_request_last_sent_at.to_date %>
- <strong>Date response required by:</strong> <%= @info_request.date_response_required_by %>
- <strong>Very overdue after:</strong> <%= @info_request.date_very_overdue_after %>
- <% end %>
- <% if ![ 'allow_new_responses_from' ].include?(column.name) %>
- <br/>
- <% end %>
-<% end %>
- <strong>Created by:</strong>
- <% if @info_request.is_external? %>
- <%= @info_request.public_body.name %> on behalf of <%= (@info_request.user_name || _('an anonymous user'))%> (using API)
- <% else %>
- <%= user_both_links(@info_request.user) %>
- <% end %>
-
- <span>
- <span>
- (<%= link_to_function("move...", "$(this).up(1).childElements().invoke('toggle')") %>)
- </span>
- <span style="display:none;">
- <strong>url_name of new user:</strong>
- <%= text_field_tag 'user_url_name', "", { :size => 20 } %>
- <%= submit_tag "Move request to user" %>
- </span>
- </span>
- <br>
-<strong>Public authority:</strong> <%= public_body_both_links(@info_request.public_body) %>
- <span>
- <span>
- (<%= link_to_function("move...", "$(this).up(1).childElements().invoke('toggle')") %>)
- </span>
- <span style="display:none;">
- <strong>url_name of new authority:</strong>
- <%= text_field_tag 'public_body_url_name', "", { :size => 20 } %>
- <%= submit_tag "Move request to authority" %>
- </span>
- </span>
- <br>
-<strong>Incoming email address:</strong> <%= link_to h(@info_request.incoming_email), "mailto:" + @info_request.incoming_email %> <br>
-<b>Tags:</b> <%= render :partial => 'tags', :locals => { :info_request => @info_request} %> <br>
-</p>
+<% form_tag admin_request_move_request_path, { :class => "form form-horizontal" } do %>
+ <%= hidden_field_tag 'info_request_id', @info_request.id %>
+ <div class="accordion" id="info_request">
+ <div class="accordion-group">
+ <div class="accordion-heading">
+ <span class="item-title">
+ <a href="#metadata_<%=@info_request.id%>" data-toggle="collapse" data-parent="#info_request"><%= chevron_down %></a>Request metadata
+ </span>
+ </div>
+ <div id="metadata_<%=@info_request.id%>" class="accordion-body collapse in">
+ <table class="table table-striped table-condensed">
+ <thead>
+ <tr>
+ <td colspan="2">
+ <%= link_to 'Edit metadata', admin_request_edit_path(@info_request), :class => "btn" %>
+ </td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <th>Public page:</th>
+ <td><%= link_to request_url(@info_request), request_path(@info_request) %></td>
+ </tr>
+ <% @info_request.for_admin_column do |name, value, type, column_name|%>
+ <tr>
+ <td>
+ <b><%= name %>:</b>
+ </td>
+ <td>
+ <% if type == 'datetime' %>
+ <%= I18n.l(value, :format => "%e %B %Y %H:%M:%S") %>
+ (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(value)) %>)
+ <% else %>
+ <%= h value %>
+ <% end %>
+ <% if column_name == 'described_state' %>
+ <ul>
+ <li><strong>Initial request last sent at:</strong> <%= @info_request.calculate_status %></li>
+ <li><strong>Initial request last sent at:</strong> <%=@info_request.date_initial_request_last_sent_at.to_date %></li>
+ <li><strong>Date response required by:</strong> <%= @info_request.date_response_required_by %></li>
+ <li><strong>Very overdue after:</strong> <%= @info_request.date_very_overdue_after %></li>
+ </ul>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ <tr>
+ <td>
+ <b>Created by</b>
+ </td>
+ <td>
+ <% if @info_request.is_external? %>
+ <%= link_to(eye, @info_request.external_url, :title => "view URL of original request on external website") %>
+ <%= @info_request.public_body.name %> on behalf of <%= (@info_request.user_name || _('an anonymous user'))%> (using API)
+ <% else %>
+ <%= user_both_links(@info_request.user) %>
+ <%= link_to _("move..."), "#", :class => "btn btn-mini btn-warning toggle-hidden" %>
+ <div style="display:none;">
+ <strong>url_name of new user:</strong>
+ <%= text_field_tag 'user_url_name', "", { :size => 20 } %>
+ <%= submit_tag "Move request to user", :class => "btn btn-info" %>
+ </div>
+ <% end %>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>Public authority:</b>
+ </td>
+ <td>
+ <%= public_body_both_links(@info_request.public_body) %>
+ <%= link_to "move...", "#", :class => "btn btn-mini btn-warning toggle-hidden" %>
+ <div style="display:none;">
+ <strong>url_name of new authority:</strong>
+ <%= text_field_tag 'public_body_url_name', "", { :size => 20 } %>
+ <%= submit_tag "Move request to authority", :class => "btn btn-info" %>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><%=_("Incoming email address")%></b>
+ </td>
+ <td>
+ <%= link_to h(@info_request.incoming_email), "mailto:#{@info_request.incoming_email}" %>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><%=_("Tags")%></b>
+ </td>
+ <td>
+ <%= render :partial => 'tags', :locals => { :info_request => @info_request} %>
+ </td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td colspan="2">
+ <%= link_to 'Edit metadata', admin_request_edit_path(@info_request), :class => "btn" %>
+ </td>
+ </tr>
+ </tfoot>
+ </table>
+ </div>
+ </div>
+ </div>
<% end %>
-
-<p>
- <%= link_to 'Public page', main_url(request_url(@info_request)) %>
- | <%= link_to 'Edit', '../edit/' + @info_request.id.to_s %>
- | <%= link_to 'FOI officer upload URL', '../generate_upload_url/' + @info_request.id.to_s %> (see also links on incoming messages below)
-</p>
-
-<h2>Events</h2>
-
-<table>
- <tr>
- <th>Id</th>
- <% for column in InfoRequestEvent.content_columns %>
- <th><%= column.human_name %></th>
- <% end %>
- <th>Actions</th>
- </tr>
-
-<% for info_request_event in @info_request.info_request_events.find(:all, :order => "created_at, id") %>
- <tr class="<%= cycle('odd', 'even') %>">
- <td><%=h info_request_event.id %></td>
- <% for column in InfoRequestEvent.content_columns %>
- <td>
- <% if column.name == 'params_yaml' %>
- <%= info_request_event.params_yaml_as_html %>
- <% elsif column.text? %>
- <%=h (info_request_event.send(column.name) || '').gsub(/_/,' ') %>
+<fieldset class="form-horizontal">
+ <legend>Actions</legend>
+ <div class="control-group">
+ <label class="control-label">
+ FOI officer upload URL
+ </label>
+ <div class="controls">
+ <%= link_to 'Generate URL', admin_request_generate_upload_url_path(@info_request), :class => "btn" %>
+ <p class="help-block">(see also option to general URLs for individual incoming messages below)</p>
+ </div>
+ </div>
+ <% form_tag admin_request_hide_path(@info_request), :class => "form form-inline", :id => "hide_request_form" do %>
+ <div class="control-group">
+ <% if @info_request.is_external? %>
+ <label class="control-label">Hide the request:</label>
<% else %>
- <%=h info_request_event.send(column.name) %>
+ <label class="control-label">Hide the request and notify the user:</label>
<% end %>
- </td>
- <% end %>
- <td>
- <% if info_request_event.described_state != 'waiting_clarification' and info_request_event.event_type == 'response' %>
- <% form_tag '../mark_event_as_clarification' do %>
- <div>
- <%= hidden_field_tag 'info_request_event_id', info_request_event.id %>
- <%= submit_tag "Was clarification request" %>
- </div>
+
+ <div class="controls" id="request_hidden_user_explanation_reasons">
+ <% if ['hidden', 'requester_only'].include? @info_request.prominence %>
+ <p class="help-block">This request has already been hidden</p>
+ <% else %>
+ <label class="radio inline">
+ <%= radio_button_tag "reason", "not_foi" %> <%= _("Not a valid FOI request") %>
+ </label>
+ <label class="radio inline">
+ <%= radio_button_tag "reason", "vexatious" %> <%= _("A vexatious request") %>
+ </label>
<% end %>
- <% end %>
- </td>
- </tr>
-<% end %>
-</table>
+ </div>
+ </div>
-<h2>Outgoing messages</h2>
+ <% if !['hidden', 'requester_only'].include? @info_request.prominence %>
+ <% if ! @info_request.is_external? %>
-<table>
- <tr>
- <th>Id</th>
- <% for column in OutgoingMessage.content_columns %>
- <th><%= column.human_name %></th>
- <% end %>
- <th>Actions</th>
- </tr>
+ <div class="control-group" id="request_hidden_user_subject">
+ <label for="request_hidden_user_subject_field" class="control-label">Subject of email:</label>
+ <div class="controls">
+ <%= text_field_tag "subject", "Your request on WhatDoTheyKnow.com hidden", {:id => "request_hidden_user_subject_field", :cols => 100} %>
+ </div>
+ </div>
-<% for outgoing_message in @info_request.outgoing_messages.find(:all, :order => 'created_at') %>
- <tr class="<%= cycle('odd', 'even') %>">
- <td><%=h outgoing_message.id %></td>
- <% for column in OutgoingMessage.content_columns.map { |c| c.name } %>
+ <div class="control-group" id="request_hidden_user_explanation">
+ <label for="request_hidden_user_explanation_field" class="control-label">Reason for hiding the request (will be emailed to user):</label>
+ <div class="controls">
+ <%= text_area_tag "explanation", h(@request_hidden_user_explanation), {:id => "request_hidden_user_explanation_field"} %>
+ </div>
+ </div>
- <% if column == 'body' %>
- <td>
- <div><%= simple_format( truncate(outgoing_message.body, :length => 400,
- :omission => link_to_function("...", "$(this).up('td').childElements().invoke('toggle')")
- )) %></div>
- <div style="display:none;"><%= simple_format( outgoing_message.body ) %></div>
- </td>
- <% else %>
- <td><%= simple_format( outgoing_message.send(column) ) %></td>
+ <% end %>
+ <div class="form-actions" id="request_hide_button">
+ <%= submit_tag _("Hide request"), :class => "btn" %>
+ </div>
<% end %>
+ <% end %>
+</fieldset>
+<hr>
+<h2>Events</h2>
+<div class="accordion" id="events">
+ <% for info_request_event in @info_request.info_request_events.find(:all, :order => "created_at, id") %>
+ <div class="accordion-group">
+ <div class="accordion-heading">
+ <span class="item-title">
+ <a href="#event_<%=info_request_event.id%>" data-toggle="collapse" data-parent="#events"><%= chevron_right %></a>
+ <%= _("Event {{id}}", :id => info_request_event.id) %>:
+ <strong>
+ <%=h info_request_event.event_type.humanize %><% if !info_request_event.calculated_state.nil? %>; state: <%= info_request_event.calculated_state %><% end %>
+ </strong>
+ <em>
+ <%= info_request_event.created_at%>
+ </em>
+ </span>
+ </div>
+ <div id="event_<%=info_request_event.id%>" class="accordion-body collapse">
+ <table class="table table-striped table-condensed">
+ <tbody>
+ <tr>
+ <td>
+ <% if info_request_event.described_state != 'waiting_clarification' and info_request_event.event_type == 'response' %>
+ <% form_tag admin_request_clarification_path, :class => "form form-inline admin-table-form admin-inline-form" do %>
+ <%= hidden_field_tag 'info_request_event_id', info_request_event.id, :id => nil %>
+ <%= submit_tag "Was clarification request", :class => "btn btn-mini btn-primary" %>
+ <% end %>
+ <% end %>
+ </td>
+ <td></td>
+ </tr>
+
+ <% info_request_event.for_admin_column do |name, value, type, column_name| %>
+ <tr>
+ <td>
+ <b><%=h name%></b>
+ </td>
+ <td>
+ <% if column_name == 'params_yaml' %>
+ <%= info_request_event.params_yaml_as_html %>
+ <% elsif value.nil? %>
+ nil
+ <% elsif %w(text string).include?(type) %>
+ <%=h value.humanize %>
+ <% elsif type == 'datetime' %>
+ <%= admin_date value %>
+ <% else %>
+ <%=h value %>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </div>
+ </div>
<% end %>
- <td>
- <% form_tag '../resend' do %>
- <div>
- <%= hidden_field_tag 'outgoing_message_id', outgoing_message.id %>
- <%= submit_tag "Resend" %>
+</div>
+<hr>
+<h2>Outgoing messages</h2>
+<div class="accordion" id="outgoing_messages">
+ <% for outgoing_message in @info_request.outgoing_messages.find(:all, :order => 'created_at') %>
+ <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 %>
+ #<%= outgoing_message.id %> -- <%= outgoing_message.status.humanize %> <%= outgoing_message.message_type.humanize %>
+ <% end %>
+ <blockquote>
+ <%= truncate(outgoing_message.body, :length => 400) %>
+ </blockquote>
+ </div>
+ <div id="outgoing_<%=outgoing_message.id%>" class="accordion-body collapse">
+ <table class="table table-striped table-condensed">
+ <tbody>
+ <tr>
+ <td colspan="2">
+ <% form_tag admin_request_resend_path, :class => "admin-table-form" do %>
+ <%= hidden_field_tag 'outgoing_message_id', outgoing_message.id %>
+ <%= submit_tag "Resend", :class => "btn" %>
+ <% end %>
+ </td>
+ </tr>
+ <% outgoing_message.for_admin_column do |name, value, type, column_name| %>
+ <tr>
+ <td class="span3">
+ <b><%=name%></b>
+ </td>
+ <td>
+ <% if column_name == 'body' %>
+ <%= simple_format(truncate(outgoing_message.body, :length => 400, :omission => link_to("...", "#", :class => "toggle-hidden" ))) %>
+ <div style="display:none;"><%= simple_format( outgoing_message.body ) %></div>
+ <% else %>
+ <%= admin_value(value) %>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
</div>
+ </div>
<% end %>
- <%= link_to "Edit", '../edit_outgoing/' + outgoing_message.id.to_s %>
- </td>
- </tr>
-<% end %>
-</table>
-
+</div>
+<hr>
<h2>Incoming messages</h2>
-
-<table>
- <tr>
- <th>Id</th>
- <% for column in IncomingMessage.content_columns %>
- <th><%= column.human_name %></th>
- <% end %>
- <th>Actions</th>
- </tr>
-
-<% for incoming_message in @info_request.incoming_messages.find(:all, :order => 'created_at') %>
- <tr class="<%= cycle('odd', 'even') %>" id="incoming-<%=incoming_message.id.to_s%>">
- <td><%=h incoming_message.id %></td>
- <% for column in IncomingMessage.content_columns.map { |c| c.name } %>
- <% if column =~ /^cached_.*?$/ %>
- <td>
- <div><%= simple_format( truncate(incoming_message.send(column), :length => 400,
- :omission => link_to_function("...", "$(this).up('td').childElements().invoke('toggle')")
- )) %></div>
- <div style="display:none;"><%= simple_format( incoming_message.send(column) ) %></div>
- </td>
- <% else %>
- <td><%= simple_format( incoming_message.send(column) ) %></td>
- <% end %>
+<div class="accordion" id="incoming_messages">
+ <% for incoming_message in @info_request.incoming_messages.find(:all, :order => 'created_at') %>
+ <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)%>
+ <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) %>
+ <% end %>
+ </blockquote>
+ </div>
+ <div id="incoming_<%=incoming_message.id%>" class="accordion-body collapse">
+ <table class="table table-striped table-condensed">
+ <thead>
+ <tr>
+ <td colspan="2" class="well">
+ <%= render :partial => 'incoming_message_actions', :locals => { :incoming_message => incoming_message } %>
+ </td>
+ </tr>
+ </thead>
+ <tbody>
+ <% incoming_message.for_admin_column do |name, value, type, column_name| %>
+ <tr>
+ <td>
+ <b><%=name%></b>
+ </td>
+ <td>
+ <% if column_name =~ /^cached_.*?$/ %>
+ <%= simple_format( truncate(value, :length => 400, :omission => link_to("...", "#", :class => "toggle-hidden"))) %>
+ <div style="display:none;"><%= simple_format(value) %></div>
+ <% else %>
+ <%= simple_format(value) %>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </div>
+ </div>
<% end %>
- <td>
- <% if !incoming_message.raw_email_id.nil? %>
- <p>
- <%= link_to "View raw email", "../show_raw_email/" + incoming_message.raw_email_id.to_s %>
- </p>
- <% end %>
- <%= render :partial => 'incoming_message_actions', :locals => { :incoming_message => incoming_message } %>
- </td>
- </tr>
-<% end %>
-</table>
-
+</div>
+<hr>
<h2>Annotations</h2>
<% if @info_request.comments.size > 0 %>
- <table>
- <tr>
- <th>Id</th>
- <th>Posted by</th>
- <% for column in Comment.content_columns %>
- <th><%= column.human_name %></th>
- <% end %>
- <th>Actions</th>
- </tr>
-
- <% for comment in @info_request.comments %>
- <tr class="<%= cycle('odd', 'even') %>">
- <td><%=h comment.id %></td>
- <td><%= user_both_links(comment.user) %></td>
- <% for column in Comment.content_columns.map { |c| c.name } %>
- <% if column == 'body' && !comment.visible %>
- <td><s><%=h comment.send(column) %></s></td>
- <% else %>
- <td><%=h comment.send(column) %></td>
- <% end %>
+ <div class="accordion" id="comments">
+ <% for comment in @info_request.comments %>
+ <div class="accordion-group">
+ <div class="accordion-heading">
+ <a href="#comment_<%=comment.id%>" data-toggle="collapse" data-parent="#comments"><%= chevron_right %></a>
+ <% link_to admin_request_edit_comment_path(comment) do %>
+ #<%=comment.id%>
+ --
+ <%=h(comment.user.name)%>
+ <%=admin_value(comment.created_at)%>
+ <% end %>
+ <blockquote class="incoming-message">
+ <%= truncate(comment.body, :length => 400) %>
+ </blockquote>
+ </div>
+ <div id="comment_<%=comment.id%>" class="accordion-body collapse">
+ <table class="table table-striped table-condensed">
+ <tbody>
+ <tr>
+ <td colspan="2">
+ By <%= user_both_links(comment.user) %>
+ </td>
+ </tr>
+ <% comment.for_admin_column do |name, value, type, column_name |%>
+ <tr>
+ <td>
+ <b><%=name%></b>
+ </td>
+ <td>
+ <% if column_name == 'body' && !comment.visible %>
+ <s><%=h comment.send(column_name) %></s>
+ <% else %>
+ <%=h comment.send(column_name) %>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </div>
+ </div>
<% end %>
- <td>
- <%= link_to "Edit", '../edit_comment/' + comment.id.to_s %>
- </td>
- </tr>
- <% end %>
- </table>
+ </div>
<% else %>
<p>None yet.</p>
<% end %>
-
-
-
+<hr>
<h2>Mail server delivery logs</h2>
<p><i>(Lines containing the request incoming email address, updated hourly.)</i></p>
<% for mail_server_log_done_id, mail_server_logs in @info_request.mail_server_logs.group_by(&:mail_server_log_done_id) %>
- <!-- <h3><%=h mail_server_logs[0].mail_server_log_done.filename %></h3> -->
- <pre><% for mail_server_log in mail_server_logs %><%=h mail_server_log.line%><% end %></pre>
+ <!-- <h3><%=h mail_server_logs[0].mail_server_log_done.filename %></h3> -->
+ <pre><% for mail_server_log in mail_server_logs %><%=h mail_server_log.line%><% end %></pre>
<% end %>
<% if @info_request.mail_server_logs.size == 0 %>
- <p>None (perhaps this is an old or a very new request)</p>
+ <p>None (perhaps this is an old or a very new request)</p>
<% end %>
+<hr>
<h2>Censor rules</h2>
<%= render :partial => 'admin_censor_rule/show', :locals => { :censor_rules => @info_request.censor_rules, :info_request => @info_request } %>
diff --git a/app/views/admin_request/show_raw_email.rhtml b/app/views/admin_request/show_raw_email.rhtml
index ea0d6017e..72c782ad6 100644
--- a/app/views/admin_request/show_raw_email.rhtml
+++ b/app/views/admin_request/show_raw_email.rhtml
@@ -1,37 +1,67 @@
-<% @title = 'Incoming message ' + @raw_email.incoming_message.id.to_s + ' of FOI request \'' + h(@raw_email.incoming_message.info_request.title) + "'" %>
+<% @title = "Incoming message #{@raw_email.incoming_message.id} of FOI request '#{@raw_email.incoming_message.info_request.title}'" %>
-<h1>Incoming message <%=@raw_email.incoming_message.id.to_s %></h1>
+<h1>Incoming message <%=@raw_email.incoming_message.id %></h1>
<p>
FOI request: <%= request_both_links(@raw_email.incoming_message.info_request) %>
- <% if @holding_pen %>
+ <% if @holding_pen %>
<br>This is in the holding pen because: <strong><%= @rejected_reason %></strong>
<% if @public_bodies.size > 0 %>
<br>Guessed authority:
- <% for public_body in @public_bodies %>
- <%=public_body_both_links(public_body)%>
+ <% @public_bodies.each do |public_body| %>
+ <%=public_body_both_links(public_body)%>
<% end %>
(based on From: email domain)
<% end %>
<% if @info_requests.size > 0 %>
- <br>Guessed request:
- <% for info_request in @info_requests %>
- <%=request_both_links(info_request)%>
- <% end %>
- (based on id, not hash, in To/Cc email)
+ <div class="accordion" id="guessed-requests">
+ Guessed request:
+ <% @info_requests.each do |info_request| %>
+ <div class="accordion-group">
+ <div class="accordion-heading">
+ <a href="#info_request_<%= info_request.id %>" data-toggle="collapse"><i class="icon-chevron-right"></i></a>
+ <%=request_both_links(info_request)%>
+ </div>
+ <div class="accordion-body collapse" id="info_request_<%= info_request.id %>">
+ <table class="table table-striped table-condensed">
+ <tr>
+ <td><strong>Last outgoing message:</strong></td>
+ <td><%= info_request.outgoing_messages.last.body %></td>
+ </tr>
+ <tr>
+ <td><strong>Created by:</strong></td>
+ <td><%= user_admin_link_for_request(info_request) %></td>
+ </tr>
+ <tr>
+ <td><strong>Authority:</strong></td>
+ <td>
+ <%= link_to(info_request.public_body.name, admin_body_show_path(info_request.public_body)) %>
+ </td>
+ </tr>
+ <tr>
+ <td><strong>url_title:</strong></td>
+ <td><%= info_request.url_title %></td>
+ </tr>
+ </table>
+ <p>
+ This request was guessed because it has an incoming email address of <strong><%= info_request.incoming_email %></strong> and this incoming message was sent to <strong><%= @raw_email.incoming_message.mail.to %></strong>.
+ </p>
+ </div>
+ </div>
+ <% end %>
+ (based on id, not hash, in To/Cc email)
+ </div>
<% end %>
<% end %>
</p>
-<h2>Actions</h2>
-
<div>
<%= render :partial => 'incoming_message_actions', :locals => { :incoming_message => @raw_email.incoming_message } %>
</div>
<h2>Raw email</h2>
-<p><%= link_to "Download", "../download_raw_email/" + @raw_email.id.to_s %></p>
+<p><%= link_to "Download", admin_request_download_raw_email_path(@raw_email) %></p>
-<pre><%= h(@raw_email.data).gsub(/\n/, '<br>').html_safe %></pre>
+<pre><%=h(@raw_email.data).gsub(/\n/, '<br>').html_safe %></pre>