Merge pull request #10707 from colinux/fix-unpublished-changes-button
ETQ admin: corrige le nouveau bouton de publication d'une démarche
This commit is contained in:
commit
3796210928
7 changed files with 25 additions and 24 deletions
|
@ -1,9 +0,0 @@
|
|||
.sticky-header.sticky-header-warning
|
||||
.fr-container
|
||||
%p.flex.justify-between.align-center.fr-text-default--warning
|
||||
%span
|
||||
= dsfr_icon("fr-icon-warning-fill fr-mr-1v")
|
||||
= t('.intro_html').html_safe
|
||||
%span.no-wrap
|
||||
= link_to t('.see_changes'), admin_procedure_path(procedure), class: 'fr-btn fr-btn--secondary fr-mr-2w'
|
||||
= link_to t('.publish_changes'), admin_procedure_publish_revision_path(procedure), class: 'fr-btn', method: :post, data: { disable_with: "Publication...", confirm: 'Êtes-vous sûr de vouloir publier les modifications ?' }
|
|
@ -0,0 +1,10 @@
|
|||
.sticky-header.sticky-header-warning
|
||||
.fr-container
|
||||
%p.flex.justify-between.align-center.fr-text-default--warning
|
||||
%span
|
||||
= dsfr_icon("fr-icon-warning-fill fr-mr-1v")
|
||||
= t('.intro_html').html_safe
|
||||
%span.no-wrap
|
||||
= link_to t('.see_changes'), admin_procedure_path(procedure), class: 'fr-btn fr-btn--secondary fr-mr-2w'
|
||||
= link_to_if procedure.draft_revision.valid? && procedure.valid?(:publication), t('.publish_changes'), admin_procedure_publish_revision_path(procedure), class: 'fr-btn', method: :put, data: { disable_with: "Publication...", confirm: 'Êtes-vous sûr de vouloir publier les modifications ?' } do
|
||||
%button.fr-btn{ disabled: "disabled" }= t('.publish_changes')
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
- if @procedure.draft_changed?
|
||||
- content_for(:sticky_header) do
|
||||
= render partial: 'administrateurs/procedures/unpublished_changes_navbar', locals: { procedure: @procedure }
|
||||
= render partial: 'administrateurs/procedures/unpublished_changes_sticky_header', locals: { procedure: @procedure }
|
||||
= render partial: 'administrateurs/breadcrumbs',
|
||||
locals: { steps: [['Démarches', admin_procedures_back_path(@procedure)],
|
||||
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
- if @procedure.draft_changed?
|
||||
= turbo_stream.update "sticky-header" do
|
||||
= render partial: "administrateurs/procedures/unpublished_changes_navbar", locals: { procedure: @procedure }
|
||||
= render partial: "administrateurs/procedures/unpublished_changes_sticky_header", locals: { procedure: @procedure }
|
||||
|
||||
- else
|
||||
= turbo_stream.update "sticky-header", ""
|
||||
|
|
|
@ -71,7 +71,7 @@ en:
|
|||
path_not_available:
|
||||
owner: This URL is identical to another of your published procedures. If you publish this procedure, the old one will be unpublished and will no longer be accessible to the public.
|
||||
not_owner: This URL is identical to another procedure, you must modify it.
|
||||
unpublished_changes_navbar:
|
||||
unpublished_changes_sticky_header:
|
||||
intro_html: Changes made will only be visible <strong>after the next publication</strong>
|
||||
see_changes: View changes
|
||||
publish_changes: Publish changes
|
||||
|
|
|
@ -71,7 +71,7 @@ fr:
|
|||
path_not_available:
|
||||
owner: Cette url est identique à celle d’une autre de vos démarches publiées. Si vous publiez cette démarche, l’ancienne sera dépubliée et ne sera plus accessible au public.
|
||||
not_owner: Cette url est identique à celle d’une autre démarche, vous devez la modifier afin de pouvoir publier votre démarche.
|
||||
unpublished_changes_navbar:
|
||||
unpublished_changes_sticky_header:
|
||||
intro_html: Les modifications effectuées ne seront visibles <strong>qu'à la prochaine publication</strong>
|
||||
see_changes: Voir les modifications
|
||||
publish_changes: Publier les modifications
|
||||
|
|
|
@ -368,6 +368,7 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
fill_in 'Libellé du champ', with: 'Premier champ'
|
||||
expect(page).to have_selector('.sticky-header.sticky-header-warning')
|
||||
expect(page).to have_content("Les modifications effectuées ne seront visibles qu'à la prochaine publication")
|
||||
expect(page).to have_link('Publier les modifications')
|
||||
|
||||
expect(page).to have_field('Libellé du champ', with: 'Premier champ')
|
||||
|
||||
|
@ -378,6 +379,8 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
|
||||
within all('.type-de-champ').last do
|
||||
fill_in 'Libellé du champ', with: 'Deuxième champ'
|
||||
select 'Choix simple', from: 'Type de champ'
|
||||
fill_in "Options de la liste", with: "" # make tdc invalid
|
||||
end
|
||||
|
||||
expect(page).to have_field('Libellé du champ', with: 'Premier champ')
|
||||
|
@ -385,20 +388,17 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
|
||||
expect(page).to have_selector('.sticky-header.sticky-header-warning')
|
||||
expect(page).to have_content("Les modifications effectuées ne seront visibles qu'à la prochaine publication")
|
||||
expect(page).to have_button('Publier les modifications', disabled: true)
|
||||
|
||||
# Supprimer les champs
|
||||
# Supprime dernier champ
|
||||
all('.fr-btn--tertiary-no-outline[title="Supprimer le champ"]').last.click
|
||||
page.driver.browser.switch_to.alert.accept rescue nil
|
||||
|
||||
2.times do
|
||||
initial_count = page.all('.type-de-champ').count
|
||||
expect(page).to have_selector('.type-de-champ', count: 1, wait: 5)
|
||||
click_on "Publier les modifications"
|
||||
|
||||
first('.fr-btn--tertiary-no-outline[title="Supprimer le champ"]').click
|
||||
|
||||
page.driver.browser.switch_to.alert.accept rescue nil
|
||||
|
||||
expect(page).to have_selector('.type-de-champ', count: initial_count - 1, wait: 5)
|
||||
end
|
||||
|
||||
expect(page).not_to have_selector('.sticky-header.sticky-header-warning')
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
expect(page).to have_content("démarche publiée")
|
||||
|
||||
unpublished_procedure = create(:procedure)
|
||||
visit champs_admin_procedure_path(unpublished_procedure)
|
||||
|
|
Loading…
Reference in a new issue