feat(simple routing): add options of list tdcs in tooltip
This commit is contained in:
parent
4e8200aaf7
commit
304fb9ecef
3 changed files with 11 additions and 5 deletions
|
@ -18,7 +18,7 @@ class Dsfr::RadioButtonListComponent < ApplicationComponent
|
|||
|
||||
def each_button
|
||||
@buttons.each do |button|
|
||||
yield(*button.values_at(:label, :value, :hint), **button.except(:label, :value, :hint))
|
||||
yield(*button.values_at(:label, :value, :hint, :tooltip), **button.except(:label, :value, :hint, :tooltip))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
%fieldset{ class: class_names("fr-fieldset": true, "fr-fieldset--error": error?), 'aria-labelledby': 'radio-hint-element-legend radio-hint-element-messages', role: error? ? :group : nil }
|
||||
%legend.fr-fieldset__legend--regular.fr-fieldset__legend
|
||||
= content
|
||||
|
||||
- each_button do |label, value, hint, **button_options|
|
||||
- index = 0
|
||||
- each_button do |label, value, hint, tooltip, **button_options|
|
||||
- index += 1
|
||||
.fr-fieldset__element
|
||||
.fr-radio-group
|
||||
= @form.radio_button @target, value, **button_options
|
||||
|
@ -12,7 +13,12 @@
|
|||
|
||||
= button_options[:after_label] if button_options[:after_label]
|
||||
|
||||
%span.fr-hint-text= hint if hint
|
||||
- if hint.present?
|
||||
.flex
|
||||
.fr-hint-text= hint
|
||||
- if tooltip.present?
|
||||
.fr-icon-information-line.fr-icon--sm.ml-1{ 'aria-describedby': "tooltip-#{index}" }
|
||||
%span.fr-tooltip.fr-placement{ id: "tooltip-#{index}", role: 'tooltip', 'aria-hidden': 'true' }= tooltip
|
||||
|
||||
.fr-messages-group{ 'aria-live': 'assertive' }
|
||||
- if error?
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
.card.fr-pb-0{ data: { 'action': "click->enable-submit-if-checked#click" } }
|
||||
.notice
|
||||
Sélectionner le champ à partir duquel créer des groupes d’instructeurs
|
||||
- buttons_content = @procedure.active_revision.simple_routable_types_de_champ.map { |tdc| { label: tdc.libelle, value: tdc.stable_id, hint: "[#{I18n.t(tdc.type_champ, scope: 'activerecord.attributes.type_de_champ.type_champs')}]"} }
|
||||
- buttons_content = @procedure.active_revision.simple_routable_types_de_champ.map { |tdc| { label: tdc.libelle, value: tdc.stable_id, hint: "[#{I18n.t(tdc.type_champ, scope: 'activerecord.attributes.type_de_champ.type_champs')}]", tooltip: tdc.drop_down_options.join(", ")} }
|
||||
= render Dsfr::RadioButtonListComponent.new(form: f,
|
||||
target: :stable_id,
|
||||
buttons: buttons_content)
|
||||
|
|
Loading…
Reference in a new issue