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.rhtml49
-rw-r--r--app/views/admin_request/_some_requests.rhtml61
-rw-r--r--app/views/admin_request/edit.rhtml12
-rw-r--r--app/views/admin_request/edit_comment.rhtml2
-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.rhtml3
-rw-r--r--app/views/admin_request/show.rhtml547
-rw-r--r--app/views/admin_request/show_raw_email.rhtml4
9 files changed, 434 insertions, 259 deletions
diff --git a/app/views/admin_request/_incoming_message_actions.rhtml b/app/views/admin_request/_incoming_message_actions.rhtml
index 569132861..9fedcb525 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):
+<formset class="form-horizontal">
+ <legend>Actions</legend>
+ <% form_tag '../redeliver_incoming', :class => "form form-inline" do %>
+ <div class="control-group">
+ <label class="control-label" for="url_title">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 } %>
<% else %>
<%= text_field_tag 'url_title', "", { :size => 20 } %>
<% end %>
<%= hidden_field_tag 'redeliver_incoming_message_id', incoming_message.id %>
- <%= submit_tag "Redeliver to another request" %>
+ <%= 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" for="generate_upload_url">Generate FOI officer upload URL</label>
+ <div class="controls">
+ <%= link_to 'Generate and take me there', "../generate_upload_url/#{incoming_message.info_request.id}?incoming_message_id=#{incoming_message.id}", :class => "btn", :id => "generate_upload_url" %>
+ </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 '../destroy_incoming', :class => "form form-inline" do %>
+ <div class="control-group">
+ <label class="control-label" for="generate_upload_url">Destroy message</label>
+ <div class="controls">
+ <%= hidden_field_tag 'incoming_message_id', incoming_message.id %>
+ <%= submit_tag "Destroy message", :class => "btn btn-danger", :confirm => "This is permanent! Are you sure?" %>
+ </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" for="show_rail_email">Inspect email</label>
+ <div class="controls">
+ <%= link_to "View raw email", "../show_raw_email/#{incoming_message.raw_email_id}", :class => "btn", :id => "show_raw_email" %>
+ </div>
+ </div>
+ <% end %>
+</formset>
diff --git a/app/views/admin_request/_some_requests.rhtml b/app/views/admin_request/_some_requests.rhtml
index dc11e0f55..50da67c86 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"><i class="icon-chevron-right"></i></a>
+ <%= link_to(info_request.title, admin_request_show_url(info_request), :title => "view full details") %>
+ </span>
+ <span class="item-metadata span6">
+ <%= user_admin_link_for_request(info_request) %> <i class="icon-arrow-right"></i> <%= 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..11c017aab 100644
--- a/app/views/admin_request/edit.rhtml
+++ b/app/views/admin_request/edit.rhtml
@@ -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>
diff --git a/app/views/admin_request/edit_comment.rhtml b/app/views/admin_request/edit_comment.rhtml
index ee43e849a..a79c096e3 100644
--- a/app/views/admin_request/edit_comment.rhtml
+++ b/app/views/admin_request/edit_comment.rhtml
@@ -8,7 +8,7 @@
<%= 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>
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..ff67dd843 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
index 2e75c2174..2bdfcf7f4 100644
--- a/app/views/admin_request/list_old_unclassified.rhtml
+++ b/app/views/admin_request/list_old_unclassified.rhtml
@@ -11,6 +11,5 @@
</li>
<% end %>
</ul>
-<%= will_paginate(@info_requests) %>
-
+<%= will_paginate(@info_requests, :class => "paginator") %>
diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml
index 56dcb9ee9..fac1e3e4c 100644
--- a/app/views/admin_request/show.rhtml
+++ b/app/views/admin_request/show.rhtml
@@ -1,230 +1,391 @@
-<% @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')") %>)
+<% form_tag '../move_request', { :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"><i class="icon-chevron-down"></i></a>Request metadata
</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>
+ </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', '../edit/' + @info_request.id.to_s, :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><strong>Initial request last sent at:</strong> <%=@info_request.date_initial_request_last_sent_at.to_date %>
+ <li><strong>Date response required by:</strong> <%= @info_request.date_response_required_by %>
+ <li><strong>Very overdue after:</strong> <%= @info_request.date_very_overdue_after %>
+ </ul>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ <tr>
+ <td>
+ <b>Created by</b>
+ </td>
+ <td>
+ <% if @info_request.is_external? %>
+ <%= link_to("<i class='icon-eye-open'></i>".html_safe, @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 %>
+ <%= link_to("<i class='icon-eye-open'></i>".html_safe, user_url(@info_request.user), :title => "view user's page on public website") %>
+ <%= user_admin_link_for_request(@info_request) %>
+ <%= 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>
+ <%= link_to("<i class='icon-eye-open'></i>".html_safe, public_body_path(@info_request.public_body), :title => "view authority on public website") %>
+ <%= link_to(@info_request.public_body.name, admin_body_show_path(@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', '../edit/' + @info_request.id.to_s, :class => "btn" %>
+ </td>
+ </tr>
+ </tfoot>
+ </table>
+ </div>
+ </div>
+</div>
<% end %>
+<formset 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', '../generate_upload_url/' + @info_request.id.to_s, :class => "btn" %>
+ <p class="help-block">(see also option to general URLs for individual incoming messages below)</p>
+ </div>
+ </div>
+ <% form_tag '../hide/' + @info_request.id.to_s, :class => "form form-inline", :info_request_id => @info_request.id.to_s, :id => "hide_request_form" do %>
+ <div class="control-group">
+ <% if @info_request.is_external? %>
+ <label class="control-label">Hide the request:</label>
+ <% else %>
+ <label class="control-label">Hide the request and notify the user:</label>
+ <% end %>
-<p>
- <%= link_to 'Public page', request_path(@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>
+ <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 %>
+ </div>
+ </div>
-<h2>Events</h2>
+ <% if !['hidden', 'requester_only'].include? @info_request.prominence %>
+ <% if ! @info_request.is_external? %>
-<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(/_/,' ') %>
- <% else %>
- <%=h info_request_event.send(column.name) %>
- <% 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 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>
- <% end %>
- <% end %>
- </td>
- </tr>
-<% end %>
-</table>
-<h2>Outgoing messages</h2>
+ <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>
-<table>
- <tr>
- <th>Id</th>
- <% for column in OutgoingMessage.content_columns %>
- <th><%= column.human_name %></th>
- <% end %>
- <th>Actions</th>
- </tr>
-
-<% 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 } %>
-
- <% 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 %>
+</formset>
+
+<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"><i class="icon-chevron-right"></i></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 '../mark_event_as_clarification', :class => "form form-inline admin-table-form admin-inline-form" do %>
+ <%= hidden_field_tag 'info_request_event_id', info_request_event.id %>
+ <%= 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"><i class="icon-chevron-right"></i></a>
+ <a href="../edit_outgoing/<%= outgoing_message.id %>">
+ #<%= outgoing_message.id %> -- <%= outgoing_message.status.humanize %> <%= outgoing_message.message_type.humanize %>
+ </a>
+ <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 '../resend', :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"><i class="icon-chevron-right"></i></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"><i class="icon-chevron-right"></i></a>
+ <a href="../edit_comment/<%= comment.id %>">
+ #<%=comment.id%>
+ --
+ <%=h(comment.user.name)%>
+ <%=admin_value(comment.created_at)%>
+ </a>
+ <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 <%= link_to("<i class='icon-eye-open'></i>".html_safe, user_url(comment.user), :title => "view user's page on public website") %>
+
+ <%= link_to(h(comment.user.name), admin_user_show_url(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..c770d432d 100644
--- a/app/views/admin_request/show_raw_email.rhtml
+++ b/app/views/admin_request/show_raw_email.rhtml
@@ -23,8 +23,6 @@
<% end %>
</p>
-<h2>Actions</h2>
-
<div>
<%= render :partial => 'incoming_message_actions', :locals => { :incoming_message => @raw_email.incoming_message } %>
</div>
@@ -33,5 +31,5 @@
<p><%= link_to "Download", "../download_raw_email/" + @raw_email.id.to_s %></p>
-<pre><%= h(@raw_email.data).gsub(/\n/, '<br>').html_safe %></pre>
+<pre><%=h(@raw_email.data).gsub(/\n/, '<br>').html_safe %></pre>