review(colin): quelques suggestions de co-linux

This commit is contained in:
Martin 2023-06-22 17:17:53 +02:00
parent 43c6f03d10
commit 217f32deca
9 changed files with 56 additions and 47 deletions

View file

@ -11,9 +11,7 @@
%p.champ-updated-at.fr-mb-0.fr-text--sm
- if updated_after_deposer?(champ)
%span{ class: highlight_if_unseen_class(@demande_seen_at, champ.updated_at) }
modifié le
= try_format_datetime(champ.updated_at)
= t(:updated_at, scope: [:views, :shared, :dossiers, :form], datetime: try_format_datetime(champ.updated_at))
- if champ.blank?
.champ-content.fr-text-mention--grey{ class: [highlight_if_unseen_class(@demande_seen_at, champ.updated_at), champ.type_champ] }
%p= t('.blank')

View file

@ -3,9 +3,7 @@ class EditableChamp::SectionComponent < ApplicationComponent
include TreeableConcern
def initialize(nodes: nil, champs: nil)
if (nodes.nil?)
nodes = to_tree(champs:)
end
nodes ||= to_tree(champs:)
@nodes = to_fieldset(nodes:)
end

View file

@ -4,9 +4,7 @@ class ViewableChamp::SectionComponent < ApplicationComponent
def initialize(champs: nil, nodes: nil, demande_seen_at:, profile:)
@demande_seen_at, @profile, @repetition = demande_seen_at, profile
if nodes.nil?
nodes = to_tree(champs:)
end
nodes ||= to_tree(champs:)
@nodes = to_sections(nodes:)
end
@ -15,7 +13,9 @@ class ViewableChamp::SectionComponent < ApplicationComponent
end
def header_section
return @nodes.first if @nodes.first.is_a?(Champs::HeaderSectionChamp)
if @nodes.first.is_a?(Champs::HeaderSectionChamp)
@nodes.first
end
end
def champs
@ -37,6 +37,10 @@ class ViewableChamp::SectionComponent < ApplicationComponent
"h#{header_section.level + 1}" if header_section
end
def first_level?
header_section.level == 1
end
private
def to_sections(nodes:)

View file

@ -6,8 +6,7 @@
%p.champ-updated-at.fr-mb-0.fr-text--sm
- if demande_seen_at&.<(dossier.groupe_instructeur_updated_at)
%span{ class: highlight_if_unseen_class(demande_seen_at, dossier.groupe_instructeur_updated_at) }
modifié le
= try_format_datetime(dossier.updated_at)
= t(:updated_at, scope: [:views, :shared, :dossiers, :form], datetime: try_format_datetime(dossier.updated_at))
.champ-content.fr-text-action-high--grey{ class: highlight_if_unseen_class(demande_seen_at, dossier.groupe_instructeur_updated_at) }
%p= dossier.groupe_instructeur.label

View file

@ -2,40 +2,42 @@
- content_for(:notice_info) do
= render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.france_connect_information }
.container.counter-start-header-section
%h2.fr-h6.fr-background-alt--grey.fr-mb-0
.flex-grow.fr-py-3v.fr-px-4v= t('views.shared.dossiers.demande.en_construction')
.fr-container.counter-start-header-section
.fr-grid-row
.fr-col-12.fr-col-offset-lg-2.fr-col-lg-8
%h2.fr-h6.fr-background-alt--grey.fr-mb-0
.flex-grow.fr-py-3v.fr-px-4v= t('views.shared.dossiers.demande.en_construction')
- if dossier.depose_at.present?
= render partial: "shared/dossiers/infos_generales", locals: { dossier: dossier }
- if dossier.depose_at.present?
= render partial: "shared/dossiers/infos_generales", locals: { dossier: dossier }
.tab-title
%h2.fr-h6.fr-background-alt--grey.fr-mb-0.flex
.flex-grow.fr-py-3v.fr-px-4v= t('views.shared.dossiers.demande.requester_identity')
- if dossier.etablissement.present? && profile == 'usager' && !dossier.read_only?
= link_to t('views.shared.dossiers.demande.edit_siret'), siret_dossier_path(dossier), class: 'fr-py-3v fr-btn fr-btn--tertiary-no-outline'
.tab-title
%h2.fr-h6.fr-background-alt--grey.fr-mb-0.flex
.flex-grow.fr-py-3v.fr-px-4v= t('views.shared.dossiers.demande.requester_identity')
- if dossier.etablissement.present? && profile == 'usager' && !dossier.read_only?
= link_to t('views.shared.dossiers.demande.edit_siret'), siret_dossier_path(dossier), class: 'fr-py-3v fr-btn fr-btn--tertiary-no-outline'
- if dossier.individual.present? && profile == 'usager' && !dossier.read_only?
= link_to t('views.shared.dossiers.demande.edit_identity'), identite_dossier_path(dossier), class: 'fr-py-3v fr-btn fr-btn--tertiary-no-outline'
- if dossier.individual.present? && profile == 'usager' && !dossier.read_only?
= link_to t('views.shared.dossiers.demande.edit_identity'), identite_dossier_path(dossier), class: 'fr-py-3v fr-btn fr-btn--tertiary-no-outline'
- if dossier.identity_updated_at.present? && demande_seen_at&.<(dossier.identity_updated_at)
%span.highlighted
modifié le
= try_format_datetime(dossier.identity_updated_at)
- if dossier.identity_updated_at.present? && demande_seen_at&.<(dossier.identity_updated_at)
%span.highlighted
modifié le
= try_format_datetime(dossier.identity_updated_at)
.fr-my-4v.fr-px-4v
= render partial: "shared/dossiers/user_infos", locals: { user_deleted: dossier.user_deleted?, email: dossier.user_email_for(:display) }
.fr-my-4v.fr-px-4v
= render partial: "shared/dossiers/user_infos", locals: { user_deleted: dossier.user_deleted?, email: dossier.user_email_for(:display) }
- if dossier.etablissement.present?
= render partial: "shared/dossiers/identite_entreprise", locals: { etablissement: dossier.etablissement, profile: profile }
- if dossier.etablissement.present?
= render partial: "shared/dossiers/identite_entreprise", locals: { etablissement: dossier.etablissement, profile: profile }
- if dossier.individual.present?
= render partial: "shared/dossiers/identite_individual", locals: { individual: dossier.individual }
- if dossier.individual.present?
= render partial: "shared/dossiers/identite_individual", locals: { individual: dossier.individual }
%h2.fr-h6.fr-background-alt--grey.fr-mb-0.flex
.flex-grow.fr-py-3v.fr-px-4v= t('views.shared.dossiers.demande.form')
%h2.fr-h6.fr-background-alt--grey.fr-mb-0.flex
.flex-grow.fr-py-3v.fr-px-4v= t('views.shared.dossiers.demande.form')
- champs = dossier.champs_public
- if champs.any? || dossier.procedure.routing_enabled?
= render partial: "shared/dossiers/champs", locals: { champs: champs, dossier: dossier, demande_seen_at: demande_seen_at, profile: profile }
- champs = dossier.champs_public
- if champs.any? || dossier.procedure.routing_enabled?
= render partial: "shared/dossiers/champs", locals: { champs: champs, dossier: dossier, demande_seen_at: demande_seen_at, profile: profile }

