dsfr-view-components 4.1 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/app/components/dsfr_component/callout_component.rb +8 -4
- data/app/components/dsfr_component/header_component/operator_image_component.rb +17 -7
- data/app/components/dsfr_component/header_component.html.erb +6 -2
- data/app/components/dsfr_component/header_component.rb +5 -3
- data/lib/dsfr/components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94acefdbfb44e3b82ead2607d6f029c4b9b8cce821d8046e60a1de961198b27c
|
|
4
|
+
data.tar.gz: 346b80e0c0b76d24a8e99e6327ef19cf32fbefec6f7efc6e1102cdf38801c655
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1535dd3b9067ff15f285dca33b9cfce4bc5e201c4cc8a4244b663df908e2e3952543912842343039396995dc75a728499094fc1dede744cede8b39d4a497ed30
|
|
7
|
+
data.tar.gz: 473054e68ea1572852734c3271bf587b53e575d7dc96f578f4bc8d20e0184b3166708b11da88aa042bfdfc65bd57a4ddab290efed3eaccfc990106364a34bfa2
|
data/README.md
CHANGED
|
@@ -87,10 +87,16 @@ bundle exec rails server
|
|
|
87
87
|
|
|
88
88
|
Déployer une nouvelle version de la gem :
|
|
89
89
|
|
|
90
|
+
1. Mettre à jour la version dans `lib/dsfr/components/version.rb`
|
|
91
|
+
2. Commiter ce changement
|
|
92
|
+
3. Lancer la commande :
|
|
93
|
+
|
|
90
94
|
```sh
|
|
91
|
-
|
|
95
|
+
bundle exec rake release
|
|
92
96
|
```
|
|
93
97
|
|
|
98
|
+
puis allez sur https://github.com/betagouv/dsfr-view-components/releases pour créer une release manuellement basée sur le tag tout juste créé.
|
|
99
|
+
|
|
94
100
|
## Licence
|
|
95
101
|
|
|
96
102
|
Le code source et la gem sont ouverts sous la licence [MIT](https://opensource.org/licenses/MIT).
|
|
@@ -6,17 +6,20 @@ module DsfrComponent
|
|
|
6
6
|
|
|
7
7
|
renders_one :action_zone
|
|
8
8
|
|
|
9
|
-
# @param title [String] Le titre de la mise en avant
|
|
10
|
-
# @param icon_name [String] Le nom de l
|
|
9
|
+
# @param title [String] Le titre de la mise en avant (optionnel)
|
|
10
|
+
# @param icon_name [String] Le nom de l'icône à afficher (exemple `arrow-right-line`), ou `:none` pour la désactiver (optionnel)
|
|
11
|
+
# @param accent [String] La couleur d'accent (exemple `green-tilleul-verveine`) (optionnel)
|
|
11
12
|
# @param header_level [Integer] Le niveau de titre (optionnel)
|
|
12
13
|
def initialize(
|
|
13
|
-
title
|
|
14
|
+
title: nil,
|
|
14
15
|
icon_name: "information-line",
|
|
16
|
+
accent: nil,
|
|
15
17
|
header_level: nil,
|
|
16
18
|
html_attributes: {}
|
|
17
19
|
)
|
|
18
20
|
@title = title
|
|
19
21
|
@icon_name = icon_name
|
|
22
|
+
@accent = accent
|
|
20
23
|
self.header_level = header_level
|
|
21
24
|
|
|
22
25
|
super(html_attributes: html_attributes)
|
|
@@ -24,7 +27,7 @@ module DsfrComponent
|
|
|
24
27
|
|
|
25
28
|
def call
|
|
26
29
|
tag.div(**html_attributes) do
|
|
27
|
-
concat content_tag(header_tag, @title, class: 'fr-callout__title')
|
|
30
|
+
concat content_tag(header_tag, @title, class: 'fr-callout__title') if @title
|
|
28
31
|
|
|
29
32
|
concat content_tag(:p, content, class: 'fr-callout__text')
|
|
30
33
|
|
|
@@ -38,6 +41,7 @@ module DsfrComponent
|
|
|
38
41
|
classes = ["fr-callout"]
|
|
39
42
|
|
|
40
43
|
classes.push("fr-icon-#{@icon_name}") unless @icon_name == :none
|
|
44
|
+
classes.push("fr-callout--#{@accent}") if @accent
|
|
41
45
|
|
|
42
46
|
{ class: classes.join(" ") }
|
|
43
47
|
end
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
class DsfrComponent::HeaderComponent::OperatorImageComponent < DsfrComponent::Base
|
|
2
|
-
# @param title [String] Le title du lien vers la page d'accueil du site
|
|
3
2
|
# @param src [String] L'attribut src qui sera passé au tag img
|
|
4
|
-
# @param alt [String] Le texte alternatif qui sera passé au tag img. Il doit impérativement contenir le texte présent dans l
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
# @param alt [String] Le texte alternatif qui sera passé au tag img. Il doit impérativement contenir le texte présent dans l'image.
|
|
4
|
+
# @param href [String, nil] L'URL du lien vers la page d'accueil du site. Passer nil pour ne pas rendre de lien.
|
|
5
|
+
# @param title [String] Le title du lien vers la page d'accueil du site. Ignoré si href est nil.
|
|
6
|
+
def initialize(src:, alt:, href: "/", title: nil, html_attributes: {})
|
|
7
7
|
@src = src
|
|
8
8
|
@alt = alt
|
|
9
|
+
@href = href
|
|
10
|
+
@title = title
|
|
9
11
|
|
|
10
12
|
super(html_attributes: html_attributes)
|
|
11
13
|
end
|
|
12
14
|
|
|
13
15
|
def call
|
|
14
16
|
tag.div(class: "fr-header__operator") do
|
|
15
|
-
|
|
16
|
-
tag.
|
|
17
|
+
if href
|
|
18
|
+
tag.a(href: href, title: title) do
|
|
19
|
+
image_tag
|
|
20
|
+
end
|
|
21
|
+
else
|
|
22
|
+
image_tag
|
|
17
23
|
end
|
|
18
24
|
end
|
|
19
25
|
end
|
|
@@ -24,5 +30,9 @@ class DsfrComponent::HeaderComponent::OperatorImageComponent < DsfrComponent::Ba
|
|
|
24
30
|
|
|
25
31
|
private
|
|
26
32
|
|
|
27
|
-
attr_reader :
|
|
33
|
+
attr_reader :src, :alt, :href, :title
|
|
34
|
+
|
|
35
|
+
def image_tag
|
|
36
|
+
tag.img(class: "fr-responsive-img", src: src, alt: alt, style: "max-width:9.0625rem;")
|
|
37
|
+
end
|
|
28
38
|
end
|
|
@@ -31,9 +31,13 @@
|
|
|
31
31
|
|
|
32
32
|
<% if title %>
|
|
33
33
|
<div class="fr-header__service">
|
|
34
|
-
|
|
34
|
+
<% if href %>
|
|
35
|
+
<a href="<%= href %>" title="Accueil - <%= title %>">
|
|
36
|
+
<p class="fr-header__service-title"><%= title %></p>
|
|
37
|
+
</a>
|
|
38
|
+
<% else %>
|
|
35
39
|
<p class="fr-header__service-title"><%= title %></p>
|
|
36
|
-
|
|
40
|
+
<% end %>
|
|
37
41
|
<% if tagline %>
|
|
38
42
|
<p class="fr-header__service-tagline"><%= tagline %></p>
|
|
39
43
|
<% end %>
|
|
@@ -9,11 +9,13 @@ class DsfrComponent::HeaderComponent < DsfrComponent::Base
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
# @param logo_text [String] Ce texte obligatoire sera affiché en dessous de la Marianne et au dessus de la devise française. C’est généralement un nom de ministère ou d’administration.
|
|
12
|
-
# @param title [String] Le nom du service numérique, titre principal du site.
|
|
12
|
+
# @param title [String] Le nom du service numérique, titre principal du site (optionnel).
|
|
13
|
+
# @param href [String] L'URL de la page d'accueil du site. Par défaut "/". Passer nil pour ne pas rendre de lien.
|
|
13
14
|
# @param tagline [String] La description du service numérique, sous-titre du site (optionnelle).
|
|
14
|
-
def initialize(logo_text:, title: nil, tagline: nil, html_attributes: {})
|
|
15
|
+
def initialize(logo_text:, title: nil, href: "/", tagline: nil, html_attributes: {})
|
|
15
16
|
@logo_text = logo_text
|
|
16
17
|
@title = title
|
|
18
|
+
@href = href
|
|
17
19
|
@tagline = tagline
|
|
18
20
|
|
|
19
21
|
super(html_attributes: html_attributes)
|
|
@@ -21,7 +23,7 @@ class DsfrComponent::HeaderComponent < DsfrComponent::Base
|
|
|
21
23
|
|
|
22
24
|
private
|
|
23
25
|
|
|
24
|
-
attr_reader :logo_text, :title, :tagline
|
|
26
|
+
attr_reader :logo_text, :title, :href, :tagline
|
|
25
27
|
|
|
26
28
|
def default_attributes
|
|
27
29
|
{ class: 'fr-header', role: 'banner' }
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dsfr-view-components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- BetaGouv developers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-02-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: html-attributes-utils
|