From 0a185fb76b136109aa884d926d0fa1f9bfef2faa Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 15 Dec 2017 11:26:57 +0100 Subject: [PATCH 1/6] Remove useless ids in the new Avis templates --- .../new_gestionnaire/avis/index.html.haml | 69 +++++++++---------- .../avis/instruction.html.haml | 3 +- .../new_gestionnaire/avis/show.html.haml | 45 ++++++------ 3 files changed, 57 insertions(+), 60 deletions(-) diff --git a/app/views/new_gestionnaire/avis/index.html.haml b/app/views/new_gestionnaire/avis/index.html.haml index 1c18ef3d5..1f3c5405f 100644 --- a/app/views/new_gestionnaire/avis/index.html.haml +++ b/app/views/new_gestionnaire/avis/index.html.haml @@ -1,41 +1,40 @@ - avis_statut = (@statut == NewGestionnaire::AvisController::A_DONNER_STATUS) ? 'à donner' : 'rendus' - content_for(:title, "Avis #{avis_statut}") -#avis-index - .accompagnateur-header - .container.flex - .width-100 - %h1.tab-title Avis - %ul.tabs - %li{ class: (@statut == NewGestionnaire::AvisController::A_DONNER_STATUS) ? 'active' : nil }> - = link_to(avis_index_path(statut: NewGestionnaire::AvisController::A_DONNER_STATUS)) do - avis à donner - %span.badge= @avis_a_donner.count - - if @avis_a_donner.any? - %span.notifications +.accompagnateur-header + .container.flex + .width-100 + %h1.tab-title Avis + %ul.tabs + %li{ class: (@statut == NewGestionnaire::AvisController::A_DONNER_STATUS) ? 'active' : nil }> + = link_to(avis_index_path(statut: NewGestionnaire::AvisController::A_DONNER_STATUS)) do + avis à donner + %span.badge= @avis_a_donner.count + - if @avis_a_donner.any? + %span.notifications - %li{ class: (@statut == NewGestionnaire::AvisController::DONNES_STATUS) ? 'active' : nil }> - = link_to(avis_index_path(statut: NewGestionnaire::AvisController::DONNES_STATUS)) do - avis #{'donné'.pluralize(@avis_donnes.count)} - %span.badge= @avis_donnes.count + %li{ class: (@statut == NewGestionnaire::AvisController::DONNES_STATUS) ? 'active' : nil }> + = link_to(avis_index_path(statut: NewGestionnaire::AvisController::DONNES_STATUS)) do + avis #{'donné'.pluralize(@avis_donnes.count)} + %span.badge= @avis_donnes.count - .container - - if @avis.present? - %table.table.dossiers-table.hoverable - %thead +.container + - if @avis.present? + %table.table.dossiers-table.hoverable + %thead + %tr + %th.number-col Nº dossier + %th Demandeur + %th Procédure + %tbody + - @avis.each do |avis| %tr - %th.number-col Nº dossier - %th Demandeur - %th Procédure - %tbody - - @avis.each do |avis| - %tr - %td.number-col - = link_to(avis_path(avis), class: 'cell-link') do - %span.icon.folder - #{avis.dossier.id} - %td= link_to(avis.dossier.user.email, avis_path(avis), class: 'cell-link') - %td= link_to(avis.dossier.procedure.libelle, avis_path(avis), class: 'cell-link') - = paginate(@avis) - - else - %h2.empty-text Aucun avis + %td.number-col + = link_to(avis_path(avis), class: 'cell-link') do + %span.icon.folder + #{avis.dossier.id} + %td= link_to(avis.dossier.user.email, avis_path(avis), class: 'cell-link') + %td= link_to(avis.dossier.procedure.libelle, avis_path(avis), class: 'cell-link') + = paginate(@avis) + - else + %h2.empty-text Aucun avis diff --git a/app/views/new_gestionnaire/avis/instruction.html.haml b/app/views/new_gestionnaire/avis/instruction.html.haml index f9baa98e2..4a65dbd1e 100644 --- a/app/views/new_gestionnaire/avis/instruction.html.haml +++ b/app/views/new_gestionnaire/avis/instruction.html.haml @@ -1,7 +1,6 @@ - content_for(:title, "Avis · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") -#avis-show - = render partial: 'header', locals: { avis: @avis, dossier: @dossier } += render partial: 'header', locals: { avis: @avis, dossier: @dossier } .container %section.give-avis diff --git a/app/views/new_gestionnaire/avis/show.html.haml b/app/views/new_gestionnaire/avis/show.html.haml index ea4887be1..076dd3988 100644 --- a/app/views/new_gestionnaire/avis/show.html.haml +++ b/app/views/new_gestionnaire/avis/show.html.haml @@ -1,29 +1,28 @@ - content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") -#avis-show - = render partial: 'header', locals: { avis: @avis, dossier: @dossier } += render partial: 'header', locals: { avis: @avis, dossier: @dossier } - .container - .tab-title Identité du demandeur +.container + .tab-title Identité du demandeur + .card + - if @dossier.entreprise.present? + = render partial: 'new_gestionnaire/dossiers/identite_entreprise', locals: { entreprise: @dossier.entreprise } + + - if @dossier.individual.present? + = render partial: 'new_gestionnaire/dossiers/identite_individual', locals: { individual: @dossier.individual } + + .tab-title Formulaire + - champs = @dossier.ordered_champs.decorate + - if champs.any? .card - - if @dossier.entreprise.present? - = render partial: 'new_gestionnaire/dossiers/identite_entreprise', locals: { entreprise: @dossier.entreprise } + = render partial: 'new_gestionnaire/dossiers/champs', locals: { champs: champs, dossier: @dossier, demande_seen_at: nil } - - if @dossier.individual.present? - = render partial: 'new_gestionnaire/dossiers/identite_individual', locals: { individual: @dossier.individual } + - if @dossier.procedure.use_api_carto + .tab-title Cartographie + .card + = render partial: 'new_gestionnaire/dossiers/map', locals: { dossier: @dossier } - .tab-title Formulaire - - champs = @dossier.ordered_champs.decorate - - if champs.any? - .card - = render partial: 'new_gestionnaire/dossiers/champs', locals: { champs: champs, dossier: @dossier, demande_seen_at: nil } - - - if @dossier.procedure.use_api_carto - .tab-title Cartographie - .card - = render partial: 'new_gestionnaire/dossiers/map', locals: { dossier: @dossier } - - - if @dossier.procedure.cerfa_flag? || @dossier.types_de_piece_justificative.any? - .tab-title Pièces jointes - .card - = render partial: "new_gestionnaire/dossiers/pieces_jointes", locals: { dossier: @dossier, demande_seen_at: nil } + - if @dossier.procedure.cerfa_flag? || @dossier.types_de_piece_justificative.any? + .tab-title Pièces jointes + .card + = render partial: "new_gestionnaire/dossiers/pieces_jointes", locals: { dossier: @dossier, demande_seen_at: nil } From 60c845986ce10476c08651768346d0830a6ce484 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 15 Dec 2017 11:27:17 +0100 Subject: [PATCH 2/6] Remove some unused locals in the champs partial inclusions --- app/views/new_gestionnaire/avis/show.html.haml | 2 +- app/views/new_gestionnaire/dossiers/show.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/new_gestionnaire/avis/show.html.haml b/app/views/new_gestionnaire/avis/show.html.haml index 076dd3988..2e3b903cd 100644 --- a/app/views/new_gestionnaire/avis/show.html.haml +++ b/app/views/new_gestionnaire/avis/show.html.haml @@ -15,7 +15,7 @@ - champs = @dossier.ordered_champs.decorate - if champs.any? .card - = render partial: 'new_gestionnaire/dossiers/champs', locals: { champs: champs, dossier: @dossier, demande_seen_at: nil } + = render partial: 'new_gestionnaire/dossiers/champs', locals: { champs: champs, demande_seen_at: nil } - if @dossier.procedure.use_api_carto .tab-title Cartographie diff --git a/app/views/new_gestionnaire/dossiers/show.html.haml b/app/views/new_gestionnaire/dossiers/show.html.haml index a13597223..99382749c 100644 --- a/app/views/new_gestionnaire/dossiers/show.html.haml +++ b/app/views/new_gestionnaire/dossiers/show.html.haml @@ -15,7 +15,7 @@ - champs = @dossier.ordered_champs.includes(:type_de_champ).decorate - if champs.any? .card - = render partial: "champs", locals: { champs: champs, dossier: @dossier, demande_seen_at: @demande_seen_at } + = render partial: "champs", locals: { champs: champs, demande_seen_at: @demande_seen_at } - if @dossier.procedure.use_api_carto .tab-title Cartographie From e4f7f20698a24f7b2e2ae58e7cf5915826bfb58f Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 15 Dec 2017 11:26:19 +0100 Subject: [PATCH 3/6] Mutualize some accompagnateur show template code in a partial --- .../new_gestionnaire/avis/show.html.haml | 24 +----------------- .../new_gestionnaire/dossiers/show.html.haml | 25 +------------------ .../new_gestionnaire/shared/_show.html.haml | 24 ++++++++++++++++++ 3 files changed, 26 insertions(+), 47 deletions(-) create mode 100644 app/views/new_gestionnaire/shared/_show.html.haml diff --git a/app/views/new_gestionnaire/avis/show.html.haml b/app/views/new_gestionnaire/avis/show.html.haml index 2e3b903cd..c8a4ae923 100644 --- a/app/views/new_gestionnaire/avis/show.html.haml +++ b/app/views/new_gestionnaire/avis/show.html.haml @@ -2,27 +2,5 @@ = render partial: 'header', locals: { avis: @avis, dossier: @dossier } -.container - .tab-title Identité du demandeur - .card - - if @dossier.entreprise.present? - = render partial: 'new_gestionnaire/dossiers/identite_entreprise', locals: { entreprise: @dossier.entreprise } += render partial: 'new_gestionnaire/shared/show', locals: { dossier: @dossier, demande_seen_at: nil } - - if @dossier.individual.present? - = render partial: 'new_gestionnaire/dossiers/identite_individual', locals: { individual: @dossier.individual } - - .tab-title Formulaire - - champs = @dossier.ordered_champs.decorate - - if champs.any? - .card - = render partial: 'new_gestionnaire/dossiers/champs', locals: { champs: champs, demande_seen_at: nil } - - - if @dossier.procedure.use_api_carto - .tab-title Cartographie - .card - = render partial: 'new_gestionnaire/dossiers/map', locals: { dossier: @dossier } - - - if @dossier.procedure.cerfa_flag? || @dossier.types_de_piece_justificative.any? - .tab-title Pièces jointes - .card - = render partial: "new_gestionnaire/dossiers/pieces_jointes", locals: { dossier: @dossier, demande_seen_at: nil } diff --git a/app/views/new_gestionnaire/dossiers/show.html.haml b/app/views/new_gestionnaire/dossiers/show.html.haml index 99382749c..c7a827ef3 100644 --- a/app/views/new_gestionnaire/dossiers/show.html.haml +++ b/app/views/new_gestionnaire/dossiers/show.html.haml @@ -2,27 +2,4 @@ = render partial: "header", locals: { dossier: @dossier } -.container - .tab-title Identité du demandeur - .card - - if @dossier.entreprise.present? - = render partial: "identite_entreprise", locals: { entreprise: @dossier.entreprise } - - - if @dossier.individual.present? - = render partial: "identite_individual", locals: { individual: @dossier.individual } - - .tab-title Formulaire - - champs = @dossier.ordered_champs.includes(:type_de_champ).decorate - - if champs.any? - .card - = render partial: "champs", locals: { champs: champs, demande_seen_at: @demande_seen_at } - - - if @dossier.procedure.use_api_carto - .tab-title Cartographie - .card - = render partial: "map", locals: { dossier: @dossier } - - - if @dossier.procedure.cerfa_flag? || @dossier.types_de_piece_justificative.any? - .tab-title Pièces jointes - .card - = render partial: "pieces_jointes", locals: { dossier: @dossier, demande_seen_at: @demande_seen_at } += render partial: 'new_gestionnaire/shared/show', locals: { dossier: @dossier, demande_seen_at: @demande_seen_at } diff --git a/app/views/new_gestionnaire/shared/_show.html.haml b/app/views/new_gestionnaire/shared/_show.html.haml new file mode 100644 index 000000000..f391feb7d --- /dev/null +++ b/app/views/new_gestionnaire/shared/_show.html.haml @@ -0,0 +1,24 @@ +.container + .tab-title Identité du demandeur + .card + - if dossier.entreprise.present? + = render partial: "new_gestionnaire/dossiers/identite_entreprise", locals: { entreprise: dossier.entreprise } + + - if dossier.individual.present? + = render partial: "new_gestionnaire/dossiers/identite_individual", locals: { individual: dossier.individual } + + .tab-title Formulaire + - champs = dossier.ordered_champs.includes(:type_de_champ).decorate + - if champs.any? + .card + = render partial: "new_gestionnaire/dossiers/champs", locals: { champs: champs, demande_seen_at: demande_seen_at } + + - if dossier.procedure.use_api_carto + .tab-title Cartographie + .card + = render partial: "new_gestionnaire/dossiers/map", locals: { dossier: dossier } + + - if dossier.procedure.cerfa_flag? || dossier.types_de_piece_justificative.any? + .tab-title Pièces jointes + .card + = render partial: "new_gestionnaire/dossiers/pieces_jointes", locals: { dossier: dossier, demande_seen_at: demande_seen_at } From 0c995b63cff58e70defc0f54606a2e42a65b2d8f Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 15 Dec 2017 13:21:59 +0100 Subject: [PATCH 4/6] Move the avis list partial in the shared folder --- app/views/new_gestionnaire/avis/instruction.html.haml | 2 +- app/views/new_gestionnaire/dossiers/avis.html.haml | 2 +- .../_avis_list.html.haml => shared/avis/_list.html.haml} | 0 .../avis/list.html.haml_spec.rb} | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) rename app/views/new_gestionnaire/{avis/_avis_list.html.haml => shared/avis/_list.html.haml} (100%) rename spec/views/new_gestionnaire/{avis/avis_list.html.haml_spec.rb => shared/avis/list.html.haml_spec.rb} (69%) diff --git a/app/views/new_gestionnaire/avis/instruction.html.haml b/app/views/new_gestionnaire/avis/instruction.html.haml index 4a65dbd1e..1433acfa3 100644 --- a/app/views/new_gestionnaire/avis/instruction.html.haml +++ b/app/views/new_gestionnaire/avis/instruction.html.haml @@ -41,4 +41,4 @@ .send-wrapper = f.submit 'Demander un avis', class: 'button send' - = render partial: 'avis_list', locals: { avis: @dossier.avis_for(current_gestionnaire), avis_seen_at: nil } + = render partial: 'new_gestionnaire/shared/avis/list', locals: { avis: @dossier.avis_for(current_gestionnaire), avis_seen_at: nil } diff --git a/app/views/new_gestionnaire/dossiers/avis.html.haml b/app/views/new_gestionnaire/dossiers/avis.html.haml index 1e04ec443..75939aaba 100644 --- a/app/views/new_gestionnaire/dossiers/avis.html.haml +++ b/app/views/new_gestionnaire/dossiers/avis.html.haml @@ -17,4 +17,4 @@ .send-wrapper = f.submit 'Demander un avis', class: 'button send', data: { disable_with: "Envoi..." } - = render partial: 'new_gestionnaire/avis/avis_list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } + = render partial: 'new_gestionnaire/shared/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } diff --git a/app/views/new_gestionnaire/avis/_avis_list.html.haml b/app/views/new_gestionnaire/shared/avis/_list.html.haml similarity index 100% rename from app/views/new_gestionnaire/avis/_avis_list.html.haml rename to app/views/new_gestionnaire/shared/avis/_list.html.haml diff --git a/spec/views/new_gestionnaire/avis/avis_list.html.haml_spec.rb b/spec/views/new_gestionnaire/shared/avis/list.html.haml_spec.rb similarity index 69% rename from spec/views/new_gestionnaire/avis/avis_list.html.haml_spec.rb rename to spec/views/new_gestionnaire/shared/avis/list.html.haml_spec.rb index 0a197e1a7..a7c694209 100644 --- a/spec/views/new_gestionnaire/avis/avis_list.html.haml_spec.rb +++ b/spec/views/new_gestionnaire/shared/avis/list.html.haml_spec.rb @@ -1,7 +1,7 @@ -describe 'new_gestionnaire/avis/avis_list.html.haml', type: :view do +describe 'new_gestionnaire/shared/avis/_list.html.haml', type: :view do before { view.extend DossierHelper } - subject { render 'new_gestionnaire/avis/avis_list.html.haml', avis: avis, avis_seen_at: seen_at, current_gestionnaire: gestionnaire } + subject { render 'new_gestionnaire/shared/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, current_gestionnaire: gestionnaire } let(:gestionnaire) { create(:gestionnaire) } let(:avis) { [create(:avis, claimant: gestionnaire)] } From ec9758a9465a7b55e7840a0b46715103ba7d98e4 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 15 Dec 2017 12:13:32 +0100 Subject: [PATCH 5/6] Mutualize some code code into a messagerie partial --- app/views/new_gestionnaire/avis/messagerie.html.haml | 8 +------- app/views/new_gestionnaire/dossiers/messagerie.html.haml | 8 +------- app/views/new_gestionnaire/shared/_messagerie.html.haml | 7 +++++++ 3 files changed, 9 insertions(+), 14 deletions(-) create mode 100644 app/views/new_gestionnaire/shared/_messagerie.html.haml diff --git a/app/views/new_gestionnaire/avis/messagerie.html.haml b/app/views/new_gestionnaire/avis/messagerie.html.haml index d49fa5d54..571b4136c 100644 --- a/app/views/new_gestionnaire/avis/messagerie.html.haml +++ b/app/views/new_gestionnaire/avis/messagerie.html.haml @@ -2,10 +2,4 @@ = render partial: 'header', locals: { avis: @avis, dossier: @dossier } -.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/commentaires/commentaire", locals: { commentaire: commentaire, messagerie_seen_at: nil } - - = render partial: "new_gestionnaire/shared/commentaires/form", locals: { commentaire: @commentaire, form_url: commentaire_avis_path(@avis) } += render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_avis_path(@avis) } diff --git a/app/views/new_gestionnaire/dossiers/messagerie.html.haml b/app/views/new_gestionnaire/dossiers/messagerie.html.haml index dd7380328..b4e7176af 100644 --- a/app/views/new_gestionnaire/dossiers/messagerie.html.haml +++ b/app/views/new_gestionnaire/dossiers/messagerie.html.haml @@ -2,10 +2,4 @@ = render partial: "header", locals: { dossier: @dossier } -.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/commentaires/commentaire", locals: { commentaire: commentaire, messagerie_seen_at: @messagerie_seen_at } - - = render partial: "new_gestionnaire/shared/commentaires/form", locals: { commentaire: @commentaire, form_url: commentaire_dossier_path(@dossier.procedure, @dossier) } += render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_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 new file mode 100644 index 000000000..1afb5db3b --- /dev/null +++ b/app/views/new_gestionnaire/shared/_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: "new_gestionnaire/shared/commentaires/commentaire", locals: { commentaire: commentaire, messagerie_seen_at: messagerie_seen_at } + + = render partial: "new_gestionnaire/shared/commentaires/form", locals: { commentaire: new_commentaire, form_url: form_url } From 046e1cf8f3eb0927d7fcb784c107912aaa511bef Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 15 Dec 2017 13:23:22 +0100 Subject: [PATCH 6/6] Mutualize some code in an avis form partial --- .../avis/instruction.html.haml | 21 +------------------ .../new_gestionnaire/dossiers/avis.html.haml | 14 +------------ .../shared/avis/_form.html.haml | 20 ++++++++++++++++++ 3 files changed, 22 insertions(+), 33 deletions(-) create mode 100644 app/views/new_gestionnaire/shared/avis/_form.html.haml diff --git a/app/views/new_gestionnaire/avis/instruction.html.haml b/app/views/new_gestionnaire/avis/instruction.html.haml index 1433acfa3..b69d3ad9f 100644 --- a/app/views/new_gestionnaire/avis/instruction.html.haml +++ b/app/views/new_gestionnaire/avis/instruction.html.haml @@ -20,25 +20,6 @@ .send-wrapper = f.submit 'Envoyer votre avis', class: 'button send' - %section.ask-avis - %h1.tab-title Inviter une personne à donner son avis - %p.avis-notice L'invité pourra consulter, donner un avis sur le dossier et contribuer au fil de messagerie, mais il ne pourra le modifier. - - = form_for Avis.new, url: avis_avis_path(@avis), html: { class: 'form' } do |f| - = f.email_field :email, placeholder: 'Adresse email', required: true - = f.text_area :introduction, rows: 3, value: 'Bonjour, merci de me donner votre avis sur ce dossier.', required: true - .flex.justify-between.align-baseline - - if @avis.confidentiel? - %p.confidentiel - %span.icon.lock - Cet avis est confidentiel et n'est pas affiché aux autres experts consultés - .send-wrapper - = f.submit 'Demander un avis', class: 'button send' - - else - .confidentiel-wrapper - = f.label :confidentiel, 'Cet avis est' - = f.select :confidentiel, [['partagé avec les autres experts', false], ['confidentiel', true]] - .send-wrapper - = f.submit 'Demander un avis', class: 'button send' + = render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_avis_path(@avis), must_be_confidentiel: @avis.confidentiel? } = render partial: 'new_gestionnaire/shared/avis/list', locals: { avis: @dossier.avis_for(current_gestionnaire), avis_seen_at: nil } diff --git a/app/views/new_gestionnaire/dossiers/avis.html.haml b/app/views/new_gestionnaire/dossiers/avis.html.haml index 75939aaba..89e09fae6 100644 --- a/app/views/new_gestionnaire/dossiers/avis.html.haml +++ b/app/views/new_gestionnaire/dossiers/avis.html.haml @@ -3,18 +3,6 @@ = render partial: "header", locals: { dossier: @dossier } .container - %section.ask-avis - %h1.tab-title Inviter une personne à donner son avis - %p.avis-notice L'invité pourra consulter, donner un avis sur le dossier et contribuer au fil de messagerie, mais il ne pourra le modifier. - - = form_for Avis.new, url: avis_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f| - = f.email_field :email, placeholder: 'Adresse email', required: true - = f.text_area :introduction, rows: 3, value: 'Bonjour, merci de me donner votre avis sur ce dossier.', required: true - .flex.justify-between.align-baseline - .confidentiel-wrapper - = f.label :confidentiel, 'Cet avis est' - = f.select :confidentiel, [['partagé avec les autres experts', false], ['confidentiel', true]] - .send-wrapper - = f.submit 'Demander un avis', class: 'button send', data: { disable_with: "Envoi..." } + = render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_dossier_path(@dossier.procedure, @dossier), must_be_confidentiel: false } = render partial: 'new_gestionnaire/shared/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } diff --git a/app/views/new_gestionnaire/shared/avis/_form.html.haml b/app/views/new_gestionnaire/shared/avis/_form.html.haml new file mode 100644 index 000000000..037dd338e --- /dev/null +++ b/app/views/new_gestionnaire/shared/avis/_form.html.haml @@ -0,0 +1,20 @@ +%section.ask-avis + %h1.tab-title Inviter une personne à donner son avis + %p.avis-notice L'invité pourra consulter, donner un avis sur le dossier et contribuer au fil de messagerie, mais il ne pourra le modifier. + + = form_for Avis.new, url: url, html: { class: 'form' } do |f| + = f.email_field :email, placeholder: 'Adresse email', required: true + = f.text_area :introduction, rows: 3, value: 'Bonjour, merci de me donner votre avis sur ce dossier.', required: true + .flex.justify-between.align-baseline + - if must_be_confidentiel + %p.confidentiel + %span.icon.lock + Cet avis est confidentiel et n'est pas affiché aux autres experts consultés + .send-wrapper + = f.submit 'Demander un avis', class: 'button send' + - else + .confidentiel-wrapper + = f.label :confidentiel, 'Cet avis est' + = f.select :confidentiel, [['partagé avec les autres experts', false], ['confidentiel', true]] + .send-wrapper + = f.submit 'Demander un avis', class: 'button send'