add confirmation page after publishing procedure for admin
This commit is contained in:
parent
f6c051e08e
commit
ac834b0c0a
11 changed files with 65 additions and 25 deletions
|
@ -3,7 +3,7 @@ module Administrateurs
|
||||||
layout 'all', only: [:all, :administrateurs]
|
layout 'all', only: [:all, :administrateurs]
|
||||||
respond_to :html, :xlsx
|
respond_to :html, :xlsx
|
||||||
|
|
||||||
before_action :retrieve_procedure, only: [:champs, :annotations, :modifications, :edit, :zones, :monavis, :update_monavis, :jeton, :update_jeton, :publication, :publish, :transfert, :close, :allow_expert_review, :allow_expert_messaging, :experts_require_administrateur_invitation, :reset_draft]
|
before_action :retrieve_procedure, only: [:champs, :annotations, :modifications, :edit, :zones, :monavis, :update_monavis, :jeton, :update_jeton, :publication, :publish, :transfert, :close, :confirmation, :allow_expert_review, :allow_expert_messaging, :experts_require_administrateur_invitation, :reset_draft, :publish_revision]
|
||||||
before_action :draft_valid?, only: [:apercu]
|
before_action :draft_valid?, only: [:apercu]
|
||||||
after_action :reset_procedure, only: [:update]
|
after_action :reset_procedure, only: [:update]
|
||||||
|
|
||||||
|
@ -277,18 +277,10 @@ module Administrateurs
|
||||||
def publish
|
def publish
|
||||||
@procedure.assign_attributes(publish_params)
|
@procedure.assign_attributes(publish_params)
|
||||||
|
|
||||||
|
@procedure.publish_or_reopen!(current_administrateur)
|
||||||
|
|
||||||
if @procedure.draft_changed?
|
if @procedure.draft_changed?
|
||||||
if @procedure.close?
|
|
||||||
if @procedure.publish_or_reopen!(current_administrateur)
|
|
||||||
@procedure.publish_revision!
|
@procedure.publish_revision!
|
||||||
flash.notice = "Démarche publiée"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@procedure.publish_revision!
|
|
||||||
flash.notice = "Nouvelle version de la démarche publiée"
|
|
||||||
end
|
|
||||||
elsif @procedure.publish_or_reopen!(current_administrateur)
|
|
||||||
flash.notice = "Démarche publiée"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:old_procedure].present? && @procedure.errors.empty?
|
if params[:old_procedure].present? && @procedure.errors.empty?
|
||||||
|
@ -300,7 +292,7 @@ module Administrateurs
|
||||||
.update!(replaced_by_procedure: @procedure)
|
.update!(replaced_by_procedure: @procedure)
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to admin_procedure_path(@procedure)
|
redirect_to admin_procedure_confirmation_path(@procedure)
|
||||||
rescue ActiveRecord::RecordInvalid
|
rescue ActiveRecord::RecordInvalid
|
||||||
flash.alert = @procedure.errors.full_messages
|
flash.alert = @procedure.errors.full_messages
|
||||||
redirect_to admin_procedure_publication_path(@procedure)
|
redirect_to admin_procedure_publication_path(@procedure)
|
||||||
|
@ -312,12 +304,24 @@ module Administrateurs
|
||||||
redirect_to admin_procedure_path(@procedure)
|
redirect_to admin_procedure_path(@procedure)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def publish_revision
|
||||||
|
if @procedure.draft_changed?
|
||||||
|
@procedure.publish_revision!
|
||||||
|
flash.notice = "Nouvelle version de la démarche publiée"
|
||||||
|
|
||||||
|
redirect_to admin_procedure_path(@procedure)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def transfert
|
def transfert
|
||||||
end
|
end
|
||||||
|
|
||||||
def close
|
def close
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def confirmation
|
||||||
|
end
|
||||||
|
|
||||||
def allow_expert_review
|
def allow_expert_review
|
||||||
@procedure.update!(allow_expert_review: !@procedure.allow_expert_review)
|
@procedure.update!(allow_expert_review: !@procedure.allow_expert_review)
|
||||||
flash.notice = @procedure.allow_expert_review? ? "Avis externes activés" : "Avis externes désactivés"
|
flash.notice = @procedure.allow_expert_review? ? "Avis externes activés" : "Avis externes désactivés"
|
||||||
|
|
23
app/views/administrateurs/procedures/confirmation.html.haml
Normal file
23
app/views/administrateurs/procedures/confirmation.html.haml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
= render partial: 'administrateurs/breadcrumbs',
|
||||||
|
locals: { steps: [['Démarches', admin_procedures_back_path(@procedure)],
|
||||||
|
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
|
||||||
|
['Confirmation']] }
|
||||||
|
|
||||||
|
.fr-container
|
||||||
|
.fr-grid-row
|
||||||
|
.fr-col-12.fr-col-offset-md-2.fr-col-md-8
|
||||||
|
%h1= t('administrateurs.procedures.publication.confirmation')
|
||||||
|
|
||||||
|
= render Dsfr::CalloutComponent.new(title: nil) do |c|
|
||||||
|
- c.with_body do
|
||||||
|
%p= t('administrateurs.procedures.publication.share_link')
|
||||||
|
%p
|
||||||
|
%strong= commencer_url(@procedure.path)
|
||||||
|
= render Dsfr::CopyButtonComponent.new(text: commencer_url(@procedure.path), title: t("administrateurs.procedures.publication.copy_url"))
|
||||||
|
|
||||||
|
%ul.fr-mt-2w.fr-btns-group.fr-btns-group--inline
|
||||||
|
%li= link_to t('administrateurs.procedures.publication.back_to_procedure'), admin_procedure_path(id: @procedure), class: 'fr-btn'
|
||||||
|
%li= link_to t('administrateurs.procedures.publication.new_procedure'), new_from_existing_admin_procedures_path, class: 'fr-btn fr-btn--secondary'
|
||||||
|
|
||||||
|
.text-center
|
||||||
|
= image_tag('landing/hero/dematerialiser.svg', "aria-hidden": true)
|
|
@ -38,6 +38,9 @@
|
||||||
|
|
||||||
- c.bottom do
|
- c.bottom do
|
||||||
%ul.fr-mt-2w.fr-btns-group.fr-btns-group--inline
|
%ul.fr-mt-2w.fr-btns-group.fr-btns-group--inline
|
||||||
|
- if @procedure.publiee?
|
||||||
|
%li= button_to 'Publier les modifications', admin_procedure_publish_revision_path(@procedure), class: 'fr-btn', id: 'publish-procedure-link', data: { disable_with: "Publication...", confirm: 'Êtes-vous sûr de vouloir publier les modifications ?' }, disabled: !@procedure.draft_revision.valid?, method: :put
|
||||||
|
- else
|
||||||
%li= button_to 'Publier les modifications', admin_procedure_publication_path(@procedure), class: 'fr-btn', id: 'publish-procedure-link', data: { disable_with: "Publication..." }, disabled: !@procedure.draft_revision.valid?, method: :get
|
%li= button_to 'Publier les modifications', admin_procedure_publication_path(@procedure), class: 'fr-btn', id: 'publish-procedure-link', data: { disable_with: "Publication..." }, disabled: !@procedure.draft_revision.valid?, method: :get
|
||||||
%li= button_to "Réinitialiser les modifications", admin_procedure_reset_draft_path(@procedure), class: 'fr-btn fr-btn--secondary fr-mr-2w', data: { confirm: 'Êtes-vous sûr de vouloir réinitialiser les modifications ?' }, method: :put
|
%li= button_to "Réinitialiser les modifications", admin_procedure_reset_draft_path(@procedure), class: 'fr-btn fr-btn--secondary fr-mr-2w', data: { confirm: 'Êtes-vous sûr de vouloir réinitialiser les modifications ?' }, method: :put
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,9 @@ en:
|
||||||
other: "%{count} files « instructing » on this procedure version."
|
other: "%{count} files « instructing » on this procedure version."
|
||||||
publication:
|
publication:
|
||||||
publish_title: Publish your procedure
|
publish_title: Publish your procedure
|
||||||
|
confirmation: Your procedure is now published !
|
||||||
|
copy_url: Copy procedure URL
|
||||||
|
share_link: "To share your procedure, always use the full link below:"
|
||||||
closed_procedure_html: "This procedure is <strong>closed</strong> and is therefore no longer accessible to the public. You can publish it back"
|
closed_procedure_html: "This procedure is <strong>closed</strong> and is therefore no longer accessible to the public. You can publish it back"
|
||||||
draft_changed_procedure_html: "This procedure is already <strong>published</strong>. It has been <strong>edited</strong> since publication. You can publish the changes made in a new version."
|
draft_changed_procedure_html: "This procedure is already <strong>published</strong>. It has been <strong>edited</strong> since publication. You can publish the changes made in a new version."
|
||||||
published_procedure_html: "This procedure is <strong>published</strong>, some elements can no longer be modified. To access it you can use the link:"
|
published_procedure_html: "This procedure is <strong>published</strong>, some elements can no longer be modified. To access it you can use the link:"
|
||||||
|
@ -34,6 +37,7 @@ en:
|
||||||
dubious_fields: "Please note that some fields cannot be requested by the administration. Here are the fields that look suspicious to us:"
|
dubious_fields: "Please note that some fields cannot be requested by the administration. Here are the fields that look suspicious to us:"
|
||||||
click_here: Click here
|
click_here: Click here
|
||||||
back_to_procedure: Return to the procedure page
|
back_to_procedure: Return to the procedure page
|
||||||
|
new_procedure: Create a new procedure
|
||||||
publication_form:
|
publication_form:
|
||||||
faq_test_alert: Have you thought about testing your procedure before publishing it? To help you in this test phase, you can
|
faq_test_alert: Have you thought about testing your procedure before publishing it? To help you in this test phase, you can
|
||||||
faq_test_alert_link: consult our best practices guide.
|
faq_test_alert_link: consult our best practices guide.
|
||||||
|
|
|
@ -22,6 +22,9 @@ fr:
|
||||||
other: Il y a %{count} dossiers « en instruction » sur cette version de la démarche.
|
other: Il y a %{count} dossiers « en instruction » sur cette version de la démarche.
|
||||||
publication:
|
publication:
|
||||||
publish_title: Publier votre démarche
|
publish_title: Publier votre démarche
|
||||||
|
confirmation: Votre démarche est désormais publiée !
|
||||||
|
copy_url: Copiez le lien de la procédure
|
||||||
|
share_link: "Pour partager votre démarche, utilisez toujours le lien complet ci-dessous :"
|
||||||
closed_procedure_html: "Cette démarche est <strong>close</strong> et n’est donc plus accessible par le public. Vous pouvez la réactiver :"
|
closed_procedure_html: "Cette démarche est <strong>close</strong> et n’est donc plus accessible par le public. Vous pouvez la réactiver :"
|
||||||
draft_changed_procedure_html: "Cette démarche est déjà <strong>publiée</strong>. Elle a été <strong>modifiée</strong> depuis sa publication. Vous pouvez publier les changements effectués dans une nouvelle version de cette démarche :"
|
draft_changed_procedure_html: "Cette démarche est déjà <strong>publiée</strong>. Elle a été <strong>modifiée</strong> depuis sa publication. Vous pouvez publier les changements effectués dans une nouvelle version de cette démarche :"
|
||||||
published_procedure_html: "Cette démarche est <strong>publiée</strong>, certains éléments ne peuvent plus être modifiés. Pour y accéder vous pouvez utiliser le lien :"
|
published_procedure_html: "Cette démarche est <strong>publiée</strong>, certains éléments ne peuvent plus être modifiés. Pour y accéder vous pouvez utiliser le lien :"
|
||||||
|
@ -34,6 +37,7 @@ fr:
|
||||||
dubious_fields: "Attention, certains champs ne peuvent être demandés par l’administration. Voici les champs qui nous semblent suspects :"
|
dubious_fields: "Attention, certains champs ne peuvent être demandés par l’administration. Voici les champs qui nous semblent suspects :"
|
||||||
click_here: Cliquez ici.
|
click_here: Cliquez ici.
|
||||||
back_to_procedure: Revenir à la page de la démarche
|
back_to_procedure: Revenir à la page de la démarche
|
||||||
|
new_procedure: Créer une nouvelle démarche
|
||||||
publication_form:
|
publication_form:
|
||||||
faq_test_alert: Avez-vous bien pensé à tester votre démarche avant de la publier ? Pour vous aider dans cette phase de test, vous pouvez
|
faq_test_alert: Avez-vous bien pensé à tester votre démarche avant de la publier ? Pour vous aider dans cette phase de test, vous pouvez
|
||||||
faq_test_alert_link: consulter notre guide de bonnes pratiques.
|
faq_test_alert_link: consulter notre guide de bonnes pratiques.
|
||||||
|
|
|
@ -554,8 +554,10 @@ Rails.application.routes.draw do
|
||||||
get 'publication' => 'procedures#publication', as: :publication
|
get 'publication' => 'procedures#publication', as: :publication
|
||||||
put 'publish' => 'procedures#publish', as: :publish
|
put 'publish' => 'procedures#publish', as: :publish
|
||||||
put 'reset_draft' => 'procedures#reset_draft', as: :reset_draft
|
put 'reset_draft' => 'procedures#reset_draft', as: :reset_draft
|
||||||
|
put 'publish_revision' => 'procedures#publish_revision', as: :publish_revision
|
||||||
get 'transfert' => 'procedures#transfert', as: :transfert
|
get 'transfert' => 'procedures#transfert', as: :transfert
|
||||||
get 'close' => 'procedures#close', as: :close
|
get 'close' => 'procedures#close', as: :close
|
||||||
|
get 'confirmation' => 'procedures#confirmation', as: :confirmation
|
||||||
post 'transfer' => 'procedures#transfer', as: :transfer
|
post 'transfer' => 'procedures#transfer', as: :transfer
|
||||||
resources :mail_templates, only: [:edit, :update, :show]
|
resources :mail_templates, only: [:edit, :update, :show]
|
||||||
|
|
||||||
|
|
|
@ -965,10 +965,9 @@ describe Administrateurs::ProceduresController, type: :controller do
|
||||||
expect(procedure.lien_site_web).to eq(lien_site_web)
|
expect(procedure.lien_site_web).to eq(lien_site_web)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirects to the procedure page' do
|
it 'redirects to the confirmation page' do
|
||||||
expect(response.status).to eq 302
|
expect(response.status).to eq 302
|
||||||
expect(response.body).to include(admin_procedure_path(procedure.id))
|
expect(response.body).to include(admin_procedure_confirmation_path(procedure.id))
|
||||||
expect(flash[:notice]).to have_content 'Démarche publiée'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -992,10 +991,9 @@ describe Administrateurs::ProceduresController, type: :controller do
|
||||||
expect(procedure2.depubliee?).to be_truthy
|
expect(procedure2.depubliee?).to be_truthy
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirects to the procedures page' do
|
it 'redirects to the confirmation page' do
|
||||||
expect(response.status).to eq 302
|
expect(response.status).to eq 302
|
||||||
expect(response.body).to include(admin_procedure_path(procedure.id))
|
expect(response.body).to include(admin_procedure_confirmation_path(procedure.id))
|
||||||
expect(flash[:notice]).to have_content 'Démarche publiée'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ describe 'As an administrateur, I want to manage the procedure’s attestation',
|
||||||
click_on("Publier")
|
click_on("Publier")
|
||||||
# validate publication
|
# validate publication
|
||||||
within('form') { click_on 'Publier' }
|
within('form') { click_on 'Publier' }
|
||||||
|
click_on("Revenir à la page de la démarche")
|
||||||
|
|
||||||
# now process to disable attestation
|
# now process to disable attestation
|
||||||
find_attestation_card.click
|
find_attestation_card.click
|
||||||
|
|
|
@ -43,7 +43,8 @@ describe 'Publishing a procedure', js: true, retry: 3 do
|
||||||
fill_in 'lien_site_web', with: 'http://some.website'
|
fill_in 'lien_site_web', with: 'http://some.website'
|
||||||
within('form') { click_on 'Publier' }
|
within('form') { click_on 'Publier' }
|
||||||
|
|
||||||
expect(page).to have_text('Démarche publiée')
|
expect(page).to have_text('Votre démarche est désormais publiée !')
|
||||||
|
expect(page).to have_button(title: 'Copiez le lien de la procédure')
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the procedure has invalid champs' do
|
context 'when the procedure has invalid champs' do
|
||||||
|
@ -91,7 +92,7 @@ describe 'Publishing a procedure', js: true, retry: 3 do
|
||||||
fill_in 'lien_site_web', with: 'http://some.website'
|
fill_in 'lien_site_web', with: 'http://some.website'
|
||||||
click_on 'publish'
|
click_on 'publish'
|
||||||
|
|
||||||
expect(page).to have_text('Démarche publiée')
|
expect(page).to have_text('Votre démarche est désormais publiée !')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -122,7 +123,7 @@ describe 'Publishing a procedure', js: true, retry: 3 do
|
||||||
fill_in 'lien_site_web', with: 'http://some.website'
|
fill_in 'lien_site_web', with: 'http://some.website'
|
||||||
find('#publish').click
|
find('#publish').click
|
||||||
|
|
||||||
expect(page).to have_text('Démarche publiée')
|
expect(page).to have_text('Votre démarche est désormais publiée !')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ describe 'fetch API Particulier Data', js: true, retry: 3 do
|
||||||
fill_in 'lien_site_web', with: 'http://some.website'
|
fill_in 'lien_site_web', with: 'http://some.website'
|
||||||
within('form') { click_on 'Publier' }
|
within('form') { click_on 'Publier' }
|
||||||
|
|
||||||
expect(page).to have_text('Démarche publiée')
|
expect(page).to have_text('Votre démarche est désormais publiée !')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -254,7 +254,7 @@ describe 'The routing with rules', js: true, retry: 3 do
|
||||||
fill_in 'lien_site_web', with: 'http://some.website'
|
fill_in 'lien_site_web', with: 'http://some.website'
|
||||||
within('form') { click_on 'Publier' }
|
within('form') { click_on 'Publier' }
|
||||||
|
|
||||||
expect(page).to have_text('Démarche publiée')
|
expect(page).to have_text('Votre démarche est désormais publiée !')
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_send_dossier(user, groupe)
|
def user_send_dossier(user, groupe)
|
||||||
|
|
Loading…
Reference in a new issue