deplacement de l'URL qui envoie vers la procédure
This commit is contained in:
parent
b3db0a104e
commit
6b19432d47
4 changed files with 17 additions and 4 deletions
|
@ -110,6 +110,8 @@ class Admin::ProceduresController < AdminController
|
|||
procedure = current_administrateur.procedures.find(params[:procedure_id])
|
||||
|
||||
procedure.path = path
|
||||
procedure.lien_site_web = params[:lien_site_web]
|
||||
|
||||
if !procedure.validate
|
||||
flash.alert = 'Lien de la démarche invalide'
|
||||
return redirect_to admin_procedures_path
|
||||
|
|
|
@ -19,9 +19,10 @@
|
|||
= f.label :duree_conservation_dossiers_hors_ds, "Hors demarches-simplifiees.fr* (durée en mois après la fin de l'instruction)"
|
||||
= f.number_field :duree_conservation_dossiers_hors_ds, class: 'form-control', placeholder: '6', required: true
|
||||
|
||||
.form-group
|
||||
%h4 Où les usagers trouveront-ils le lien vers la démarche ?
|
||||
= f.text_field :lien_site_web, class: 'form-control', placeholder: 'https://exemple.gouv.fr/ma_demarche'
|
||||
- if @procedure.locked?
|
||||
.form-group
|
||||
%h4 Où les usagers trouveront-ils le lien vers la démarche ?
|
||||
= f.text_field :lien_site_web, class: 'form-control', placeholder: 'https://exemple.gouv.fr/ma_demarche'
|
||||
|
||||
.form-group
|
||||
%h4 Cadre juridique *
|
||||
|
|
|
@ -38,6 +38,11 @@
|
|||
"https://vimeo.com/334463514",
|
||||
target: "_blank"
|
||||
|
||||
.form-group
|
||||
%h4 Où les usagers trouveront-ils le lien vers cette démarche ?
|
||||
%p.center
|
||||
= text_field_tag(:lien_site_web, @procedure.lien_site_web, class: 'form-control', placeholder: 'https://exemple.gouv.fr/ma_demarche')
|
||||
|
||||
#path-messages
|
||||
#path_is_mine.text-warning.center.message
|
||||
Ce lien est déjà utilisé par une de vos démarche.
|
||||
|
|
|
@ -334,10 +334,11 @@ describe Admin::ProceduresController, type: :controller do
|
|||
let(:procedure) { create(:procedure, administrateur: admin) }
|
||||
let(:procedure2) { create(:procedure, :published, administrateur: admin) }
|
||||
let(:procedure3) { create(:procedure, :published) }
|
||||
let(:lien_site_web) { 'http://some.administration/' }
|
||||
|
||||
context 'when admin is the owner of the procedure' do
|
||||
before do
|
||||
put :publish, params: { procedure_id: procedure.id, path: path }
|
||||
put :publish, params: { procedure_id: procedure.id, path: path, lien_site_web: lien_site_web }
|
||||
procedure.reload
|
||||
procedure2.reload
|
||||
end
|
||||
|
@ -348,6 +349,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
it 'publish the given procedure' do
|
||||
expect(procedure.publiee?).to be_truthy
|
||||
expect(procedure.path).to eq(path)
|
||||
expect(procedure.lien_site_web).to eq(lien_site_web)
|
||||
expect(response.status).to eq 302
|
||||
expect(flash[:notice]).to have_content 'Démarche publiée'
|
||||
end
|
||||
|
@ -359,6 +361,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
it 'publish the given procedure' do
|
||||
expect(procedure.publiee?).to be_truthy
|
||||
expect(procedure.path).to eq(path)
|
||||
expect(procedure.lien_site_web).to eq(lien_site_web)
|
||||
expect(response.status).to eq 302
|
||||
expect(flash[:notice]).to have_content 'Démarche publiée'
|
||||
end
|
||||
|
@ -375,6 +378,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
it 'does not publish the given procedure' do
|
||||
expect(procedure.publiee?).to be_falsey
|
||||
expect(procedure.path).not_to match(path)
|
||||
expect(procedure.lien_site_web).not_to match(lien_site_web)
|
||||
expect(response.status).to eq 200
|
||||
end
|
||||
|
||||
|
@ -391,6 +395,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
it 'does not publish the given procedure' do
|
||||
expect(procedure.publiee?).to be_falsey
|
||||
expect(procedure.path).not_to match(path)
|
||||
expect(procedure.lien_site_web).not_to match(lien_site_web)
|
||||
expect(response).to redirect_to :admin_procedures
|
||||
expect(flash[:alert]).to have_content 'Lien de la démarche invalide'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue