fix(admin): zones selector checkbox as dsfr

This commit is contained in:
Colin Darie 2023-09-05 10:33:08 +02:00
parent 08bb62d417
commit 5e99250546
3 changed files with 17 additions and 22 deletions

View file

@ -117,13 +117,6 @@
visibility: visible;
}
// Move checkbox to the top-left side of the label
&.editable-champ-checkbox {
label.admin-default-zone {
font-weight: bold;
}
}
&.editable-champ-checkbox {
label {
font-weight: normal;

View file

@ -7,24 +7,26 @@
.container
= form_for @procedure,
url: url_for({ controller: 'administrateurs/procedures', action: :update, id: @procedure.id }),
html: { multipart: true, class: 'form' } do |f|
html: { multipart: true } do |f|
%h1.page-title Zones
= f.label :zone do
= t('zone', scope: 'activerecord.attributes.procedure')
- if Rails.application.config.ds_zonage_enabled
= f.collection_check_boxes :zone_ids, current_administrateur.default_zones, :id, :current_label do |b|
.editable-champ.editable-champ-checkbox
= b.check_box
= b.label class: "admin-default-zone"
= f.collection_check_boxes :zone_ids, Zone.available_at(@procedure.published_or_created_at, current_administrateur.default_zones), :id, :label do |b|
.editable-champ.editable-champ-checkbox
= b.check_box
= b.label
%fieldset.fr-fieldset{ aria: { labelledby: "zones-legend"} }
%legend#zones-legend.fr-fieldset__legend--regular.fr-fieldset__legend= t('zone', scope: 'activerecord.attributes.procedure')
= f.collection_check_boxes :zone_ids, current_administrateur.default_zones, :id, :current_label do |b|
.fr-fieldset__element
.fr-checkbox-group
= b.check_box
= b.label class: "fr-label font-weight-bold"
= f.collection_check_boxes :zone_ids, Zone.available_at(@procedure.published_or_created_at, current_administrateur.default_zones), :id, :label do |b|
.fr-fieldset__element
.fr-checkbox-group
= b.check_box
= b.label class: "fr-label"
.procedure-form__actions.sticky--bottom
.actions-right
= link_to 'Annuler', admin_procedure_path(id: @procedure), class: 'button', data: { confirm: 'Êtes-vous sûr de vouloir annuler les modifications effectuées ?'}
= f.button 'Enregistrer', class: 'button primary send'
= link_to 'Annuler', admin_procedure_path(id: @procedure), class: 'fr-btn fr-btn--tertiary fr-mr-2w', data: { confirm: 'Êtes-vous sûr de vouloir annuler les modifications effectuées ?'}
= f.button 'Enregistrer', class: 'fr-btn fr-btn--primary'

View file

@ -47,7 +47,7 @@ describe 'As an administrateur I wanna clone a procedure', js: true, retry: 3 do
# select zone
find("#zones .fr-btn").click
check Zone.last.current_label
check Zone.last.current_label, allow_label_click: true
click_on 'Enregistrer'
# then publish
@ -82,7 +82,7 @@ describe 'As an administrateur I wanna clone a procedure', js: true, retry: 3 do
# select zone
find("#zones .fr-btn").click
check Zone.last.current_label
check Zone.last.current_label, allow_label_click: true
click_on 'Enregistrer'
# then publish