Change the route for DossierController#modifier

If we submit the form, and there’s an error, the
URL would be `/dossiers/:id`, therefore
`dossier_path(dossier)`, so the Résumé tab would
be active, not the messagerie tab. This change
prevents this behaviour.
This commit is contained in:
gregoirenovel 2018-09-06 15:36:50 +02:00
parent 038cabfae3
commit 9c6a66ae75
2 changed files with 3 additions and 3 deletions

View file

@ -6,7 +6,7 @@
- elsif dossier.brouillon?
- form_options = { url: brouillon_dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
- else
- form_options = { url: dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
- form_options = { url: modifier_dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
= form_for dossier, form_options do |f|

View file

@ -271,14 +271,14 @@ Rails.application.routes.draw do
#
scope module: 'new_user' do
resources :dossiers, only: [:index, :show, :update] do
resources :dossiers, only: [:index, :show] do
member do
get 'identite'
patch 'update_identite'
get 'brouillon'
patch 'brouillon', to: 'dossiers#update_brouillon'
get 'modifier', to: 'dossiers#modifier'
patch ':id', to: 'dossiers#update'
patch 'modifier', to: 'dossiers#update'
get 'merci'
get 'demande'
get 'messagerie'