From 3fa300d1b6156eeaf2b1dc27d8fdc8e5de6150a6 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Fri, 8 Sep 2017 14:52:52 +0200 Subject: [PATCH 1/5] Date format on commentaire should be 13:30 le 31/01/2017 --- app/views/new_gestionnaire/dossiers/messagerie.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/dossiers/messagerie.html.haml b/app/views/new_gestionnaire/dossiers/messagerie.html.haml index 85a3d2248..3fee708de 100644 --- a/app/views/new_gestionnaire/dossiers/messagerie.html.haml +++ b/app/views/new_gestionnaire/dossiers/messagerie.html.haml @@ -12,7 +12,7 @@ = render partial: 'commentaire_issuer', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire } - if ![current_gestionnaire.email, @dossier.user.email, 'contact@tps.apientreprise.fr'].include?(commentaire.email) %span.guest Invité - %span.date= I18n.l(commentaire.created_at.localtime, format: '%d/%m/%y') + %span.date= I18n.l(commentaire.created_at.localtime, format: '%H:%M le %d/%m/%Y') %p= sanitize(commentaire.body) = form_for(Commentaire.new, url: commentaire_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' }) do |f| From 3cbfd2709fe74968b29d93d90cc836e5bda0bd1c Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Fri, 8 Sep 2017 15:04:31 +0200 Subject: [PATCH 2/5] Add disable_with on comment creation --- app/views/new_gestionnaire/dossiers/messagerie.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/dossiers/messagerie.html.haml b/app/views/new_gestionnaire/dossiers/messagerie.html.haml index 3fee708de..32db9b20c 100644 --- a/app/views/new_gestionnaire/dossiers/messagerie.html.haml +++ b/app/views/new_gestionnaire/dossiers/messagerie.html.haml @@ -18,4 +18,4 @@ = form_for(Commentaire.new, url: commentaire_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' }) do |f| = f.text_area :body, rows: 5, placeholder: 'Répondre ici', required: true .send-wrapper - = f.submit 'Envoyer', class: 'button send' + = f.submit 'Envoyer', class: 'button send', data: { disable_with: "Envoi..." } From bdf754c0d839e4847326e99be47733f440e68d79 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Fri, 8 Sep 2017 16:54:25 +0200 Subject: [PATCH 3/5] Automatically scroll to the last message --- app/assets/javascripts/new_design/messagerie.js | 8 ++++++++ app/assets/stylesheets/new_design/messagerie.scss | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 app/assets/javascripts/new_design/messagerie.js diff --git a/app/assets/javascripts/new_design/messagerie.js b/app/assets/javascripts/new_design/messagerie.js new file mode 100644 index 000000000..1b8d1d324 --- /dev/null +++ b/app/assets/javascripts/new_design/messagerie.js @@ -0,0 +1,8 @@ +TPS.scrollMessagerie = function () { + var $ul = $(".messagerie ul").first(); + if($ul.length) { + $ul.scrollTop($ul.prop('scrollHeight')); + } +}; + +document.addEventListener("turbolinks:load", TPS.scrollMessagerie); diff --git a/app/assets/stylesheets/new_design/messagerie.scss b/app/assets/stylesheets/new_design/messagerie.scss index a9bc70038..d597ac165 100644 --- a/app/assets/stylesheets/new_design/messagerie.scss +++ b/app/assets/stylesheets/new_design/messagerie.scss @@ -3,6 +3,14 @@ @import "constants"; .messagerie { + ul { + max-height: 350px; + overflow-y: scroll; + border: 1px solid $border-grey; + padding: 2 * $default-spacer; + margin-bottom: $default-spacer; + } + li { display: flex; align-items: flex-start; From 581da1921e97c3fc3ed7f75252787b9b97ca84fa Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Fri, 8 Sep 2017 17:17:19 +0200 Subject: [PATCH 4/5] Add a flash message after comment is created --- app/controllers/new_gestionnaire/dossiers_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/new_gestionnaire/dossiers_controller.rb index cc35adbd3..99ce6f033 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -45,6 +45,7 @@ module NewGestionnaire def create_commentaire Commentaire.create(commentaire_params.merge(email: current_gestionnaire.email, dossier: dossier)) + flash.notice = "Message envoyé" redirect_to messagerie_dossier_path(dossier.procedure, dossier) end From 9c8061d5a45f869ca6d2f2e2154d111842742e3c Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 12 Sep 2017 15:27:57 +0200 Subject: [PATCH 5/5] Show pieces justificatives in messagerie --- app/assets/images/icons/attachment.svg | 1 + app/assets/stylesheets/new_design/icons.scss | 4 ++++ app/assets/stylesheets/new_design/messagerie.scss | 4 ++++ app/views/new_gestionnaire/dossiers/messagerie.html.haml | 5 +++++ app/views/root/patron.html.haml | 1 + 5 files changed, 15 insertions(+) create mode 100644 app/assets/images/icons/attachment.svg diff --git a/app/assets/images/icons/attachment.svg b/app/assets/images/icons/attachment.svg new file mode 100644 index 000000000..75d78782d --- /dev/null +++ b/app/assets/images/icons/attachment.svg @@ -0,0 +1 @@ +Shape \ No newline at end of file diff --git a/app/assets/stylesheets/new_design/icons.scss b/app/assets/stylesheets/new_design/icons.scss index a22cd9afd..fe7d8add2 100644 --- a/app/assets/stylesheets/new_design/icons.scss +++ b/app/assets/stylesheets/new_design/icons.scss @@ -48,4 +48,8 @@ i { &.bubble { background-image: image-url("icons/bubble.svg"); } + + &.attachment { + background-image: image-url("icons/attachment.svg"); + } } diff --git a/app/assets/stylesheets/new_design/messagerie.scss b/app/assets/stylesheets/new_design/messagerie.scss index d597ac165..eb5901dfe 100644 --- a/app/assets/stylesheets/new_design/messagerie.scss +++ b/app/assets/stylesheets/new_design/messagerie.scss @@ -38,4 +38,8 @@ .date { float: right; } + + .attachment-link { + margin-top: $default-spacer; + } } diff --git a/app/views/new_gestionnaire/dossiers/messagerie.html.haml b/app/views/new_gestionnaire/dossiers/messagerie.html.haml index 32db9b20c..96699c81c 100644 --- a/app/views/new_gestionnaire/dossiers/messagerie.html.haml +++ b/app/views/new_gestionnaire/dossiers/messagerie.html.haml @@ -14,6 +14,11 @@ %span.guest Invité %span.date= I18n.l(commentaire.created_at.localtime, format: '%H:%M le %d/%m/%Y') %p= sanitize(commentaire.body) + - if file = commentaire.piece_justificative + .attachment-link + = link_to file.content_url, class: "button", target: "_blank", title: "Télécharger" do + %i.attachment + = file.original_filename = form_for(Commentaire.new, url: commentaire_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' }) do |f| = f.text_area :body, rows: 5, placeholder: 'Répondre ici', required: true diff --git a/app/views/root/patron.html.haml b/app/views/root/patron.html.haml index 5d295de01..438f8de64 100644 --- a/app/views/root/patron.html.haml +++ b/app/views/root/patron.html.haml @@ -13,6 +13,7 @@ %i.edit %i.in-progress %i.bubble + %i.attachment %h1 Formulaires