View file

@ -2,7 +2,8 @@
%p.fr-my-4v.fr-px-4v.fr-text-action-high--grey
= l(dossier.depose_at, format: '%d %B %Y %H:%m')
- if dossier.updated_at != dossier.depose_at
= t('views.shared.dossiers.demande.updated_at', updated_at: l(dossier.updated_at, format: '%d %B %y %H:%m'))
= t(:updated_at, scope: [:views, :shared, :dossiers, :form], datetime: l(dossier.updated_at, format: :long))
- if dossier.justificatif_motivation.attached?
.fr-my-4v.fr-px-4v

View file

@ -15,7 +15,9 @@
= render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil, profile: 'usager' }
.container
- if !@dossier.read_only?
= link_to t('views.users.dossiers.demande.edit_dossier'), modifier_dossier_path(@dossier), class: 'fr-btn fr-btn-sm', 'title'=> "Modifier mon dossier tant qu'il n'est pas passé en instruction"
.clearfix
.fr-container
.fr-grid-row
.fr-col-12.fr-col-offset-lg-2.fr-col-lg-8
- if !@dossier.read_only?
= link_to t('views.users.dossiers.demande.edit_dossier'), modifier_dossier_path(@dossier), class: 'fr-btn fr-btn-sm', 'title'=> "Modifier mon dossier tant qu'il n'est pas passé en instruction"
.clearfix

View file

@ -330,6 +330,8 @@ en:
hello: Dear Sir or Madam,
best_regards: Best Regards,
dossiers:
form:
updated_at: "updated at %{datetime}"
edit:
autosave: Your file is automatically saved after each modification. You can close the window at any time and pick up where you left off later.
notice: "Download the notice of the procedure"
@ -341,8 +343,6 @@ en:
write_message_placeholder: "Write your message here"
write_message_to_administration_placeholder: "Write your message to the administration here"
demande:
en_construction: "File submission date"
updated_at: "updated at %{updated_at}"
requester_identity: "Identity of the requester"
my_identity: "My identity"
form: "Form"

View file

@ -330,6 +330,8 @@ fr:
hello: Bonjour,
best_regards: Bonne journée,
dossiers:
form:
updated_at: "modifié le %{datetime}"
edit:
autosave: Votre dossier est enregistré automatiquement après chaque modification. Vous pouvez à tout moment fermer la fenêtre et reprendre plus tard là où vous en étiez.
notice: Télécharger le guide de la démarche
@ -342,7 +344,6 @@ fr:
write_message_to_administration_placeholder: "Écrivez votre message à ladministration ici"
demande:
en_construction: "Date de dépôt du dossier"
updated_at: "mis à jour le %{updated_at}"
requester_identity: "Identité du demandeur"
my_identity: "Mon identité"
form: "Sections du formulaire"
@ -692,6 +693,10 @@ fr:
time:
formats:
default: "%d %B %Y %R"
long: "%d %B %y %H:%m"
datetime:
formats:
long: "%d %B %y %H:%m"
pluralize:
case:
one: dossier