dsfr-view-components 4.1.1 → 4.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19d3e1841b16361d23f4bb0fad549e2da2537e0e2fbfdd3e217b38e39c543490
4
- data.tar.gz: d2df597a2cde398651b95ce5716963c9d0a61a3e4550226b7d471c81a65adaa9
3
+ metadata.gz: 873667314f4b7d169a2d6cd0760fe744fea427da377b58d201aacf3da2aa9d8e
4
+ data.tar.gz: a9ee0eaae9221889fd7a6f2bb0ccf3cf26f9020992a077ce406374058151b08a
5
5
  SHA512:
6
- metadata.gz: 27a7c59c51b5bf95974ad169790c21b0f69d090e1968345c6f2f223071aaf70c75a9dd4276ce90a5803a61a1bf716a4f85ff7961c826db66f79a8a098705d52d
7
- data.tar.gz: af64ba7667e3f608563e17ceb1733ce41aff87323f862fbb6ea9fa48fe1823d5a61fa26922c78368c1cdc7159534070b04c78066df9906b1e5f4f24c91db5fe6
6
+ metadata.gz: 5470fa0cf66b1f852849410a34a2759e7fa3f4fe5e07d76e21bd46875f5832a11bd9a163ce34a36b6c91035d6416608dda1f62565753026df6dbf60bbf2cae87
7
+ data.tar.gz: 760dab08a5106766c2a892028841237e47fa21f8fa5cb43cc7a8aa0e4327f5d2a1c252cca54c18caa5a432b44b26bcd939c948bbea35c4cb6fd94ca511d2af0b
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
- VERSION=1.3.2 make deploy_gem
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).
@@ -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 limage.
5
- def initialize(title:, src:, alt:, html_attributes: {})
6
- @title = title
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
- tag.a(href: "/", title: title) do
16
- tag.img(class: "fr-responsive-img", src: src, alt: alt, style: "max-width:9.0625rem;")
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 :title, :src, :alt
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
- <a href="/" title="Accueil - <%= title %>">
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
- </a>
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' }
@@ -1,15 +1,17 @@
1
1
  <%= tag.div(**html_attributes) do %>
2
2
  <div class="fr-tile__body">
3
- <%= title_tag(class: "fr-tile__title") do %>
4
- <a class="fr-tile__link" href="<%= url %>">
5
- <%= title %>
6
- </a>
7
- <% end %>
8
- <% if description.present? %>
9
- <p class="fr-tile__desc">
10
- <%= description %>
11
- </p>
12
- <% end %>
3
+ <div class="fr-tile__content">
4
+ <%= title_tag(class: "fr-tile__title") do %>
5
+ <a class="fr-tile__link" href="<%= url %>">
6
+ <%= title %>
7
+ </a>
8
+ <% end %>
9
+ <% if description.present? %>
10
+ <p class="fr-tile__desc">
11
+ <%= description %>
12
+ </p>
13
+ <% end %>
14
+ </div>
13
15
  </div>
14
16
  <% if image_src.present? %>
15
17
  <div class="fr-tile__img">
@@ -1,5 +1,5 @@
1
1
  module Dsfr
2
2
  module Components
3
- VERSION = '4.1.1'.freeze
3
+ VERSION = '4.1.3'.freeze
4
4
  end
5
5
  end
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.1.1
4
+ version: 4.1.3
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-01-19 00:00:00.000000000 Z
11
+ date: 2026-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-attributes-utils