-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[admin] Ajout d'une page de confirmation après la publication d'une procédure - mise en avant de l'URL à partager #9672
Merged
lisa-durand
merged 2 commits into
main
from
add-confirmation-page-for-procedure-publication-ldu
Nov 16, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ class ProceduresController < AdministrateurController | |
layout 'all', only: [:all, :administrateurs] | ||
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] | ||
after_action :reset_procedure, only: [:update] | ||
|
||
|
@@ -277,18 +277,10 @@ def publication | |
def publish | ||
@procedure.assign_attributes(publish_params) | ||
|
||
@procedure.publish_or_reopen!(current_administrateur) | ||
|
||
if @procedure.draft_changed? | ||
if @procedure.close? | ||
if @procedure.publish_or_reopen!(current_administrateur) | ||
@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" | ||
@procedure.publish_revision! | ||
end | ||
|
||
if params[:old_procedure].present? && @procedure.errors.empty? | ||
|
@@ -300,7 +292,7 @@ def publish | |
.update!(replaced_by_procedure: @procedure) | ||
end | ||
|
||
redirect_to admin_procedure_path(@procedure) | ||
redirect_to admin_procedure_confirmation_path(@procedure) | ||
rescue ActiveRecord::RecordInvalid | ||
flash.alert = @procedure.errors.full_messages | ||
redirect_to admin_procedure_publication_path(@procedure) | ||
|
@@ -312,12 +304,22 @@ def reset_draft | |
redirect_to admin_procedure_path(@procedure) | ||
end | ||
|
||
def publish_revision | ||
@procedure.publish_revision! | ||
flash.notice = "Nouvelle version de la démarche publiée" | ||
|
||
redirect_to admin_procedure_path(@procedure) | ||
end | ||
|
||
def transfert | ||
end | ||
|
||
def close | ||
end | ||
|
||
def confirmation | ||
end | ||
|
||
def allow_expert_review | ||
@procedure.update!(allow_expert_review: [email protected]_expert_review) | ||
flash.notice = @procedure.allow_expert_review? ? "Avis externes activés" : "Avis externes désactivés" | ||
|
23 changes: 23 additions & 0 deletions
23
app/views/administrateurs/procedures/confirmation.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,10 @@ | |
|
||
- c.bottom do | ||
%ul.fr-mt-2w.fr-btns-group.fr-btns-group--inline | ||
%li= button_to 'Publier les modifications', admin_procedure_publication_path(@procedure), class: 'fr-btn', id: 'publish-procedure-link', data: { disable_with: "Publication..." }, disabled: [email protected]_revision.valid?, method: :get | ||
- 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: [email protected]_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: [email protected]_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 | ||
|
||
- if [email protected]_expires_when_termine_enabled? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T'y es pour rien car ça vient du nommage des méthodes à cause du cas du reopen mais c'est un peu bizarre/pas intuitif d'avoir d'abord
publish_or_reopen
puispublish_revision
si on a modifié le brouillon