[Fix #1016] display notifications for annotations privées

This commit is contained in:
Mathieu Magnin 2017-12-07 14:37:34 +01:00
parent c3e7e39947
commit 7d668315db
24 changed files with 58 additions and 26 deletions

View file

@ -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;
}
}

View file

@ -6,6 +6,7 @@ module NewGestionnaire
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 @@ module NewGestionnaire
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 @@ module NewGestionnaire
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

View file

@ -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..." }

View file

@ -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',

View file

@ -0,0 +1,3 @@
.champ
= render partial: "new_gestionnaire/dossiers/champs/#{champ.type_champ}",
locals: { champ: champ, form: form, seen_at: seen_at }

View file

@ -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

View file

@ -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 },

View file

@ -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

View file

@ -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,

View file

@ -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

View file

@ -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,

View file

@ -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?

View file

@ -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,

View file

@ -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,

View file

@ -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 },

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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

View file

@ -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