remove specific css for avis and fix broken display in list of avis for instructeurs

This commit is contained in:
Lisa Durand 2023-03-24 11:33:08 +01:00 committed by Colin Darie
parent 9a38da09ed
commit 9dc3ef7368
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
5 changed files with 73 additions and 181 deletions

View file

@ -143,6 +143,11 @@
vertical-align: super;
}
.border-left {
border-left: 4px solid var(--background-contrast-grey);
padding-left: $default-padding;
}
// Labels that we only want for screen readers
// https://www.coolfields.co.uk/2016/05/text-for-screen-readers-only-updated/
.sr-only {

View file

@ -1,120 +0,0 @@
@import "colors";
@import "constants";
.give-avis {
.lock {
margin-right: $default-spacer;
}
h2 {
margin-bottom: $default-padding;
font-size: 16px;
.email {
font-weight: bold;
}
}
.introduction {
margin-bottom: $default-padding;
}
.confidentiel {
color: $dark-grey;
font-weight: normal;
margin-bottom: 2 * $default-padding;
}
.date {
font-size: 12px;
color: $dark-grey;
float: right;
}
}
.ask-avis {
margin-bottom: 2 * $default-padding;
.avis-notice {
font-size: 14px;
color: $dark-grey;
margin-bottom: 2 * $default-padding;
}
input[type=email] {
max-width: 500px;
}
form > label {
display: inline-block;
}
.confidentiel {
color: $dark-grey;
font-weight: normal;
margin-bottom: 2 * $default-padding;
}
.confidentiel-wrapper {
label,
select {
display: inline-block;
}
}
.lock {
margin-right: $default-spacer;
}
}
.list-avis {
ul {
padding-inline-start: 0;
}
.one-avis {
border-top: 1px solid $grey;
padding: $default-padding 0;
.lock {
margin-right: $default-spacer;
}
h2 {
margin-bottom: $default-spacer;
font-size: 16px;
.email {
font-weight: bold;
}
}
.answer {
margin-top: $default-padding;
}
.answer-body p:not(:last-of-type) {
margin-bottom: $default-padding;
}
.avis-icon {
margin-right: $default-spacer;
}
.confidentiel {
color: $dark-grey;
font-size: 12px;
.lock {
width: 12px;
height: 12px;
background-size: 12px 12px;
vertical-align: sub;
}
}
}
.date {
float: right;
}
}

View file

@ -10,15 +10,15 @@
- if !@dossier.termine?
%section.give-avis
%h1.tab-title Donner votre avis
%h2.claimant
%h2.fr-text--sm.fr-mb-2w
Demandeur :
%span.email.font-weight-normal= safe_claimant_email(@avis.claimant)
%span.date.font-weight-normal Demande davis envoyée le #{l(@avis.created_at, format: '%d/%m/%y')}
%span.fr-text--xs.fr-text-mention--grey.pull-right Demande davis envoyée le #{l(@avis.created_at, format: '%d/%m/%y')}
%p.introduction= @avis.introduction
- if @avis.introduction_file.attached?
= render Attachment::ShowComponent.new(attachment: @avis.introduction_file.attachment)
%br/
= render Attachment::DeleteFormComponent.new
= form_for @avis, url: expert_avis_path(@avis.procedure, @avis), html: { data: { controller: 'persisted-form', persisted_form_key_value: dom_id(@avis) }, multipart: true } do |f|

View file

@ -8,6 +8,7 @@
%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?
@ -16,14 +17,16 @@
%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'))
%p= avis.introduction
- if avis.question_label
%p= avis.question_label
.border-left
%p= avis.introduction
- if avis.question_label
%p= avis.question_label
.answer.flex.align-start
%span.icon.bubble.avis-icon
.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?
@ -34,9 +37,10 @@
- else
%span.fr-text--xs.fr-text-mention--grey
= t('en_attente', scope: 'views.shared.avis')
- 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)
.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)

View file

@ -1,59 +1,62 @@
%section.list-avis
%section
%h1.tab-title
Avis des invités
%span.fr-badge= avis.count
%ul
%ul.list-style-type-none.fr-p-0
- avis.each do |avis|
%li.one-avis.flex.align-start
.width-100
%h2.claimant.fr-font--md.font-weight-normal
= "#{t('claimant', scope: 'activerecord.attributes.avis')} :"
%span.font-weight-bold= (avis.claimant.email == current_instructeur.email) ? 'Vous' : avis.claimant.email
- 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'))
%li
%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
- if avis.confidentiel?
%span.fr-badge.fr-badge--sm.fr-badge--warning.fr-badge--no-icon
= t('confidentiel', scope: 'activerecord.attributes.avis')
%span.fr-text--xs.fr-text-mention--grey.pull-right{ 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
%span.icon.bubble.avis-icon
.width-100
%h2.instructeur.fr-font--md.font-weight-normal
= (avis.expert.email == current_instructeur.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'))
- else
- if avis.revokable_by?(current_instructeur)
%span.fr-text--xs.fr-text-mention--grey= link_to(t('revoke', scope: 'helpers.label'), revoquer_instructeur_avis_path(avis.procedure, avis), data: { confirm: t('revoke', scope: 'helpers.confirmation', email: avis.expert.email) }, method: :patch)
%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')
|
%span= link_to(t('remind', scope: 'helpers.label'), remind_instructeur_avis_path(avis.procedure, avis), 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), data: { confirm: t('revoke', scope: 'helpers.confirmation', email: avis.expert.email) }, method: :patch)
- 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.introduction_file.attached?
= render Attachment::ShowComponent.new(attachment: avis.introduction_file.attachment)
.answer-body.mb-3
%p #{t('views.instructeurs.avis.introduction_file_explaination')} #{avis.claimant.email}
%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
- if avis.answer.present?
- if avis.revoked?
%span.fr-badge.fr-badge--sm{ 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'))
- 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')
%span.fr-text--xs.fr-text-mention--grey.pull-right{ 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-badge.fr-badge--sm
= t('en_attente', scope: 'views.shared.avis')
= render SimpleFormatComponent.new(avis.answer, allow_a: false)
.fr-mb-2w
- 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 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)
.border-left
- if avis.introduction_file.attached?
= render Attachment::ShowComponent.new(attachment: avis.introduction_file.attachment)
.fr-mb-2w
%p #{t('views.instructeurs.avis.introduction_file_explaination')} #{avis.claimant.email}
- if avis.piece_justificative_file.attached?
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
.fr-mb-2w
- 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)
%hr.fr-mt-2w.fr-mb-2w