diff --git a/app/helpers/check_answers_helper.rb b/app/helpers/check_answers_helper.rb index 4c57974ed..a8e5ab479 100644 --- a/app/helpers/check_answers_helper.rb +++ b/app/helpers/check_answers_helper.rb @@ -16,7 +16,7 @@ private def create_next_missing_question_link(subsection, case_log) pages_to_fill_in = subsection.unanswered_questions(case_log).map(&:page) - url = "/case_logs/#{case_log.id}/#{pages_to_fill_in.first.id}" + url = "/case-logs/#{case_log.id}/#{pages_to_fill_in.first.id.to_s.dasherize}" govuk_link_to("Answer the missing questions", url).html_safe end end diff --git a/app/helpers/tasklist_helper.rb b/app/helpers/tasklist_helper.rb index 83b8d02e1..96df32180 100644 --- a/app/helpers/tasklist_helper.rb +++ b/app/helpers/tasklist_helper.rb @@ -40,6 +40,6 @@ module TasklistHelper else "#" end - govuk_link_to(subsection.label, next_page_path, class: "task-name") + govuk_link_to(subsection.label, next_page_path.to_s.dasherize, class: "task-name") end end diff --git a/app/javascript/controllers/soft_validations_controller.js b/app/javascript/controllers/soft_validations_controller.js index 963dd7a76..8deeb4f5e 100644 --- a/app/javascript/controllers/soft_validations_controller.js +++ b/app/javascript/controllers/soft_validations_controller.js @@ -4,7 +4,7 @@ export default class extends Controller { static targets = [ "override" ] initialize() { - let url = window.location.href + "/soft_validations" + let url = window.location.href + "/soft-validations" let div = this.overrideTarget fetch(url, { headers: { accept: "application/json" } }) .then(response => response.json()) diff --git a/app/models/form.rb b/app/models/form.rb index 5dc85384c..1c24f71b3 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -12,11 +12,11 @@ class Form end def get_subsection(id) - subsections.find { |s| s.id == id } + subsections.find { |s| s.id == id.to_s.underscore } end def get_page(id) - pages.find { |p| p.id == id } + pages.find { |p| p.id == id.to_s.underscore } end def subsection_for_page(page) diff --git a/app/views/form/_check_answers_table.html.erb b/app/views/form/_check_answers_table.html.erb index 0b511f9bf..59fe45026 100644 --- a/app/views/form/_check_answers_table.html.erb +++ b/app/views/form/_check_answers_table.html.erb @@ -6,6 +6,6 @@ <%= question.answer_label(@case_log) %>
- <%= govuk_link_to(question.update_answer_link_name(@case_log), "/case_logs/#{@case_log.id}/#{question.page.id}").html_safe %> + <%= govuk_link_to(question.update_answer_link_name(@case_log), "/case-logs/#{@case_log.id}/#{question.page.id.to_s.dasherize}").html_safe %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b866643f8..19af05162 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -37,7 +37,7 @@ service_url: '/' ) do |component| if current_user.nil? - component.navigation_item(text: 'Case logs', href: '/case_logs') + component.navigation_item(text: 'Case logs', href: case_logs_path) elsif component.navigation_item(text: 'Your organisation', href: "/organisations/#{current_user.organisation.id}") component.navigation_item(text: 'Your account', href: '/users/account') diff --git a/config/routes.rb b/config/routes.rb index 3ca1e142d..336c80c13 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -30,10 +30,10 @@ Rails.application.routes.draw do end end - resources :case_logs do + resources :case_logs, :path => '/case-logs' do collection do - post "/bulk_upload", to: "bulk_upload#bulk_upload" - get "/bulk_upload", to: "bulk_upload#show" + post "/bulk-upload", to: "bulk_upload#bulk_upload" + get "/bulk-upload", to: "bulk_upload#show" end member do @@ -41,12 +41,12 @@ Rails.application.routes.draw do end form.pages.map do |page| - get page.id.to_s, to: "case_logs##{page.id}" - get "#{page.id}/soft_validations", to: "soft_validations#show" if page.has_soft_validations? + get page.id.to_s.dasherize, to: "case_logs##{page.id}" + get "#{page.id.to_s.dasherize}/soft-validations", to: "soft_validations#show" if page.has_soft_validations? end form.subsections.map do |subsection| - get "#{subsection.id}/check_answers", to: "case_logs#check_answers" + get "#{subsection.id.to_s.dasherize}/check-answers", to: "case_logs#check_answers" end end end diff --git a/docs/api/DLUHC-CORE-Data.v1.json b/docs/api/DLUHC-CORE-Data.v1.json index 7f85e2096..b404f6e43 100644 --- a/docs/api/DLUHC-CORE-Data.v1.json +++ b/docs/api/DLUHC-CORE-Data.v1.json @@ -12,7 +12,7 @@ } ], "paths": { - "/case_logs/:id": { + "/case-logs/:id": { "parameters": [], "get": { "summary": "Get Case Log Info by Case Log ID", @@ -180,7 +180,7 @@ ] } }, - "/case_logs": { + "/case-logs": { "post": { "summary": "Create New Case Log", "operationId": "post-caselog",