diff --git a/app/components/types_de_champ_editor/estimated_fill_duration_component/estimated_fill_duration_component.html.haml b/app/components/types_de_champ_editor/estimated_fill_duration_component/estimated_fill_duration_component.html.haml index 69e21b589..70986ffa5 100644 --- a/app/components/types_de_champ_editor/estimated_fill_duration_component/estimated_fill_duration_component.html.haml +++ b/app/components/types_de_champ_editor/estimated_fill_duration_component/estimated_fill_duration_component.html.haml @@ -1,4 +1,4 @@ -%span.fill-duration{ id: dom_id(@revision, :estimated_fill_duration) } +%span.fr-text--sm.fill-duration{ id: dom_id(@revision, :estimated_fill_duration) } - if show? = t('.estimated_fill_duration') = link_to "#{DOC_URL}/tutoriels/tutoriel-administrateur#g.-estimation-de-la-duree-de-remplissage", target: "_blank", rel: "noopener noreferrer" do diff --git a/app/views/administrateurs/_autosave_notice.html.haml b/app/views/administrateurs/_autosave_notice.html.haml new file mode 100644 index 000000000..698657790 --- /dev/null +++ b/app/views/administrateurs/_autosave_notice.html.haml @@ -0,0 +1 @@ +#autosave-notice.fr-badge.fr-badge--sm.fr-badge--success= t(".form_saved") diff --git a/app/views/administrateurs/procedures/champs.html.haml b/app/views/administrateurs/procedures/champs.html.haml index 45551bab6..007577781 100644 --- a/app/views/administrateurs/procedures/champs.html.haml +++ b/app/views/administrateurs/procedures/champs.html.haml @@ -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) diff --git a/app/views/administrateurs/types_de_champ/_insert.turbo_stream.haml b/app/views/administrateurs/types_de_champ/_insert.turbo_stream.haml index 758d5482a..85407ef6d 100644 --- a/app/views/administrateurs/types_de_champ/_insert.turbo_stream.haml +++ b/app/views/administrateurs/types_de_champ/_insert.turbo_stream.haml @@ -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) diff --git a/config/locales/views/administrateurs/procedures/en.yml b/config/locales/views/administrateurs/procedures/en.yml index 8707500cf..612330cd0 100644 --- a/config/locales/views/administrateurs/procedures/en.yml +++ b/config/locales/views/administrateurs/procedures/en.yml @@ -47,3 +47,5 @@ en: dpd_part_4: How to do ? You can either send him the link to the procedure on test stage by email, or name him "administrator". In any case, publish your approach only after having had his opinion. back_to_procedure: 'Cancel and return to the procedure page' submit: Publish + autosave_notice: + form_saved: "Form saved" diff --git a/config/locales/views/administrateurs/procedures/fr.yml b/config/locales/views/administrateurs/procedures/fr.yml index 8ba995ca2..4431cba0f 100644 --- a/config/locales/views/administrateurs/procedures/fr.yml +++ b/config/locales/views/administrateurs/procedures/fr.yml @@ -47,3 +47,5 @@ fr: dpd_part_4: Comment faire ? Vous pouvez soit lui communiquer par email le lien vers la démarche en test, ou bien le nommer « administrateur ». Dans tous les cas, ne publiez votre démarche qu’après avoir eu son avis. back_to_procedure: 'Annuler et revenir à la page de la démarche' submit: Publier + autosave_notice: + form_saved: "Formulaire enregistré" diff --git a/spec/support/system_helpers.rb b/spec/support/system_helpers.rb index c8035ab72..1e4c26d95 100644 --- a/spec/support/system_helpers.rb +++ b/spec/support/system_helpers.rb @@ -78,6 +78,7 @@ module SystemHelpers expect(page).to have_button('Ajouter un champ', disabled: false) expect(page).to have_content('Formulaire enregistré') execute_script("document.querySelector('#flash_message').remove();") + execute_script("document.querySelector('#autosave-notice').remove();") end def blur