aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-12-18 19:11:42 +0000
committerLouise Crow <louise.crow@gmail.com>2014-01-13 12:36:41 +0000
commit98189eedf4c80d730eb89f860e474c20759cfcec (patch)
tree3a5ef8c0f3c824cad87278960d4882fd2abd0adc
parentbfd1a71eeb4962996db5b226a976558b9f7a50bd (diff)
Add change requests to the 'Things to do' list
-rw-r--r--app/controllers/admin_general_controller.rb2
-rw-r--r--app/views/admin_general/_change_request_summary.html.erb60
-rw-r--r--app/views/admin_general/index.html.erb32
-rw-r--r--config/routes.rb5
4 files changed, 98 insertions, 1 deletions
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb
index 1bdd0c772..753208c9a 100644
--- a/app/controllers/admin_general_controller.rb
+++ b/app/controllers/admin_general_controller.rb
@@ -35,6 +35,8 @@ class AdminGeneralController < AdminController
@old_unclassified = InfoRequest.find_old_unclassified(:limit => 20,
:conditions => ["prominence = 'normal'"])
@holding_pen_messages = InfoRequest.holding_pen_request.incoming_messages
+ @new_body_requests = PublicBodyChangeRequest.new_body_requests.open
+ @body_update_requests = PublicBodyChangeRequest.body_update_requests.open
end
def timeline
diff --git a/app/views/admin_general/_change_request_summary.html.erb b/app/views/admin_general/_change_request_summary.html.erb
new file mode 100644
index 000000000..bec49c12c
--- /dev/null
+++ b/app/views/admin_general/_change_request_summary.html.erb
@@ -0,0 +1,60 @@
+<table class="table table-striped table-condensed">
+ <tbody>
+ <tr>
+ <td>
+ <b>Authority</b>
+ </td>
+ <td>
+ <%= @change_request.get_public_body_name %>
+ </td>
+ </tr>
+
+ <% if @change_request.public_body %>
+ <tr>
+ <td>
+ <b>Current address</b>
+ </td>
+ <td>
+ <%= @change_request.public_body.request_email %>
+ </td>
+ </tr>
+ <% end %>
+
+ <tr>
+ <td>
+ <b>Suggested address</b>
+ </td>
+ <td>
+ <%= @change_request.public_body_email %>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <b>Source</b>
+ </td>
+ <td>
+ <%= @change_request.source_url %>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <b>Requested by</b>
+ </td>
+ <td>
+ <%= @change_request.get_user_name %> (<%= @change_request.get_user_email %>)
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <b>Requested on</b>
+ </td>
+ <td>
+ <%= I18n.l(@change_request.created_at, :format => "%e %B %Y %H:%M:%S") %>
+ (<%= "#{time_ago_in_words(@change_request.created_at)} ago" %>)
+ </td>
+ </tr>
+ </tbody>
+</table>
diff --git a/app/views/admin_general/index.html.erb b/app/views/admin_general/index.html.erb
index 976860fa7..2202663be 100644
--- a/app/views/admin_general/index.html.erb
+++ b/app/views/admin_general/index.html.erb
@@ -174,9 +174,39 @@
</div>
</div>
<% end %>
+
+ <% if @new_body_requests.size > 0 %>
+ <div class="accordion-group">
+ <div class="accordion-heading">
+ <a class="accordion-toggle" href="#new-authorities" data-toggle="collapse" data-parent="things-to-do"><span class="label label-important"><%= @new_body_requests.size %></span><%= chevron_right %> Add new authorities</a>
+ </div>
+ <div id="new-authorities" class="accordion-body collapse">
+ <% for @change_request in @new_body_requests %>
+ <%= render :partial => 'change_request_summary'%>
+ <%= link_to("Close and respond", admin_change_request_edit_path(@change_request), :class => 'btn') %>
+ <%= link_to("Add authority", admin_body_new_path(:change_request_id => @change_request.id), :class => 'btn btn-primary') %>
+ <% end %>
+ </div>
+ </div>
+ <% end %>
+
+ <% if @body_update_requests.size > 0 %>
+ <div class="accordion-group">
+ <div class="accordion-heading">
+ <a class="accordion-toggle" href="#update-authorities" data-toggle="collapse" data-parent="things-to-do"><span class="label label-important"><%= @body_update_requests.size %></span><%= chevron_right %> Update authorities</a>
+ </div>
+ <div id="update-authorities" class="accordion-body collapse">
+ <% for @change_request in @body_update_requests %>
+ <%= render :partial => 'change_request_summary' %>
+ <%= link_to("Close and respond", admin_change_request_edit_path(@change_request), :class => 'btn') %>
+ <%= link_to("Make update", admin_body_edit_path(@change_request.public_body, :change_request_id => @change_request.id), :class => 'btn btn-primary') %>
+ <% end %>
+ </div>
+ </div>
+ <% end %>
</div>
-<% if @holding_pen_messages.size == 0 && @old_unclassified.size == 0 && @requires_admin_requests.size == 0 && @blank_contacts.size == 0 && @attention_requests.size == 0 %>
+<% if @holding_pen_messages.size == 0 && @old_unclassified.size == 0 && @requires_admin_requests.size == 0 && @blank_contacts.size == 0 && @attention_requests.size == 0 && @new_body_requests.size == 0 && @body_update_requests.size == 0 %>
<div class="row">
<div class="span12 alert alert-success">
No pending administration required.
diff --git a/config/routes.rb b/config/routes.rb
index a70be2492..27311fab7 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -174,6 +174,11 @@ Alaveteli::Application.routes.draw do
match '/admin/body/mass_tag_add' => 'admin_public_body#mass_tag_add', :as => :admin_body_mass_tag_add
####
+ #### AdminPublicBodyChangeRequest controller
+ match '/admin/change_request/edit/:id' => 'admin_public_body_change_requests#edit', :as => :admin_change_request_edit
+ match '/admin/change_request/update/:id' => 'admin_public_body_change_requests#update', :as => :admin_change_request_update
+ ####
+
#### AdminGeneral controller
match '/admin' => 'admin_general#index', :as => :admin_general_index
match '/admin/timeline' => 'admin_general#timeline', :as => :admin_timeline