dsfr-view-components 0.4.0 → 0.5.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62caf05fb2d8034f4bd78b467ebab04068bdcf27bfaf9c15827cce763d6a03e5
|
4
|
+
data.tar.gz: 23cb9c6650a6a172262b559e9976df0a5404e7fe7d6bfa25f1613cd4009b7ae6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3901f40fd5fb24435e85f8e1483a6d6dc1b37c98e28b6d968fda18a46423aaa88d02666526d799813178485ec08b100737ac4b3feb8fa75978fb21e5fcf778c8
|
7
|
+
data.tar.gz: da3c387fc20ee9c1af2f0cbff604de4dfdfabbc37606b0778a3deecb65872028a61de6aec6bf972e58ecc53cc5ac3dfab3f78c70a9d303ce96864e4fa6d8b684
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class DsfrComponent::HeaderComponent::OperatorImageComponent < DsfrComponent::Base
|
2
|
+
# @param title [String] Le title du lien vers la page d'accueil du site
|
3
|
+
# @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’image.
|
5
|
+
def initialize(title:, src:, alt:, classes: [], html_attributes: {})
|
6
|
+
@title = title
|
7
|
+
@src = src
|
8
|
+
@alt = alt
|
9
|
+
|
10
|
+
super(classes: classes, html_attributes: html_attributes)
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
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
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def default_attributes
|
22
|
+
{}
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
attr_reader :title, :src, :alt
|
28
|
+
end
|
@@ -8,6 +8,10 @@
|
|
8
8
|
<p class="fr-logo"><%= logo_text %></p>
|
9
9
|
</div>
|
10
10
|
|
11
|
+
<% if operator_image? %>
|
12
|
+
<%= operator_image %>
|
13
|
+
<% end %>
|
14
|
+
|
11
15
|
<% if search? || tool_links? || direct_links? %>
|
12
16
|
<div class="fr-header__navbar">
|
13
17
|
<% if search? %>
|
@@ -25,14 +29,16 @@
|
|
25
29
|
<% end %>
|
26
30
|
</div>
|
27
31
|
|
28
|
-
|
29
|
-
<
|
30
|
-
<
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
<% if title %>
|
33
|
+
<div class="fr-header__service">
|
34
|
+
<a href="/" title="Accueil - <%= title %>">
|
35
|
+
<p class="fr-header__service-title"><%= title %></p>
|
36
|
+
</a>
|
37
|
+
<% if tagline %>
|
38
|
+
<p class="fr-header__service-tagline"><%= tagline %></p>
|
39
|
+
<% end %>
|
40
|
+
</div>
|
41
|
+
<% end %>
|
36
42
|
</div>
|
37
43
|
|
38
44
|
<% if tool_links? || search? %>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class DsfrComponent::HeaderComponent < DsfrComponent::Base
|
2
2
|
renders_one :search
|
3
|
+
renders_one :operator_image, "DsfrComponent::HeaderComponent::OperatorImageComponent"
|
3
4
|
renders_many :tool_links, "DsfrComponent::HeaderComponent::ToolLinkComponent"
|
4
5
|
renders_many :direct_links, types: {
|
5
6
|
simple: "DsfrComponent::HeaderComponent::DirectLinkComponent",
|
@@ -9,7 +10,7 @@ class DsfrComponent::HeaderComponent < DsfrComponent::Base
|
|
9
10
|
# @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.
|
10
11
|
# @param title [String] Le nom du service numérique, titre principal du site.
|
11
12
|
# @param tagline [String] La description du service numérique, sous-titre du site (optionnelle).
|
12
|
-
def initialize(logo_text:, title
|
13
|
+
def initialize(logo_text:, title: nil, tagline: nil, classes: [], html_attributes: {})
|
13
14
|
@logo_text = logo_text
|
14
15
|
@title = title
|
15
16
|
@tagline = tagline
|
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: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BetaGouv developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html-attributes-utils
|
@@ -416,6 +416,7 @@ files:
|
|
416
416
|
- app/components/dsfr_component/header_component.rb
|
417
417
|
- app/components/dsfr_component/header_component/direct_link_component.rb
|
418
418
|
- app/components/dsfr_component/header_component/direct_link_dropdown_component.rb
|
419
|
+
- app/components/dsfr_component/header_component/operator_image_component.rb
|
419
420
|
- app/components/dsfr_component/header_component/tool_link_component.rb
|
420
421
|
- app/components/dsfr_component/modal_component.html.erb
|
421
422
|
- app/components/dsfr_component/modal_component.rb
|