Skip to content

Commit

Permalink
[Fix #1016] display notifications for annotations privées
Browse files Browse the repository at this point in the history
  • Loading branch information
mmagn committed Dec 7, 2017
1 parent b50820d commit 52591ac
Show file tree
Hide file tree
Showing 23 changed files with 44 additions and 24 deletions.
14 changes: 12 additions & 2 deletions app/assets/stylesheets/new_design/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
margin-bottom: 20px;
}

@mixin notice-text-style {
font-size: 14px;
color: $grey;
}

label {
margin-bottom: $default-padding;
display: block;
Expand All @@ -16,13 +21,18 @@
}

.notice {
font-size: 14px;
@include notice-text-style;
display: block;
margin-top: $default-spacer;
color: $grey;
}
}

.notice-inline {
@include notice-text-style;
display: inline-block;
margin-left: $default-spacer;
}

.radios {
label {
display: inline;
Expand Down
9 changes: 7 additions & 2 deletions app/controllers/new_gestionnaire/dossiers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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)
@follow = current_gestionnaire.follows.find_by(dossier: dossier)
end

def avis
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
= 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 }
locals: { champ: champ, form: champ_form, seen_at: @follow&.annotations_privees_seen_at }

.send-wrapper
= f.submit 'Sauvegarder', class: 'button send', data: { disable_with: "Envoi..." }
Expand Down
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
#{champ.libelle}
- if champ.mandatory
%span.mandatory *

- if @follow&.annotations_privees_seen_at&.< champ.updated_at
%span.notice-inline.highlighted
= "modifié le #{champ.updated_at.strftime('%d/%m/%Y à %H:%M')}"

- if champ.description.present?
%span.notice= champ.description
Original file line number Diff line number Diff line change
@@ -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 },
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/new_gestionnaire/dossiers/champs/_date.html.haml
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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?
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 },
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion app/views/new_gestionnaire/dossiers/champs/_pays.html.haml
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion app/views/new_gestionnaire/dossiers/champs/_text.html.haml
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/root/patron.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
= 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 }
locals: { champ: champ, form: champ_form, seen_at: nil }

%input{ type: "password", value: "12345678" }
.send-wrapper
Expand Down

0 comments on commit 52591ac

Please sign in to comment.