diff --git a/app/assets/stylesheets/new_design/forms.scss b/app/assets/stylesheets/new_design/forms.scss index b5f428c2e7a..24a69a8b5f8 100644 --- a/app/assets/stylesheets/new_design/forms.scss +++ b/app/assets/stylesheets/new_design/forms.scss @@ -7,6 +7,11 @@ margin-bottom: 20px; } + @mixin notice-text-style { + font-size: 14px; + color: $grey; + } + label { margin-bottom: $default-padding; display: block; @@ -16,10 +21,24 @@ } .notice { - font-size: 14px; + @include notice-text-style; display: block; margin-top: $default-spacer; - color: $grey; + } + } + + .champ { + .updated-at { + @include notice-text-style; + float:right; + display: inline-block; + margin-left: $default-spacer; + visibility: hidden; + } + + &:hover .updated-at, + .updated-at.highlighted { + visibility: visible; } } diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/new_gestionnaire/dossiers_controller.rb index 7f350007f93..6f78b3bffc4 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -6,6 +6,7 @@ class DossiersController < ProceduresController after_action :mark_demande_as_read, only: :show after_action :mark_messagerie_as_read, only: [:messagerie, :create_commentaire] after_action :mark_avis_as_read, only: [:avis, :create_avis] + after_action :mark_annotations_privees_as_read, only: [:annotations_privees, :update_annotations] def attestation send_data(dossier.attestation.pdf.read, filename: 'attestation.pdf', type: 'application/pdf') @@ -21,8 +22,7 @@ def messagerie end def annotations_privees - dossier.notifications.annotations_privees.mark_as_read - current_gestionnaire.mark_tab_as_seen(dossier, :annotations_privees) + @annotations_privees_seen_at = current_gestionnaire.follows.find_by(dossier: dossier)&.annotations_privees_seen_at end def avis @@ -208,5 +208,10 @@ def mark_avis_as_read dossier.notifications.avis.mark_as_read current_gestionnaire.mark_tab_as_seen(dossier, :avis) end + + def mark_annotations_privees_as_read + dossier.notifications.annotations_privees.mark_as_read + current_gestionnaire.mark_tab_as_seen(dossier, :annotations_privees) + end end end diff --git a/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml b/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml index 42193d67f93..5fc446f2312 100644 --- a/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml +++ b/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml @@ -10,8 +10,8 @@ = form_for @dossier, url: annotations_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f| = f.fields_for :champs_private, f.object.ordered_champs_private do |champ_form| - champ = champ_form.object - = render partial: "new_gestionnaire/dossiers/champs/#{champ.type_champ}", - locals: { champ: champ, form: champ_form } + = render partial: "new_gestionnaire/dossiers/champs/champ", + locals: { champ: champ, form: champ_form, seen_at: @annotations_privees_seen_at } .send-wrapper = f.submit 'Sauvegarder', class: 'button send', data: { disable_with: "Envoi..." } diff --git a/app/views/new_gestionnaire/dossiers/champs/_address.html.haml b/app/views/new_gestionnaire/dossiers/champs/_address.html.haml index c0707410f62..e4ed08e335b 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_address.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_address.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } = form.text_field :value, 'data-address': 'true', diff --git a/app/views/new_gestionnaire/dossiers/champs/_champ.html.haml b/app/views/new_gestionnaire/dossiers/champs/_champ.html.haml new file mode 100644 index 00000000000..e852d167422 --- /dev/null +++ b/app/views/new_gestionnaire/dossiers/champs/_champ.html.haml @@ -0,0 +1,3 @@ +.champ + = render partial: "new_gestionnaire/dossiers/champs/#{champ.type_champ}", + locals: { champ: champ, form: form, seen_at: seen_at } diff --git a/app/views/new_gestionnaire/dossiers/champs/_champ_label.html.haml b/app/views/new_gestionnaire/dossiers/champs/_champ_label.html.haml index 000439a3a42..a75334b35d5 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_champ_label.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_champ_label.html.haml @@ -2,5 +2,10 @@ #{champ.libelle} - if champ.mandatory %span.mandatory * + + - if champ.updated_at.present? + %span.updated-at{ class: highlight_if_unseen_class(seen_at, champ.updated_at) } + = "modifié le #{champ.updated_at.strftime('%d/%m/%Y à %H:%M')}" + - if champ.description.present? %span.notice= champ.description diff --git a/app/views/new_gestionnaire/dossiers/champs/_checkbox.html.haml b/app/views/new_gestionnaire/dossiers/champs/_checkbox.html.haml index 2668405bac5..882404c2ee9 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_checkbox.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_checkbox.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } = form.check_box :value, { required: champ.mandatory }, diff --git a/app/views/new_gestionnaire/dossiers/champs/_civilite.html.haml b/app/views/new_gestionnaire/dossiers/champs/_civilite.html.haml index b968388f696..456af953e3f 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_civilite.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_civilite.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } .radios %label diff --git a/app/views/new_gestionnaire/dossiers/champs/_date.html.haml b/app/views/new_gestionnaire/dossiers/champs/_date.html.haml index 5bdd4ad45fb..86b27120a14 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_date.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_date.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } = form.date_field :value, value: champ.value, diff --git a/app/views/new_gestionnaire/dossiers/champs/_datetime.html.haml b/app/views/new_gestionnaire/dossiers/champs/_datetime.html.haml index 4dabb670585..e6a92ecebaf 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_datetime.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_datetime.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } - parsed_value = champ.value.present? ? DateTime.parse(champ.value) : DateTime.now diff --git a/app/views/new_gestionnaire/dossiers/champs/_departements.html.haml b/app/views/new_gestionnaire/dossiers/champs/_departements.html.haml index c16358e58b7..bd1bf253de8 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_departements.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_departements.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } = form.select :value, Champ.departements, diff --git a/app/views/new_gestionnaire/dossiers/champs/_dossier_link.html.haml b/app/views/new_gestionnaire/dossiers/champs/_dossier_link.html.haml index 54c9d9b126c..cbf2dea64ae 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_dossier_link.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_dossier_link.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } - dossier = Dossier.find_by(id: champ.value) - show_text_summary = dossier.present? diff --git a/app/views/new_gestionnaire/dossiers/champs/_drop_down_list.html.haml b/app/views/new_gestionnaire/dossiers/champs/_drop_down_list.html.haml index ee46b4b2641..2f36bceb869 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_drop_down_list.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_drop_down_list.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } - if champ.drop_down_list && champ.drop_down_list.options.any? = form.select :value, diff --git a/app/views/new_gestionnaire/dossiers/champs/_email.html.haml b/app/views/new_gestionnaire/dossiers/champs/_email.html.haml index c9819de8829..f065cb6caef 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_email.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_email.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } = form.email_field :value, placeholder: champ.libelle, diff --git a/app/views/new_gestionnaire/dossiers/champs/_engagement.html.haml b/app/views/new_gestionnaire/dossiers/champs/_engagement.html.haml index 2668405bac5..882404c2ee9 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_engagement.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_engagement.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } = form.check_box :value, { required: champ.mandatory }, diff --git a/app/views/new_gestionnaire/dossiers/champs/_multiple_drop_down_list.html.haml b/app/views/new_gestionnaire/dossiers/champs/_multiple_drop_down_list.html.haml index 5f0fb94393a..cc8617eafae 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_multiple_drop_down_list.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_multiple_drop_down_list.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } - if champ.drop_down_list && champ.drop_down_list.options.any? = form.select :value, diff --git a/app/views/new_gestionnaire/dossiers/champs/_number.html.haml b/app/views/new_gestionnaire/dossiers/champs/_number.html.haml index c9bcb8eae63..f020980b91c 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_number.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_number.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } = form.number_field :value, placeholder: champ.libelle, diff --git a/app/views/new_gestionnaire/dossiers/champs/_pays.html.haml b/app/views/new_gestionnaire/dossiers/champs/_pays.html.haml index cad18df074d..f52c146e996 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_pays.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_pays.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } = form.select :value, Champ.pays, diff --git a/app/views/new_gestionnaire/dossiers/champs/_phone.html.haml b/app/views/new_gestionnaire/dossiers/champs/_phone.html.haml index e42dbfad13c..7888eff8c0d 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_phone.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_phone.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } = form.phone_field :value, placeholder: champ.libelle, diff --git a/app/views/new_gestionnaire/dossiers/champs/_regions.html.haml b/app/views/new_gestionnaire/dossiers/champs/_regions.html.haml index eb9ffaf8d1b..5946d812c56 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_regions.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_regions.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } = form.select :value, Champ.regions, diff --git a/app/views/new_gestionnaire/dossiers/champs/_text.html.haml b/app/views/new_gestionnaire/dossiers/champs/_text.html.haml index 2e34ffa6c43..bef083c2ff3 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_text.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_text.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } = form.text_field :value, placeholder: champ.libelle, diff --git a/app/views/new_gestionnaire/dossiers/champs/_textarea.html.haml b/app/views/new_gestionnaire/dossiers/champs/_textarea.html.haml index 5e2b2164c30..4b3b832c839 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_textarea.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_textarea.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } ~ form.text_area :value, row: 6, diff --git a/app/views/new_gestionnaire/dossiers/champs/_yes_no.html.haml b/app/views/new_gestionnaire/dossiers/champs/_yes_no.html.haml index 7893c60b8a2..9daf805484a 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_yes_no.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_yes_no.html.haml @@ -1,4 +1,4 @@ -= render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } += render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ, seen_at: seen_at } .radios %label diff --git a/app/views/root/patron.html.haml b/app/views/root/patron.html.haml index 27e3039cd5c..77288ecfcd2 100644 --- a/app/views/root/patron.html.haml +++ b/app/views/root/patron.html.haml @@ -23,8 +23,8 @@ = form_for @dossier, url: '', html: { class: 'form' } do |f| = f.fields_for :champs do |champ_form| - champ = champ_form.object - = render partial: "new_gestionnaire/dossiers/champs/#{champ.type_champ}", - locals: { champ: champ, form: champ_form } + = render partial: "new_gestionnaire/dossiers/champs/champ", + locals: { champ: champ, form: champ_form, seen_at: nil } %input{ type: "password", value: "12345678" } .send-wrapper