Browse Source

wip

pull/704/head
JG 3 years ago
parent
commit
819727638e
  1. 8
      app/controllers/locations_controller.rb
  2. 2
      app/helpers/tab_nav_helper.rb
  3. 2
      config/routes.rb

8
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!

2
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"), "<span class=\"govuk-visually-hidden\">Location </span><span class=\"govuk-!-font-weight-regular app-!-colour-muted\">#{location.scheme.service_name}</span>"].join("\n")
[govuk_link_to(link_text, location_scheme_path(location, scheme_id: location.scheme.id)), "<span class=\"govuk-visually-hidden\">Location </span><span class=\"govuk-!-font-weight-regular app-!-colour-muted\">#{location.scheme.service_name}</span>"].join("\n")
end
def scheme_cell(scheme)

2
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

Loading…
Cancel
Save