From 2de480d6e921504e6467bdb7e78ca6fd04788a41 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 17 Sep 2018 12:43:21 +0000 Subject: [PATCH] dossier: show latest message only when dossier is pending --- app/views/new_user/dossiers/show.html.haml | 11 ++--------- .../new_user/dossiers/show/_latest_message.html.haml | 9 +++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 app/views/new_user/dossiers/show/_latest_message.html.haml diff --git a/app/views/new_user/dossiers/show.html.haml b/app/views/new_user/dossiers/show.html.haml index d87e4dd0c..57b944251 100644 --- a/app/views/new_user/dossiers/show.html.haml +++ b/app/views/new_user/dossiers/show.html.haml @@ -9,12 +9,5 @@ .container = render partial: 'new_user/dossiers/show/status_overview', locals: { dossier: @dossier } - - latest_message = @dossier.commentaires.last - - if latest_message.present? - .latest-message-section - %h3.tab-title Dernier message - - .message.inverted-background - = render partial: "shared/dossiers/messages/message", locals: { commentaire: latest_message, connected_user: current_user, messagerie_seen_at: nil } - - = link_to commentaire_answer_action(latest_message, current_user), messagerie_dossier_url(@dossier, anchor: 'new_commentaire'), class: 'button send' + - if !@dossier.termine? + = render partial: 'new_user/dossiers/show/latest_message', locals: { dossier: @dossier } diff --git a/app/views/new_user/dossiers/show/_latest_message.html.haml b/app/views/new_user/dossiers/show/_latest_message.html.haml new file mode 100644 index 000000000..255e79696 --- /dev/null +++ b/app/views/new_user/dossiers/show/_latest_message.html.haml @@ -0,0 +1,9 @@ +- latest_message = dossier.commentaires.last +- if latest_message.present? + .latest-message-section + %h3.tab-title Dernier message + + .message.inverted-background + = render partial: "shared/dossiers/messages/message", locals: { commentaire: latest_message, connected_user: current_user, messagerie_seen_at: nil } + + = link_to commentaire_answer_action(latest_message, current_user), messagerie_dossier_url(dossier, anchor: 'new_commentaire'), class: 'button send'