refactor(fc_info): use Dsfr::Notice for france connect informations
This commit is contained in:
parent
ab82128585
commit
fcb478eb53
15 changed files with 73 additions and 77 deletions
|
@ -1,12 +0,0 @@
|
||||||
@import "constants";
|
|
||||||
|
|
||||||
.france-connect-informations.card {
|
|
||||||
width: 100%;
|
|
||||||
padding-top: $default-spacer;
|
|
||||||
padding-bottom: $default-spacer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.france-connect-informations-logo img {
|
|
||||||
width: 100px;
|
|
||||||
margin-right: $default-padding;
|
|
||||||
}
|
|
|
@ -115,4 +115,16 @@ module DossierHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def france_connect_informations(user_information)
|
||||||
|
if user_information.full_name.empty?
|
||||||
|
t("shared.dossiers.france_connect_informations.details_no_name")
|
||||||
|
elsif user_information.updated_at.present?
|
||||||
|
t("shared.dossiers.france_connect_informations.details_updated",
|
||||||
|
name: user_information.full_name,
|
||||||
|
date: l(user_information.updated_at.to_date, format: :default))
|
||||||
|
else
|
||||||
|
t("shared.dossiers.france_connect_informations.details", name: user_information.full_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -100,3 +100,6 @@
|
||||||
%li.fr-nav__item= active_link_to t('.files'), dossiers_path, active: :inclusive, class: 'fr-nav__link'
|
%li.fr-nav__item= active_link_to t('.files'), dossiers_path, active: :inclusive, class: 'fr-nav__link'
|
||||||
- if current_user.expert && current_expert.avis_summary[:total] > 0
|
- if current_user.expert && current_expert.avis_summary[:total] > 0
|
||||||
= render partial: 'layouts/header/avis_tab', locals: { current_expert: current_expert }
|
= render partial: 'layouts/header/avis_tab', locals: { current_expert: current_expert }
|
||||||
|
|
||||||
|
= yield(:notice_info)
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
= render partial: "layouts/header"
|
= render partial: "layouts/header"
|
||||||
%main{ role: :main }
|
%main{ role: :main }
|
||||||
= render partial: "layouts/flash_messages"
|
= render partial: "layouts/flash_messages"
|
||||||
|
|
||||||
= content_for?(:content) ? yield(:content) : yield
|
= content_for?(:content) ? yield(:content) : yield
|
||||||
|
|
||||||
- if content_for?(:footer)
|
- if content_for?(:footer)
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
- if dossier.france_connect_information.present?
|
||||||
|
- content_for(:notice_info) do
|
||||||
|
= render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.france_connect_information }
|
||||||
|
|
||||||
.container
|
.container
|
||||||
- if dossier.depose_at.present?
|
- if dossier.depose_at.present?
|
||||||
.card
|
.card
|
||||||
|
@ -11,9 +15,6 @@
|
||||||
modifié le
|
modifié le
|
||||||
= try_format_datetime(dossier.identity_updated_at)
|
= try_format_datetime(dossier.identity_updated_at)
|
||||||
|
|
||||||
- if dossier.france_connect_information.present?
|
|
||||||
= render partial: "shared/dossiers/france_connect_informations", locals: { user_information: dossier.france_connect_information }
|
|
||||||
|
|
||||||
.card
|
.card
|
||||||
= render partial: "shared/dossiers/user_infos", locals: { user_deleted: dossier.user_deleted?, email: dossier.user_email_for(:display) }
|
= render partial: "shared/dossiers/user_infos", locals: { user_deleted: dossier.user_deleted?, email: dossier.user_email_for(:display) }
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
- if dossier.france_connect_information.present?
|
||||||
|
- content_for(:notice_info) do
|
||||||
|
= render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.france_connect_information }
|
||||||
|
|
||||||
.dossier-edit.container
|
.dossier-edit.container
|
||||||
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: dossier }
|
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: dossier }
|
||||||
|
|
||||||
|
@ -22,9 +26,6 @@
|
||||||
class: "fr-btn fr-btn--secondary mt-2",
|
class: "fr-btn fr-btn--secondary mt-2",
|
||||||
title: t("views.shared.dossiers.edit.notice_title"), **external_link_attributes
|
title: t("views.shared.dossiers.edit.notice_title"), **external_link_attributes
|
||||||
|
|
||||||
- if dossier.france_connect_information.present?
|
|
||||||
= render partial: "shared/dossiers/france_connect_informations", locals: { user_information: dossier.france_connect_information }
|
|
||||||
|
|
||||||
- if dossier.show_groupe_instructeur_selector?
|
- if dossier.show_groupe_instructeur_selector?
|
||||||
%span{ data: { controller: 'autosave' } }
|
%span{ data: { controller: 'autosave' } }
|
||||||
= f.label :groupe_instructeur_id do
|
= f.label :groupe_instructeur_id do
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
.fr-tile.fr-tile--horizontal.mb-4
|
|
||||||
.fr-tile__body
|
|
||||||
%h4.fr-tile__title
|
|
||||||
FranceConnect
|
|
||||||
%p
|
|
||||||
- if user_information.full_name.empty?
|
|
||||||
= t("views.shared.dossiers.france_connect_informations.details_no_name")
|
|
||||||
- elsif user_information.updated_at.present?
|
|
||||||
= t("views.shared.dossiers.france_connect_informations.details_updated", name: user_information.full_name, date: l(user_information.updated_at.to_date, format: :default))
|
|
||||||
- else
|
|
||||||
= t("views.shared.dossiers.france_connect_informations.details", name: user_information.full_name)
|
|
||||||
.fr-tile__img
|
|
||||||
= image_tag "logo-france-connect.png", alt: "", class: "fr-responsive-img"
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
= render Dsfr::NoticeComponent.new(closable: true) do |c|
|
||||||
|
- c.with_title do
|
||||||
|
= france_connect_informations(user_information)
|
|
@ -145,10 +145,6 @@ fr:
|
||||||
form: "Formulaire"
|
form: "Formulaire"
|
||||||
edit_siret: "Modifier le SIRET"
|
edit_siret: "Modifier le SIRET"
|
||||||
edit_identity: "Modifier l’identité"
|
edit_identity: "Modifier l’identité"
|
||||||
france_connect_informations:
|
|
||||||
details_no_name: "Le dossier a été déposé par un compte FranceConnect."
|
|
||||||
details: "Le dossier a été déposé par le compte de %{name}."
|
|
||||||
details_updated: "Le dossier a été déposé par le compte de %{name}, authentifié par FranceConnect le %{date}."
|
|
||||||
instructeurs:
|
instructeurs:
|
||||||
dossiers:
|
dossiers:
|
||||||
tab_steps:
|
tab_steps:
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
en:
|
en:
|
||||||
shared:
|
shared:
|
||||||
dossiers:
|
dossiers:
|
||||||
|
france_connect_informations:
|
||||||
|
details_no_name: "The file was submitted by a FranceConnect account."
|
||||||
|
details: "The file was submitted by the account of %{name}."
|
||||||
|
details_updated: "The file was submitted by the account of %{name}, authenticated by FranceConnect on %{date}."
|
||||||
header:
|
header:
|
||||||
expires_at:
|
expires_at:
|
||||||
brouillon: "Expires on %{date} (%{duree_conservation_totale} months after this file was created)"
|
brouillon: "Expires on %{date} (%{duree_conservation_totale} months after this file was created)"
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
fr:
|
fr:
|
||||||
shared:
|
shared:
|
||||||
dossiers:
|
dossiers:
|
||||||
|
france_connect_informations:
|
||||||
|
details_no_name: "Le dossier a été déposé par un compte FranceConnect."
|
||||||
|
details: "Le dossier a été déposé par le compte de %{name}."
|
||||||
|
details_updated: "Le dossier a été déposé par le compte de %{name}, authentifié par FranceConnect le %{date}."
|
||||||
header:
|
header:
|
||||||
expires_at:
|
expires_at:
|
||||||
brouillon: "Expirera le %{date} (%{duree_conservation_totale} mois après la création du dossier)"
|
brouillon: "Expirera le %{date} (%{duree_conservation_totale} mois après la création du dossier)"
|
||||||
|
|
|
@ -215,4 +215,40 @@ RSpec.describe DossierHelper, type: :helper do
|
||||||
it { is_expected.to eq('without_continuation') }
|
it { is_expected.to eq('without_continuation') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe ".france_connect_information" do
|
||||||
|
subject { france_connect_informations(user_information) }
|
||||||
|
|
||||||
|
context "with complete france_connect information" do
|
||||||
|
let(:user_information) { build(:france_connect_information, updated_at: Time.zone.now) }
|
||||||
|
it {
|
||||||
|
expect(subject).to have_text("Le dossier a été déposé par le compte de #{user_information.given_name} #{user_information.family_name}, authentifié par FranceConnect le #{user_information.updated_at.strftime('%d/%m/%Y')}")
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with missing updated_at" do
|
||||||
|
let(:user_information) { build(:france_connect_information, updated_at: nil) }
|
||||||
|
|
||||||
|
it {
|
||||||
|
expect(subject).to have_text("Le dossier a été déposé par le compte de #{user_information.given_name} #{user_information.family_name}")
|
||||||
|
expect(subject).not_to have_text("authentifié par FranceConnect le ")
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with missing given_name" do
|
||||||
|
let(:user_information) { build(:france_connect_information, given_name: nil) }
|
||||||
|
|
||||||
|
it {
|
||||||
|
expect(subject).to have_text("Le dossier a été déposé par le compte de #{user_information.family_name}")
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with all names missing" do
|
||||||
|
let(:user_information) { build(:france_connect_information, given_name: nil, family_name: nil) }
|
||||||
|
|
||||||
|
it {
|
||||||
|
expect(subject).to have_text("Le dossier a été déposé par un compte FranceConnect.")
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,7 +30,7 @@ describe 'instructeurs/dossiers/show.html.haml', type: :view do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fills the individual with the informations from France Connect' do
|
it 'fills the individual with the informations from France Connect' do
|
||||||
expect(rendered).to have_text("Le dossier a été déposé par le compte de #{france_connect_information.given_name} #{france_connect_information.family_name}, authentifié par FranceConnect le #{france_connect_information.updated_at.strftime('%d/%m/%Y')}")
|
expect(view.content_for(:notice_info)).to have_text("Le dossier a été déposé par le compte de #{france_connect_information.given_name} #{france_connect_information.family_name}, authentifié par FranceConnect le #{france_connect_information.updated_at.strftime('%d/%m/%Y')}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
describe 'shared/dossiers/france_connect_informations.html.haml', type: :view do
|
|
||||||
subject do
|
|
||||||
render(
|
|
||||||
'shared/dossiers/france_connect_informations.html.haml',
|
|
||||||
user_information: user_information
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with complete france_connect information" do
|
|
||||||
let(:user_information) { build(:france_connect_information, updated_at: Time.zone.now) }
|
|
||||||
it {
|
|
||||||
expect(subject).to have_text("Le dossier a été déposé par le compte de #{user_information.given_name} #{user_information.family_name}, authentifié par FranceConnect le #{user_information.updated_at.strftime('%d/%m/%Y')}")
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with missing updated_at" do
|
|
||||||
let(:user_information) { build(:france_connect_information, updated_at: nil) }
|
|
||||||
|
|
||||||
it {
|
|
||||||
expect(subject).to have_text("Le dossier a été déposé par le compte de #{user_information.given_name} #{user_information.family_name}")
|
|
||||||
expect(subject).not_to have_text("authentifié par FranceConnect le ")
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with missing given_name" do
|
|
||||||
let(:user_information) { build(:france_connect_information, given_name: nil) }
|
|
||||||
|
|
||||||
it {
|
|
||||||
expect(subject).to have_text("Le dossier a été déposé par le compte de #{user_information.family_name}")
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with all names missing" do
|
|
||||||
let(:user_information) { build(:france_connect_information, given_name: nil, family_name: nil) }
|
|
||||||
|
|
||||||
it {
|
|
||||||
expect(subject).to have_text("Le dossier a été déposé par un compte FranceConnect.")
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -45,7 +45,7 @@ describe 'users/dossiers/demande.html.haml', type: :view do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fills the individual with the informations from France Connect' do
|
it 'fills the individual with the informations from France Connect' do
|
||||||
expect(rendered).to have_text("Le dossier a été déposé par le compte de #{france_connect_information.given_name} #{france_connect_information.family_name}, authentifié par FranceConnect le #{france_connect_information.updated_at.strftime('%d/%m/%Y')}")
|
expect(view.content_for(:notice_info)).to have_text("Le dossier a été déposé par le compte de #{france_connect_information.given_name} #{france_connect_information.family_name}, authentifié par FranceConnect le #{france_connect_information.updated_at.strftime('%d/%m/%Y')}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue