From 30e79b735d70371587abfbd8847dd7435462fec3 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Thu, 18 Jul 2024 17:27:19 +0200 Subject: [PATCH] route: allow standard path helper to work for example `form_with model: [:instructeur, procedure, export_template]` --- .../export_dropdown_component.html.haml | 2 +- config/routes.rb | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/components/dossiers/export_dropdown_component/export_dropdown_component.html.haml b/app/components/dossiers/export_dropdown_component/export_dropdown_component.html.haml index fd29214f2..441149066 100644 --- a/app/components/dossiers/export_dropdown_component/export_dropdown_component.html.haml +++ b/app/components/dossiers/export_dropdown_component/export_dropdown_component.html.haml @@ -22,5 +22,5 @@ = link_to download_export_path(export_template_id: export_template.id), role: 'menuitem', data: { turbo_method: :post, turbo: true } do = "Exporter à partir du modèle #{export_template.name}" - menu.with_item do - = link_to new_instructeur_export_template_path(procedure_id: params[:procedure_id]), role: 'menuitem' do + = link_to [:new, :instructeur, @procedure, :export_template], role: 'menuitem' do Ajouter un modèle d'export diff --git a/config/routes.rb b/config/routes.rb index 3a8e72fba..9c2239267 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -443,14 +443,17 @@ Rails.application.routes.draw do # scope module: 'instructeurs', as: 'instructeur' do + resources :procedures, only: [] do + resources :export_templates, only: [:new, :create, :edit, :update, :destroy] do + collection do + get 'preview' + end + end + end + resources :procedures, only: [:index, :show], param: :procedure_id do member do resources :archives, only: [:index, :create] - resources :export_templates, only: [:new, :create, :edit, :update, :destroy] do - collection do - get 'preview' - end - end resources :groupes, only: [:index, :show], controller: 'groupe_instructeurs' do resource :contact_information