diff --git a/app/views/administrateurs/procedures/_unpublished_changes_sticky_header.html.haml b/app/views/administrateurs/procedures/_unpublished_changes_sticky_header.html.haml index 12c0cce0ace..af2ec32b4eb 100644 --- a/app/views/administrateurs/procedures/_unpublished_changes_sticky_header.html.haml +++ b/app/views/administrateurs/procedures/_unpublished_changes_sticky_header.html.haml @@ -6,4 +6,5 @@ = 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: :put, data: { disable_with: "Publication...", confirm: 'Êtes-vous sûr de vouloir publier les modifications ?' } + = 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') diff --git a/spec/system/administrateurs/types_de_champ_spec.rb b/spec/system/administrateurs/types_de_champ_spec.rb index 91d09dbd561..e2852ac847a 100644 --- a/spec/system/administrateurs/types_de_champ_spec.rb +++ b/spec/system/administrateurs/types_de_champ_spec.rb @@ -379,6 +379,8 @@ 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') @@ -386,6 +388,7 @@ 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) # Supprime dernier champ all('.fr-btn--tertiary-no-outline[title="Supprimer le champ"]').last.click