aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-10-23 16:49:04 +0100
committerLouise Crow <louise.crow@gmail.com>2014-10-30 11:14:15 +0000
commit921ee9a19c267bb0e6e784091b985f3ba80d835b (patch)
tree9e0f8d029365bb31336be1cf3bdc5e01a4df1ead /app
parent967c422f3150da94c3756be84f35d021ed69f5e6 (diff)
Allow closure of a change request without sending an email.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_public_body_change_requests_controller.rb8
-rw-r--r--app/views/admin_general/index.html.erb8
2 files changed, 12 insertions, 4 deletions
diff --git a/app/controllers/admin_public_body_change_requests_controller.rb b/app/controllers/admin_public_body_change_requests_controller.rb
index d76cdc0e5..6ff03a2bd 100644
--- a/app/controllers/admin_public_body_change_requests_controller.rb
+++ b/app/controllers/admin_public_body_change_requests_controller.rb
@@ -7,8 +7,12 @@ class AdminPublicBodyChangeRequestsController < AdminController
def update
@change_request = PublicBodyChangeRequest.find(params[:id])
@change_request.close!
- @change_request.send_response(params[:subject], params[:response])
- flash[:notice] = 'The change request has been closed and the user has been notified'
+ if params[:subject] && params[:response]
+ @change_request.send_response(params[:subject], params[:response])
+ flash[:notice] = 'The change request has been closed and the user has been notified'
+ else
+ flash[:notice] = 'The change request has been closed'
+ end
redirect_to admin_general_index_path
end
diff --git a/app/views/admin_general/index.html.erb b/app/views/admin_general/index.html.erb
index f29258162..a1f2e1d2d 100644
--- a/app/views/admin_general/index.html.erb
+++ b/app/views/admin_general/index.html.erb
@@ -183,8 +183,12 @@
<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') %>
+ <%= form_tag admin_change_request_update_path(@change_request), :class => "form form-horizontal" do %>
+ <%= submit_tag 'Close', :class => "btn btn-danger" %>
+ <%= 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 %>
+
<% end %>
</div>
</div>