Skip to content

Commit

Permalink
fix(admin): zones selector checkbox as dsfr
Browse files Browse the repository at this point in the history
  • Loading branch information
colinux committed Sep 5, 2023
1 parent 08bb62d commit 5e99250
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
7 changes: 0 additions & 7 deletions app/assets/stylesheets/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 15 additions & 13 deletions app/views/administrateurs/procedures/zones.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
4 changes: 2 additions & 2 deletions spec/system/administrateurs/procedure_cloning_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

# 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
Expand Down Expand Up @@ -82,7 +82,7 @@

# 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
Expand Down

0 comments on commit 5e99250

Please sign in to comment.