From 8a04ea2d518830c4b46ebf1460f7131617359735 Mon Sep 17 00:00:00 2001 From: hisayohorie Date: Tue, 1 Aug 2017 16:09:28 -0400 Subject: [PATCH] Added no_contributor_info route to show flash notice thank you To give thank you for contributor who did not leave their info. --- app/controllers/contributors_controller.rb | 5 +++++ app/views/contributors/new.html.haml | 2 +- config/routes.rb | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/contributors_controller.rb b/app/controllers/contributors_controller.rb index 2571ff306..75b9e0717 100644 --- a/app/controllers/contributors_controller.rb +++ b/app/controllers/contributors_controller.rb @@ -15,6 +15,11 @@ def create end end + def no_contributor_info + flash[:notice] = "Thank you" + redirect_to root_url + end + private def contributor_params diff --git a/app/views/contributors/new.html.haml b/app/views/contributors/new.html.haml index ac538bf17..eb495bd9f 100644 --- a/app/views/contributors/new.html.haml +++ b/app/views/contributors/new.html.haml @@ -17,4 +17,4 @@ = f.text_field :email %p.button = f.submit "Submit" - = link_to "I prefer not to", root_url + = link_to "I prefer not to", contributors_no_info_path diff --git a/config/routes.rb b/config/routes.rb index 8dbc70b0c..146ce7130 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -111,6 +111,7 @@ def matches?(request) post "/authorities/:authority_id/councillor_contributions/new", to: "councillor_contributions#new" resources :contributors, only:[:new, :create] + get "/contributors/no_info", to: "contributors#no_contributor_info" namespace :atdis do get :test