merge avis_list view expert and instructeur
This commit is contained in:
parent
9dc3ef7368
commit
0424f9dff8
8 changed files with 15 additions and 64 deletions
|
@ -8,7 +8,7 @@
|
|||
= render partial: 'sidemenu'
|
||||
.fr-col
|
||||
- if @dossier.avis_for_expert(current_expert).present?
|
||||
= render partial: 'experts/avis/shared/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil }
|
||||
= render partial: 'shared/avis/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil, expert_or_instructeur: current_expert }
|
||||
|
||||
- else
|
||||
%h2.empty-text
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
%section.list-avis
|
||||
%h1.tab-title
|
||||
Avis des invités
|
||||
%span.fr-badge= avis.count
|
||||
|
||||
%ul
|
||||
- avis.each do |avis|
|
||||
%li.one-avis.flex.align-start
|
||||
.width-100
|
||||
%h2.claimant.fr-font--md.font-weight-normal
|
||||
%span.fr-icon-questionnaire-line.fr-mr-1v
|
||||
= "#{t('claimant', scope: 'activerecord.attributes.avis')} :"
|
||||
%span.font-weight-bold= (safe_claimant_email(avis.claimant) == current_expert.email) ? 'Vous' : safe_claimant_email(avis.claimant)
|
||||
- if avis.confidentiel?
|
||||
%span.confidentiel
|
||||
= t('confidentiel', scope: 'activerecord.attributes.avis')
|
||||
%span.icon.lock{ title: t('confidentiel', scope: 'helpers.hint') }
|
||||
%span.date.fr-text--xs.fr-text-mention--grey{ class: highlight_if_unseen_class(avis_seen_at, avis.created_at) }
|
||||
= t('demande_envoyee_le', scope: 'views.shared.avis', date: l(avis.created_at, format: '%d/%m/%y à %H:%M'))
|
||||
|
||||
.border-left
|
||||
%p= avis.introduction
|
||||
- if avis.question_label
|
||||
%p= avis.question_label
|
||||
|
||||
.answer.flex.align-start
|
||||
.width-100
|
||||
%h2.instructeur.fr-font--md.font-weight-normal
|
||||
%span.fr-icon-message-2-line.fr-mr-1v
|
||||
= (avis.expert.email == current_expert.email) ? 'Vous' : avis.expert.email
|
||||
- if avis.answer.present?
|
||||
- if avis.revoked?
|
||||
%span.fr-text--xs.fr-text-mention--grey{ class: highlight_if_unseen_class(avis_seen_at, avis.revoked_at) }
|
||||
= t('demande_revoquee_le', scope: 'views.shared.avis', date: l(avis.revoked_at, format: '%d/%m/%y à %H:%M'))
|
||||
%span.date.fr-text--xs.fr-text-mention--grey{ class: highlight_if_unseen_class(avis_seen_at, avis.updated_at) }
|
||||
= t('reponse_donnee_le', scope: 'views.shared.avis', date: l(avis.updated_at, format: '%d/%m/%y à %H:%M'))
|
||||
- else
|
||||
%span.fr-text--xs.fr-text-mention--grey
|
||||
= t('en_attente', scope: 'views.shared.avis')
|
||||
.border-left
|
||||
- if avis.piece_justificative_file.attached?
|
||||
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
|
||||
.answer-body
|
||||
- if [true, false].include? avis.question_answer
|
||||
%p= t("question_answer.#{avis.question_answer}", scope: 'helpers.label')
|
||||
= render SimpleFormatComponent.new(avis.answer, allow_a: false)
|
|
@ -8,7 +8,7 @@
|
|||
= render partial: 'instructeurs/avis/sidemenu'
|
||||
.fr-col
|
||||
- if @dossier.avis.present?
|
||||
= render partial: 'instructeurs/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at }
|
||||
= render partial: 'shared/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at, expert_or_instructeur: current_instructeur }
|
||||
|
||||
- else
|
||||
%h2.empty-text
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
%h2.fr-text--sm.fr-mb-2w
|
||||
%span.fr-icon-questionnaire-line.fr-mr-1v
|
||||
= "#{t('claimant', scope: 'activerecord.attributes.avis')} :"
|
||||
%span= (avis.claimant.email == current_instructeur.email) ? 'Vous' : avis.claimant.email
|
||||
%span= (avis.claimant.email == expert_or_instructeur.email) ? 'Vous' : avis.claimant.email
|
||||
- if avis.confidentiel?
|
||||
%span.fr-badge.fr-badge--sm.fr-badge--warning.fr-badge--no-icon
|
||||
= t('confidentiel', scope: 'activerecord.attributes.avis')
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
%h2.fr-text--sm.fr-mt-5w.fr-mb-2w
|
||||
%span.fr-icon-message-2-line.fr-mr-1v
|
||||
= (avis.expert.email == current_instructeur.email) ? 'Vous' : avis.expert.email
|
||||
= (avis.expert.email == expert_or_instructeur.email) ? 'Vous' : avis.expert.email
|
||||
- if avis.answer.present?
|
||||
- if avis.revoked?
|
||||
%span.fr-badge.fr-badge--sm{ class: highlight_if_unseen_class(avis_seen_at, avis.revoked_at) }
|
||||
|
@ -40,11 +40,12 @@
|
|||
- if avis.reminded_at
|
||||
%span.date.fr-text--xs.fr-text-mention--grey{ class: highlight_if_unseen_class(avis_seen_at, avis.reminded_at) }
|
||||
= t('relance_effectuee_le', scope: 'views.shared.avis', date: l(avis.reminded_at, format: '%d/%m/%y à %H:%M'))
|
||||
- if avis.answer.blank?
|
||||
= link_to(t('remind', scope: 'helpers.label'), remind_instructeur_avis_path(avis.procedure, avis), class:'fr-btn fr-btn--sm fr-btn--tertiary-no-outline', data: { confirm: t('remind', scope: 'helpers.confirmation', email: avis.expert.email) })
|
||||
- if expert_or_instructeur.is_a?(Instructeur)
|
||||
- if avis.answer.blank?
|
||||
= link_to(t('remind', scope: 'helpers.label'), remind_instructeur_avis_path(avis.procedure, avis), class:'fr-btn fr-btn--sm fr-btn--tertiary-no-outline', data: { confirm: t('remind', scope: 'helpers.confirmation', email: avis.expert.email) })
|
||||
|
||||
- if avis.revokable_by?(current_instructeur)
|
||||
= link_to(t('revoke', scope: 'helpers.label'), revoquer_instructeur_avis_path(avis.procedure, avis), class:'fr-btn fr-btn--sm fr-btn--tertiary-no-outline', data: { confirm: t('revoke', scope: 'helpers.confirmation', email: avis.expert.email) }, method: :patch)
|
||||
- if avis.revokable_by?(expert_or_instructeur)
|
||||
= link_to(t('revoke', scope: 'helpers.label'), revoquer_instructeur_avis_path(avis.procedure, avis), class:'fr-btn fr-btn--sm fr-btn--tertiary-no-outline', data: { confirm: t('revoke', scope: 'helpers.confirmation', email: avis.expert.email) }, method: :patch)
|
||||
|
||||
.border-left
|
||||
- if avis.introduction_file.attached?
|
|
@ -21,8 +21,6 @@ en:
|
|||
question_answer:
|
||||
true: 'yes'
|
||||
false: 'no'
|
||||
hint:
|
||||
confidentiel: "This advice is not displayed to the others consulted experts"
|
||||
confirmation:
|
||||
revoke: "Would you like to revoke the opinion request to %{email} ?"
|
||||
remind: "Would you like to remind %{email} ?"
|
||||
|
|
|
@ -21,8 +21,6 @@ fr:
|
|||
question_answer:
|
||||
true: oui
|
||||
false: non
|
||||
hint:
|
||||
confidentiel: "Cet avis n’est pas affiché avec les autres experts consultés"
|
||||
confirmation:
|
||||
revoke: "Souhaitez-vous révoquer la demande d’avis à %{email} ?"
|
||||
remind: "Souhaitez-vous relancer %{email} ?"
|
||||
|
|
|
@ -39,7 +39,7 @@ describe 'Inviting an expert:', js: true do
|
|||
|
||||
expect(page).to have_content('Une demande d’avis a été envoyée')
|
||||
expect(page).to have_content('Avis des invités')
|
||||
within('.list-avis') do
|
||||
within('section') do
|
||||
expect(page).to have_content(expert.email.to_s)
|
||||
expect(page).to have_content(expert2.email.to_s)
|
||||
expect(page).to have_content('Bonjour, merci de me donner votre avis sur ce dossier.')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
describe 'instructeurs/avis/_list.html.haml', type: :view do
|
||||
describe 'shared/avis/_list.html.haml', type: :view do
|
||||
before { view.extend DossierHelper }
|
||||
|
||||
subject { render 'instructeurs/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, current_instructeur: instructeur }
|
||||
subject { render 'shared/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, expert_or_instructeur: instructeur }
|
||||
|
||||
let(:instructeur) { create(:instructeur) }
|
||||
let(:instructeur2) { create(:instructeur) }
|
||||
|
@ -26,9 +26,9 @@ describe 'instructeurs/avis/_list.html.haml', type: :view do
|
|||
let(:avis) { [create(:avis, :with_answer, claimant: instructeur, experts_procedure: experts_procedure)] }
|
||||
|
||||
it 'renders the answer formatted with newlines' do
|
||||
expect(subject).to have_selector(".answer-body p", text: avis.first.answer.split("\n").first)
|
||||
expect(subject).to have_selector(".answer-body ul", count: 1) # avis.answer has two list item
|
||||
expect(subject).to have_selector(".answer-body ul li", count: 2)
|
||||
expect(subject).to have_selector("p", text: avis.first.answer.split("\n").first)
|
||||
expect(subject).to have_selector("ul.list-style-type-none ul", count: 1) # avis.answer has two list item
|
||||
expect(subject).to have_selector("ul.list-style-type-none ul li", count: 2)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in a new issue