aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/admin_request/show.rhtml
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/admin_request/show.rhtml')
-rw-r--r--app/views/admin_request/show.rhtml426
1 files changed, 242 insertions, 184 deletions
diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml
index aac68ad2e..a93ef5db1 100644
--- a/app/views/admin_request/show.rhtml
+++ b/app/views/admin_request/show.rhtml
@@ -1,212 +1,270 @@
-<% @title = "FOI request - " + h(@info_request.title) %>
+<% @title = _("FOI request - {{title}}", :title => h(@info_request.title)) %>
<%= javascript_include_tag :defaults %>
<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> <%= user_both_links(@info_request.user) %>
- <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 '../move_request', { :class => "form form-horizontal" } do %>
+ <%= hidden_field_tag 'info_request_id', @info_request.id %>
+ <table class="table table-striped">
+ <tbody>
+ <% @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>
+ <%= user_link(@info_request.user, "btn btn-mini") %>
+ <%= link_to _("admin"), user_admin_url(@info_request.user), :class => "btn btn-mini btn-warning" %>
+ <%= 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>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>Public authority:</b>
+ </td>
+ <td>
+ <%= public_body_link(@info_request.public_body, "btn btn-mini") %>
+ <%= link_to _("admin"), public_body_admin_url(@info_request.public_body), :class => "btn btn-mini btn-warning" %>
+ <%= 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>
+ </table>
<% 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>
+<%= link_to 'Public page', main_url(request_url(@info_request)), :class => "btn" %>
+<%= link_to 'Edit', '../edit/' + @info_request.id.to_s, :class => "btn" %>
+<%= link_to 'FOI officer upload URL', '../generate_upload_url/' + @info_request.id.to_s, :class => "btn btn-warning" %> (see also links on incoming messages below)
<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(/_/,' ') %>
- <% 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>
+<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">
+ <a class="accordion-toggle" href="#event_<%=info_request_event.id%>" data-toggle="collapse" data-parent="events">
+ <%= _("Event {{id}}", :id => info_request_event.id) %>
+ --
+ <%=h info_request_event.event_type.humanize %>
+ <%= admin_date info_request_event.created_at%>
+ <% 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 pull-right" do %>
<%= hidden_field_tag 'info_request_event_id', info_request_event.id %>
- <%= submit_tag "Was clarification request" %>
- </div>
- <% end %>
- <% end %>
- </td>
- </tr>
-<% end %>
-</table>
+ <%= submit_tag "Was clarification request", :class => "btn btn-mini btn-primary" %>
+ <% end %>
+ <% end %>
+ </a>
+ </div>
+ <div id="event_<%=info_request_event.id%>" class="accordion-body collapse">
+ <table class="table table-striped">
+ <tbody>
+ <% 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 %>
+</div>
<h2>Outgoing messages</h2>
-
-<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 %>
-
- <% end %>
- <td>
- <% form_tag '../resend' do %>
- <div>
- <%= hidden_field_tag 'outgoing_message_id', outgoing_message.id %>
- <%= submit_tag "Resend" %>
+<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 class="accordion-toggle" href="#outgoing_<%=outgoing_message.id%>" data-toggle="collapse" data-parent="outgoing_messages">
+ #<%= outgoing_message.id %> -- <%= outgoing_message.status.humanize %> <%= outgoing_message.message_type.humanize %>
+ </a>
+ </div>
+ <div id="outgoing_<%=outgoing_message.id%>" class="accordion-body collapse">
+ <table class="table table-striped">
+ <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 btn-warning" %>
+ <% end %>
+ <%= link_to "Edit", "../edit_outgoing/#{outgoing_message.id}", :class => "btn btn-warning" %>
+ </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>
<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">
+ <% for incoming_message in @info_request.incoming_messages.find(:all, :order => 'created_at') %>
+ <div class="accordion-group">
+ <div class="accordion-heading">
+ <a class="accordion-toggle" href="#incoming_<%=incoming_message.id%>" data-toggle="collapse" data-parent="incoming_messages">
+ <%=incoming_message.id%> -- <%=incoming_message.mail_from%> <%=_("at")%> <%=admin_value(incoming_message.sent_at)%>
+ </a>
+ </div>
+ <div id="incoming_<%=incoming_message.id%>" class="accordion-body collapse">
+ <table class="table table-striped">
+ <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 %>
+ <tr>
+ <td colspan="2">
+ <% unless incoming_message.raw_email_id.nil? %>
+ <%= link_to "View raw email", "../show_raw_email/#{incoming_message.raw_email_id}", :class => "btn btn-mini" %>
+ <% end %>
+ <%= render :partial => 'incoming_message_actions', :locals => { :incoming_message => incoming_message } %>
+ </td>
+ </tr>
+ </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>
<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 class="accordion-toggle" href="#comment_<%=comment.id%>" data-toggle="collapse" data-parent="comments">
+ #<%=comment.id%>
+ --
+ <%=comment.user.name%>
+ <%=admin_value(comment.created_at)%>
+ </a>
+ </div>
+ <div id="comment_<%=comment.id%>" class="accordion-body collapse">
+ <table class="table table-striped">
+ <tbody>
+ <tr>
+ <td colspan="2">
+ <%= user_link(comment.user, "btn btn-mini")%>
+ <%= link_to("admin #{comment.user.name}", user_admin_url(comment.user), :class => "btn btn-mini") %>
+ <%= link_to "Edit", "../edit_comment/#{comment.id}", :class => "btn btn-warning btn-mini" %>
+ </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) %></s>
+ <% else %>
+ <%=h comment.send(column) %>
+ <% 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 %>
-
-
<h2>Exim delivery logs</h2>
<p><i>(Lines containing the request incoming email address, updated hourly.)</i></p>