From 4e2a5f0b9bb059fb838748e11fe8d007b076cc86 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 16 Aug 2018 15:22:35 +0000 Subject: [PATCH] messagerie: move templates to a shared location --- app/views/new_gestionnaire/avis/messagerie.html.haml | 2 +- app/views/new_gestionnaire/dossiers/messagerie.html.haml | 2 +- app/views/new_gestionnaire/shared/_messagerie.html.haml | 7 ------- app/views/shared/dossiers/_messagerie.html.haml | 7 +++++++ .../shared => shared/dossiers}/messages/_form.html.haml | 0 .../shared => shared/dossiers}/messages/_message.html.haml | 4 ++-- .../dossiers}/messages/_message_icon.html.haml | 0 .../dossiers}/messages/_message_issuer.html.haml | 0 .../dossiers}/messages/message.html.haml_spec.rb | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 app/views/new_gestionnaire/shared/_messagerie.html.haml create mode 100644 app/views/shared/dossiers/_messagerie.html.haml rename app/views/{new_gestionnaire/shared => shared/dossiers}/messages/_form.html.haml (100%) rename app/views/{new_gestionnaire/shared => shared/dossiers}/messages/_message.html.haml (81%) rename app/views/{new_gestionnaire/shared => shared/dossiers}/messages/_message_icon.html.haml (100%) rename app/views/{new_gestionnaire/shared => shared/dossiers}/messages/_message_issuer.html.haml (100%) rename spec/views/{new_gestionnaire/shared => shared/dossiers}/messages/message.html.haml_spec.rb (70%) diff --git a/app/views/new_gestionnaire/avis/messagerie.html.haml b/app/views/new_gestionnaire/avis/messagerie.html.haml index 58a4acbcf..04860e9d9 100644 --- a/app/views/new_gestionnaire/avis/messagerie.html.haml +++ b/app/views/new_gestionnaire/avis/messagerie.html.haml @@ -2,4 +2,4 @@ = render partial: 'header', locals: { avis: @avis, dossier: @dossier } -= render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) } += render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) } diff --git a/app/views/new_gestionnaire/dossiers/messagerie.html.haml b/app/views/new_gestionnaire/dossiers/messagerie.html.haml index 044d9f58e..78e91c5a8 100644 --- a/app/views/new_gestionnaire/dossiers/messagerie.html.haml +++ b/app/views/new_gestionnaire/dossiers/messagerie.html.haml @@ -2,4 +2,4 @@ = render partial: "header", locals: { dossier: @dossier } -= render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) } += render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) } diff --git a/app/views/new_gestionnaire/shared/_messagerie.html.haml b/app/views/new_gestionnaire/shared/_messagerie.html.haml deleted file mode 100644 index 1b6d7776e..000000000 --- a/app/views/new_gestionnaire/shared/_messagerie.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -.messagerie.container - %ul.messages-list - - dossier.commentaires.each do |commentaire| - %li{ class: commentaire_is_from_me_class(commentaire, current_gestionnaire.email) } - = render partial: "new_gestionnaire/shared/messages/message", locals: { commentaire: commentaire, messagerie_seen_at: messagerie_seen_at } - - = render partial: "new_gestionnaire/shared/messages/form", locals: { commentaire: new_commentaire, form_url: form_url } diff --git a/app/views/shared/dossiers/_messagerie.html.haml b/app/views/shared/dossiers/_messagerie.html.haml new file mode 100644 index 000000000..1d8f00871 --- /dev/null +++ b/app/views/shared/dossiers/_messagerie.html.haml @@ -0,0 +1,7 @@ +.messagerie.container + %ul.messages-list + - dossier.commentaires.each do |commentaire| + %li{ class: commentaire_is_from_me_class(commentaire, current_gestionnaire.email) } + = render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, messagerie_seen_at: messagerie_seen_at } + + = render partial: "shared/dossiers/messages/form", locals: { commentaire: new_commentaire, form_url: form_url } diff --git a/app/views/new_gestionnaire/shared/messages/_form.html.haml b/app/views/shared/dossiers/messages/_form.html.haml similarity index 100% rename from app/views/new_gestionnaire/shared/messages/_form.html.haml rename to app/views/shared/dossiers/messages/_form.html.haml diff --git a/app/views/new_gestionnaire/shared/messages/_message.html.haml b/app/views/shared/dossiers/messages/_message.html.haml similarity index 81% rename from app/views/new_gestionnaire/shared/messages/_message.html.haml rename to app/views/shared/dossiers/messages/_message.html.haml index dd902856f..3f7f1accd 100644 --- a/app/views/new_gestionnaire/shared/messages/_message.html.haml +++ b/app/views/shared/dossiers/messages/_message.html.haml @@ -1,9 +1,9 @@ -= render partial: 'new_gestionnaire/shared/messages/message_icon', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire } += render partial: 'shared/dossiers/messages/message_icon', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire } .width-100 %h2 %span.mail - = render partial: 'new_gestionnaire/shared/messages/message_issuer', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire } + = render partial: 'shared/dossiers/messages/message_issuer', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire } - if ![current_gestionnaire.email, commentaire.dossier.user.email, OLD_CONTACT_EMAIL, CONTACT_EMAIL].include?(commentaire.email) %span.guest Invité %span.date{ class: highlight_if_unseen_class(messagerie_seen_at, commentaire.created_at) } diff --git a/app/views/new_gestionnaire/shared/messages/_message_icon.html.haml b/app/views/shared/dossiers/messages/_message_icon.html.haml similarity index 100% rename from app/views/new_gestionnaire/shared/messages/_message_icon.html.haml rename to app/views/shared/dossiers/messages/_message_icon.html.haml diff --git a/app/views/new_gestionnaire/shared/messages/_message_issuer.html.haml b/app/views/shared/dossiers/messages/_message_issuer.html.haml similarity index 100% rename from app/views/new_gestionnaire/shared/messages/_message_issuer.html.haml rename to app/views/shared/dossiers/messages/_message_issuer.html.haml diff --git a/spec/views/new_gestionnaire/shared/messages/message.html.haml_spec.rb b/spec/views/shared/dossiers/messages/message.html.haml_spec.rb similarity index 70% rename from spec/views/new_gestionnaire/shared/messages/message.html.haml_spec.rb rename to spec/views/shared/dossiers/messages/message.html.haml_spec.rb index 31fd9db3b..005c663bf 100644 --- a/spec/views/new_gestionnaire/shared/messages/message.html.haml_spec.rb +++ b/spec/views/shared/dossiers/messages/message.html.haml_spec.rb @@ -1,7 +1,7 @@ -describe 'new_gestionnaire/shared/messages/message.html.haml', type: :view do +describe 'shared/dossiers/messages/message.html.haml', type: :view do before { view.extend DossierHelper } - subject { render 'new_gestionnaire/shared/messages/message.html.haml', commentaire: commentaire, messagerie_seen_at: seen_at, current_gestionnaire: current_gestionnaire } + subject { render 'shared/dossiers/messages/message.html.haml', commentaire: commentaire, messagerie_seen_at: seen_at, current_gestionnaire: current_gestionnaire } let(:dossier) { create(:dossier) } let(:commentaire) { create(:commentaire, dossier: dossier) }