add autosave feedback when admin updates form

This commit is contained in:
Christophe Robillard 2023-11-15 12:14:12 +01:00
parent bacd8ab6f7
commit 2c6a9e7bf2
7 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1 @@
#autosave-notice.fr-badge.fr-badge--sm.fr-badge--success= t(".form_saved")

View file

@ -19,4 +19,5 @@
%li
= link_to t('preview', scope: [:layouts, :breadcrumb]), apercu_admin_procedure_path(@procedure), target: "_blank", rel: "noopener", class: 'fr-btn fr-btn--secondary'
.fr-ml-auto
#autosave-notice.hidden
= render TypesDeChampEditor::EstimatedFillDurationComponent.new(revision: @procedure.draft_revision, is_annotation: false)

View file

@ -6,6 +6,11 @@
= turbo_stream.replace 'errors-summary', render(TypesDeChampEditor::ErrorsSummary.new(revision: @procedure.draft_revision))
- unless flash.alert
= turbo_stream.show 'autosave-notice'
= turbo_stream.replace 'autosave-notice', render(partial: 'administrateurs/autosave_notice')
= turbo_stream.hide 'autosave-notice', delay: 30000
- if @destroyed.present?
= turbo_stream.remove dom_id(@destroyed, :type_de_champ_editor)