amelioration(champ.explication): ajout du support pour avoir un menu depliant avec plus d'information sur un champs explication
amelioration(champ.explication): ajout du support pour avoir un menu depliant avec plus d'information sur un champs explication
This commit is contained in:
parent
fe0411203f
commit
df54dc04a4
3 changed files with 17 additions and 7 deletions
|
@ -3,16 +3,17 @@ class Dsfr::CalloutComponent < ApplicationComponent
|
|||
renders_one :body
|
||||
renders_one :bottom
|
||||
|
||||
attr_reader :title, :theme, :icon
|
||||
attr_reader :title, :theme, :icon, :extra_class_names
|
||||
|
||||
def initialize(title:, theme: :info, icon: nil)
|
||||
def initialize(title:, theme: :info, icon: nil, extra_class_names: nil)
|
||||
@title = title
|
||||
@theme = theme
|
||||
@icon = icon
|
||||
@extra_class_names = extra_class_names
|
||||
end
|
||||
|
||||
def callout_class
|
||||
["fr-callout", theme_class, icon]
|
||||
["fr-callout", theme_class, icon, extra_class_names].compact.flatten
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
%h2.explication-libelle= @champ.libelle
|
||||
.explication
|
||||
= string_to_html(@champ.description)
|
||||
= render Dsfr::CalloutComponent.new(title: @champ.libelle, extra_class_names: ['fr-mb-2w', 'fr-callout--blue-cumulus']) do |c|
|
||||
- c.with_body do
|
||||
|
||||
= string_to_html(@champ.description)
|
||||
|
||||
- if @champ.collapsible_explanation_enabled? && @champ.collapsible_explanation_text.present?
|
||||
%div
|
||||
%p.fr-my-2w
|
||||
%button{type: "button", "aria-controls" => "champs-text-#{@champ.id}", "aria-expanded" => "false", href: "#champs-text-#{@champ.id}"} Lire plus
|
||||
%p.fr-collapse{ id: "champs-text-#{@champ.id}"}
|
||||
= @champ.collapsible_explanation_text
|
||||
|
|
|
@ -42,8 +42,9 @@ class Champ < ApplicationRecord
|
|||
:drop_down_list_enabled_non_empty_options,
|
||||
:drop_down_secondary_libelle,
|
||||
:drop_down_secondary_description,
|
||||
:collapsible_explanation_text,
|
||||
:collapsible_explanation_enabled,
|
||||
:collapsible_explanation_enabled?,
|
||||
:collapsible_explanation_text,
|
||||
:exclude_from_export?,
|
||||
:exclude_from_view?,
|
||||
:repetition?,
|
||||
|
|
Loading…
Add table
Reference in a new issue