Add DossierController#modifier
This commit is contained in:
parent
338ffb8b50
commit
cd46ee06e1
6 changed files with 18 additions and 6 deletions
|
@ -4,9 +4,9 @@ module NewUser
|
||||||
|
|
||||||
helper_method :new_demarche_url
|
helper_method :new_demarche_url
|
||||||
|
|
||||||
before_action :ensure_ownership!, except: [:index, :show, :demande, :messagerie, :brouillon, :update_brouillon, :recherche]
|
before_action :ensure_ownership!, except: [:index, :show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :recherche]
|
||||||
before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :messagerie, :brouillon, :update_brouillon, :create_commentaire]
|
before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :create_commentaire]
|
||||||
before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update_brouillon]
|
before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update_brouillon, :modifier]
|
||||||
before_action :forbid_invite_submission!, only: [:update_brouillon]
|
before_action :forbid_invite_submission!, only: [:update_brouillon]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -123,6 +123,10 @@ module NewUser
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def modifier
|
||||||
|
@dossier = dossier_with_champs
|
||||||
|
end
|
||||||
|
|
||||||
def merci
|
def merci
|
||||||
@dossier = current_user.dossiers.includes(:procedure).find(params[:id])
|
@dossier = current_user.dossiers.includes(:procedure).find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
|
|
||||||
.container
|
.container
|
||||||
- if !@dossier.read_only?
|
- if !@dossier.read_only?
|
||||||
= link_to "Modifier le dossier", brouillon_dossier_path(@dossier), class: 'button primary edit-form'
|
= link_to "Modifier le dossier", modifier_dossier_path(@dossier), class: 'button primary edit-form'
|
||||||
|
|
7
app/views/new_user/dossiers/modifier.html.haml
Normal file
7
app/views/new_user/dossiers/modifier.html.haml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
- content_for(:title, "Modifier · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
|
||||||
|
|
||||||
|
#dossier-show
|
||||||
|
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
|
||||||
|
|
||||||
|
.container
|
||||||
|
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: false }
|
|
@ -277,6 +277,7 @@ Rails.application.routes.draw do
|
||||||
patch 'update_identite'
|
patch 'update_identite'
|
||||||
get 'brouillon'
|
get 'brouillon'
|
||||||
patch 'brouillon', to: 'dossiers#update_brouillon'
|
patch 'brouillon', to: 'dossiers#update_brouillon'
|
||||||
|
get 'modifier', to: 'dossiers#modifier'
|
||||||
get 'merci'
|
get 'merci'
|
||||||
get 'demande'
|
get 'demande'
|
||||||
get 'messagerie'
|
get 'messagerie'
|
||||||
|
|
|
@ -25,7 +25,7 @@ describe 'Dossier details:' do
|
||||||
expect(page).to have_current_path(demande_dossier_path(dossier))
|
expect(page).to have_current_path(demande_dossier_path(dossier))
|
||||||
click_on 'Modifier le dossier'
|
click_on 'Modifier le dossier'
|
||||||
|
|
||||||
expect(page).to have_current_path(brouillon_dossier_path(dossier))
|
expect(page).to have_current_path(modifier_dossier_path(dossier))
|
||||||
fill_in('texte obligatoire', with: 'Nouveau texte')
|
fill_in('texte obligatoire', with: 'Nouveau texte')
|
||||||
click_on 'Enregistrer les modifications du dossier'
|
click_on 'Enregistrer les modifications du dossier'
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ describe 'new_user/dossiers/demande.html.haml', type: :view do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the dossier is editable' do
|
context 'when the dossier is editable' do
|
||||||
it { is_expected.to have_link('Modifier le dossier', href: brouillon_dossier_path(dossier)) }
|
it { is_expected.to have_link('Modifier le dossier', href: modifier_dossier_path(dossier)) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the dossier is read-only' do
|
context 'when the dossier is read-only' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue