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.rhtml20
-rw-r--r--app/views/admin_request/_some_requests.rhtml59
-rw-r--r--app/views/admin_request/list.rhtml12
-rw-r--r--app/views/admin_request/show.rhtml426
4 files changed, 224 insertions, 293 deletions
diff --git a/app/views/admin_request/_incoming_message_actions.rhtml b/app/views/admin_request/_incoming_message_actions.rhtml
index c32cbdb54..c23b4060a 100644
--- a/app/views/admin_request/_incoming_message_actions.rhtml
+++ b/app/views/admin_request/_incoming_message_actions.rhtml
@@ -1,4 +1,4 @@
-<% form_tag '../redeliver_incoming', :class => "form form-inline" do %>
+<% form_tag '../redeliver_incoming' do %>
<div>
id or url_title of request:
<% if @info_requests && @info_requests.size == 1 %>
@@ -7,18 +7,20 @@
<%= text_field_tag 'url_title', "", { :size => 20 } %>
<% end %>
<%= hidden_field_tag 'redeliver_incoming_message_id', incoming_message.id %>
- <%= submit_tag "Redeliver to another request", :class => "btn btn-warning" %>
+ <%= submit_tag "Redeliver to another request" %>
</div>
<% end %>
<p>
-<%= link_to 'FOI officer upload URL', "../generate_upload_url/#{incoming_message.info_request.id}?incoming_message_id=#{incoming_message.id}", :class => "btn" %>
+<%= 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>
-<% form_tag '../destroy_incoming', :class => "form form-inline" do %>
- <%= hidden_field_tag 'incoming_message_id', incoming_message.id %>
- <span class="label label-important">
- Warning, this is permanent! &nbsp;
- </span>
- <%= submit_tag "Destroy message", :class => "btn btn-danger" %>
+<% form_tag '../destroy_incoming' do %>
+ <div>
+ <%= hidden_field_tag 'incoming_message_id', incoming_message.id %>
+ Warning, this is permanent! ---&gt;
+ <%= submit_tag "Destroy message" %>
+ </div>
<% end %>
+
+
diff --git a/app/views/admin_request/_some_requests.rhtml b/app/views/admin_request/_some_requests.rhtml
index 5e9b14641..f2b8e7bea 100644
--- a/app/views/admin_request/_some_requests.rhtml
+++ b/app/views/admin_request/_some_requests.rhtml
@@ -1,38 +1,23 @@
-<div class="accordion" id="requests">
- <% for info_request in info_requests %>
- <div class="accordion-group">
- <div class="accordion-heading">
- <%= link_to("admin", request_admin_url(info_request), :class => "btn btn-primary btn-mini") %>
- <a class="accordion-toggle" href="#request_<%=info_request.id%>" data-toggle="collapse" data-parent="requests">
- <%=info_request.title%>
- </a>
- </div>
- <div id="request_<%=info_request.id%>" class="accordion-body collapse">
- <table class="table table-striped">
- <tbody>
- <tr>
- <td colspan="2">
- <%= link_to("admin #{info_request.public_body.name}", public_body_admin_url(info_request.public_body), :class => "btn btn-mini") %>
- <%= link_to("admin #{info_request.user.name}", user_admin_url(info_request.user), :class => "btn btn-mini") %>
- </td>
- </tr>
- <% info_request.for_admin_column do | name, value, type | %>
- <tr>
- <td>
- <b><%=h 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 %>
- </tr>
- <% end %>
- </tbody>
- </table>
- </div>
- </div>
+<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>
<% end %>
-</div>
+ </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>
+ <td><%= user_both_links(info_request.user) %></td>
+ <% for column in InfoRequest.content_columns.map { |c| c.name } - [ "title", "url_title" ] %>
+ <td><%=h info_request.send(column) %></td>
+ <% end %>
+ </tr>
+<% end %>
+</table>
+
+
diff --git a/app/views/admin_request/list.rhtml b/app/views/admin_request/list.rhtml
index ff67dd843..cb328543e 100644
--- a/app/views/admin_request/list.rhtml
+++ b/app/views/admin_request/list.rhtml
@@ -1,13 +1,15 @@
-<% @title = _("Listing FOI requests") %>
+<% @title = 'Listing FOI/EIR requests' %>
<h1><%=@title%></h1>
-<% 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)
+<% form_tag("", :method => "get") do %>
+ <p>
+ <%= text_field_tag 'query', params[:query], { :size => 30 } %>
+ <%= submit_tag "Search" %> (substring search, titles only)
+ </p>
<% end %>
<%= render :partial => 'some_requests', :locals => { :info_requests => @info_requests } %>
-<%= will_paginate(@info_requests, :class => "paginator") %>
+<%= will_paginate(@info_requests) %>
diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml
index a93ef5db1..aac68ad2e 100644
--- a/app/views/admin_request/show.rhtml
+++ b/app/views/admin_request/show.rhtml
@@ -1,270 +1,212 @@
-<% @title = _("FOI request - {{title}}", :title => h(@info_request.title)) %>
+<% @title = "FOI request - " + h(@info_request.title) %>
<%= javascript_include_tag :defaults %>
<h1><%=@title%></h1>
-<% 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>
+<% 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>
<% end %>
-<%= 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)
+<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>
-<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", :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>
+
+<table>
+ <tr>
+ <th>Id</th>
+ <% for column in InfoRequestEvent.content_columns %>
+ <th><%= column.human_name %></th>
<% end %>
-</div>
+ <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>
+ <% end %>
+ <% end %>
+ </td>
+ </tr>
+<% end %>
+</table>
<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 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>
+
+<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>
- </div>
<% end %>
-</div>
+ <%= link_to "Edit", '../edit_outgoing/' + outgoing_message.id.to_s %>
+ </td>
+ </tr>
+<% end %>
+</table>
<h2>Incoming messages</h2>
-<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>
+
+<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 %>
<% end %>
-</div>
+ <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>
<h2>Annotations</h2>
<% if @info_request.comments.size > 0 %>
- <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>
+ <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 %>
<% end %>
- </div>
+ <td>
+ <%= link_to "Edit", '../edit_comment/' + comment.id.to_s %>
+ </td>
+ </tr>
+ <% end %>
+ </table>
<% else %>
<p>None yet.</p>
<% end %>
+
+
<h2>Exim delivery logs</h2>
<p><i>(Lines containing the request incoming email address, updated hourly.)</i></p>