aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/public_body_change_requests_controller.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-01-28 16:56:32 +0000
committerLouise Crow <louise.crow@gmail.com>2014-01-28 16:56:32 +0000
commitfc0c4ea6fa66dc2cbd839de013476205bf574c90 (patch)
tree676a51352756ba91f7c676db2d1225400f010a47 /app/controllers/public_body_change_requests_controller.rb
parent89a8fd2ce9880ae0f194733991aa93e447f0ba73 (diff)
parent0299747af77b5a7c870c31a99598ff1d2928b507 (diff)
Merge branch 'feature/1176-automate-authority-contacts' into rails-3-develop
Conflicts: doc/CHANGES.md
Diffstat (limited to 'app/controllers/public_body_change_requests_controller.rb')
-rw-r--r--app/controllers/public_body_change_requests_controller.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/controllers/public_body_change_requests_controller.rb b/app/controllers/public_body_change_requests_controller.rb
new file mode 100644
index 000000000..4a6c5f5cb
--- /dev/null
+++ b/app/controllers/public_body_change_requests_controller.rb
@@ -0,0 +1,28 @@
+class PublicBodyChangeRequestsController < ApplicationController
+
+ def create
+ @change_request = PublicBodyChangeRequest.from_params(params[:public_body_change_request], @user)
+ if @change_request.save
+ @change_request.send_message
+ flash[:notice] = @change_request.thanks_notice
+ redirect_to frontpage_url
+ return
+ else
+ render :action => 'new'
+ end
+ end
+
+ def new
+ @change_request = PublicBodyChangeRequest.new
+ if params[:body]
+ @change_request.public_body = PublicBody.find_by_url_name_with_historic(params[:body])
+ end
+ if @change_request.public_body
+ @title = _('Ask us to update the email address for {{public_body_name}}',
+ :public_body_name => @change_request.public_body.name)
+ else
+ @title = _('Ask us to add an authority')
+ end
+
+ end
+end