From ab4b201fcb3d3d008e05c8a034f0eeb6c8209451 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Thu, 23 May 2024 11:38:27 +0200 Subject: [PATCH 1/2] fix(toggle): render label in 1 line --- app/assets/stylesheets/dsfr.scss | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/stylesheets/dsfr.scss b/app/assets/stylesheets/dsfr.scss index 89e2e966b..11343be43 100644 --- a/app/assets/stylesheets/dsfr.scss +++ b/app/assets/stylesheets/dsfr.scss @@ -179,3 +179,10 @@ button.fr-tag-bug { border: initial; display: block; // Pour cette valeur spécifique, on récupère celle de .fr-label } + +// Fix toggles having labels on 2 lines +// From upstream https://github.com/GouvernementFR/dsfr/pull/928 +// Remove it when PR is merged (v1.12 ?) +.fr-toggle label[data-fr-unchecked-label][data-fr-checked-label]::before { + word-wrap: normal; +} From fa91987e3d0bf7a930a7442e19bf706e8f60fd19 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Thu, 23 May 2024 11:39:56 +0200 Subject: [PATCH 2/2] fix(toggle): class markup & label on left for attestation v2 --- .../release_note/form_component/form_component.html.haml | 2 +- .../administrateurs/attestation_template_v2s/edit.html.haml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/components/release_note/form_component/form_component.html.haml b/app/components/release_note/form_component/form_component.html.haml index 2a78072ff..94d74ff9c 100644 --- a/app/components/release_note/form_component/form_component.html.haml +++ b/app/components/release_note/form_component/form_component.html.haml @@ -6,7 +6,7 @@ .fr-fieldset__element .fr-toggle - = f.check_box :published, class: "fr-toggle-input", id: dom_id(release_note, :published) + = f.check_box :published, class: "fr-toggle__input", id: dom_id(release_note, :published) %label.fr-toggle__label{ for: dom_id(release_note, :published), data: { fr_checked_label: "Publié", fr_unchecked_label: "Brouillon" } } Publier diff --git a/app/views/administrateurs/attestation_template_v2s/edit.html.haml b/app/views/administrateurs/attestation_template_v2s/edit.html.haml index 308dca5e4..daa69b7c6 100644 --- a/app/views/administrateurs/attestation_template_v2s/edit.html.haml +++ b/app/views/administrateurs/attestation_template_v2s/edit.html.haml @@ -38,8 +38,8 @@ %h2.fr-h4 En-tête .fr-fieldset__element - .fr-toggle - = f.check_box :official_layout, class: "fr-toggle-input", id: dom_id(@attestation_template, :official_layout), data: { "attestation-target": "layoutToggle"} + .fr-toggle.fr-toggle--label-left + = f.check_box :official_layout, class: "fr-toggle__input", id: dom_id(@attestation_template, :official_layout), data: { "attestation-target": "layoutToggle"} %label.fr-toggle__label{ for: dom_id(@attestation_template, :official_layout), data: { fr_checked_label: "Activé", fr_unchecked_label: "Désactivé" } } Je souhaite générer une attestation à la charte de l’état (logo avec Marianne)