From 497f898e1bb8d9b2c05cc4f40dc7be89645894a7 Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Wed, 19 Jul 2017 11:08:53 +0200 Subject: [PATCH] NewDesign: add dossier messagerie show --- .../new_design/dossier_messagerie.scss | 23 +++++++++++++++++++ .../new_gestionnaire/dossiers_controller.rb | 4 ++++ .../dossiers/_commentaire_issuer.html.haml | 7 ++++++ .../dossiers/messagerie.html.haml | 11 +++++++++ config/routes.rb | 1 + 5 files changed, 46 insertions(+) create mode 100644 app/assets/stylesheets/new_design/dossier_messagerie.scss create mode 100644 app/views/new_gestionnaire/dossiers/_commentaire_issuer.html.haml create mode 100644 app/views/new_gestionnaire/dossiers/messagerie.html.haml diff --git a/app/assets/stylesheets/new_design/dossier_messagerie.scss b/app/assets/stylesheets/new_design/dossier_messagerie.scss new file mode 100644 index 000000000..28e1aa9ac --- /dev/null +++ b/app/assets/stylesheets/new_design/dossier_messagerie.scss @@ -0,0 +1,23 @@ +@import "colors"; +@import "common"; +@import "constants"; + +#dossier-messagerie { + li { + margin-bottom: 2 * $default-padding; + } + + h2 { + margin-bottom: $default-spacer; + } + + .mail { + font-weight: bold; + } + + .date { + font-size: 12px; + color: $grey; + float: right; + } +} diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/new_gestionnaire/dossiers_controller.rb index 9a8631f28..8f9e1e05c 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -8,6 +8,10 @@ module NewGestionnaire @dossier = dossier end + def messagerie + @dossier = dossier + end + def follow current_gestionnaire.follow(dossier) dossier.next_step!('gestionnaire', 'follow') diff --git a/app/views/new_gestionnaire/dossiers/_commentaire_issuer.html.haml b/app/views/new_gestionnaire/dossiers/_commentaire_issuer.html.haml new file mode 100644 index 000000000..4704526d7 --- /dev/null +++ b/app/views/new_gestionnaire/dossiers/_commentaire_issuer.html.haml @@ -0,0 +1,7 @@ +- case commentaire.email +- when current_gestionnaire.email + Vous +- when 'contact@tps.apientreprise.fr' + Mail automatique +- else + commentaire.email diff --git a/app/views/new_gestionnaire/dossiers/messagerie.html.haml b/app/views/new_gestionnaire/dossiers/messagerie.html.haml new file mode 100644 index 000000000..56f59ad73 --- /dev/null +++ b/app/views/new_gestionnaire/dossiers/messagerie.html.haml @@ -0,0 +1,11 @@ += render partial: "header", locals: { dossier: @dossier } + +#dossier-messagerie.container + %ul + - @dossier.commentaires.each do |commentaire| + %li + %h2 + %span.mail + = render partial: 'commentaire_issuer', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire } + %span.date= I18n.l(commentaire.created_at.localtime, format: '%d/%m/%y') + %p= sanitize(commentaire.body) diff --git a/config/routes.rb b/config/routes.rb index ab2e727df..d13051e55 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -242,6 +242,7 @@ Rails.application.routes.draw do resources :dossiers, only: [:show], param: :dossier_id do member do get 'attestation' + get 'messagerie' patch 'follow' patch 'unfollow' patch 'archive'