diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb index df2744fb0..07508a51d 100644 --- a/app/controllers/locations_controller.rb +++ b/app/controllers/locations_controller.rb @@ -12,13 +12,17 @@ class LocationsController < ApplicationController @location = Location.new(location_params) if @location.save - redirect_to scheme_check_answers_path(scheme_id: @scheme.id) if location_params[:add_another_location] == "No" - redirect_to location_new_scheme_path if location_params[:add_another_location] == "Yes" + location_params[:add_another_location] == "Yes" ? redirect_to(location_new_scheme_path) : redirect_to(scheme_check_answers_path(scheme_id: @scheme.id)) else render :new, status: :unprocessable_entity end end + def details + debugger + render :new + end + private def authenticate_scope! diff --git a/app/helpers/tab_nav_helper.rb b/app/helpers/tab_nav_helper.rb index 2c24c7b6e..372bc6297 100644 --- a/app/helpers/tab_nav_helper.rb +++ b/app/helpers/tab_nav_helper.rb @@ -8,7 +8,7 @@ module TabNavHelper def location_cell(location) link_text = location.postcode - [govuk_link_to(link_text, "locations"), "Location #{location.scheme.service_name}"].join("\n") + [govuk_link_to(link_text, location_scheme_path(location, scheme_id: location.scheme.id)), "Location #{location.scheme.service_name}"].join("\n") end def scheme_cell(scheme) diff --git a/config/routes.rb b/config/routes.rb index 88d6aa30e..8e5fa919a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -47,6 +47,8 @@ Rails.application.routes.draw do get "locations", to: "schemes#locations" get "location/new", to: "locations#new" post "location/create", to: "locations#create" + patch "location", to: "locations#create" + get "location", to: "locations#details" end end