Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
django-dsgov
Commits
98f84dfe
Commit
98f84dfe
authored
Aug 14, 2025
by
Eduardo Silva
Browse files
adicao de campo de link na tag que implementa o logo do header
parent
f234c169
Changes
2
Hide whitespace changes
Inline
Side-by-side
dsgov/templatetags/br_header_tags.py
View file @
98f84dfe
...
@@ -134,8 +134,15 @@ class BRListNode(template.Node):
...
@@ -134,8 +134,15 @@ class BRListNode(template.Node):
# =========================
# =========================
@
register
.
simple_tag
(
takes_context
=
True
)
@
register
.
simple_tag
(
takes_context
=
True
)
def
br_header_logo
(
context
,
src
,
alt
,
signature
=
""
,
signature_style
=
""
):
def
br_header_logo
(
context
,
src
,
alt
,
signature
=
""
,
signature_style
=
""
,
href
=
""
):
logo_html
=
format_html
(
'<img src="{}" alt="{}" />'
,
resolve_variable
(
src
,
context
),
resolve_variable
(
alt
,
context
))
resolved_src
=
resolve_variable
(
src
,
context
)
resolved_alt
=
resolve_variable
(
alt
,
context
)
logo_html
=
format_html
(
'<img src="{}" alt="{}" />'
,
resolved_src
,
resolved_alt
)
if
href
:
resolved_href
=
resolve_variable
(
href
,
context
)
logo_html
=
format_html
(
'<a href="{}">{}</a>'
,
resolved_href
,
logo_html
)
if
signature
:
if
signature
:
resolved_signature
=
resolve_variable
(
signature
,
context
)
resolved_signature
=
resolve_variable
(
signature
,
context
)
style_attr
=
''
style_attr
=
''
...
@@ -143,9 +150,11 @@ def br_header_logo(context, src, alt, signature="", signature_style=""):
...
@@ -143,9 +150,11 @@ def br_header_logo(context, src, alt, signature="", signature_style=""):
resolved_style
=
resolve_variable
(
signature_style
,
context
)
resolved_style
=
resolve_variable
(
signature_style
,
context
)
style_attr
=
format_html
(
' style="{}"'
,
resolved_style
)
style_attr
=
format_html
(
' style="{}"'
,
resolved_style
)
return
format_html
(
return
format_html
(
'<div class="header-logo">{}<span class="br-divider vertical"></span><div class="header-sign"{}>{}</div></div>'
,
'<div class="header-logo">{}<span class="br-divider vertical"></span>'
'<div class="header-sign"{}>{}</div></div>'
,
logo_html
,
style_attr
,
resolved_signature
logo_html
,
style_attr
,
resolved_signature
)
)
return
format_html
(
'<div class="header-logo">{}</div>'
,
logo_html
)
return
format_html
(
'<div class="header-logo">{}</div>'
,
logo_html
)
# --- Tags de Texto Explícitas ---
# --- Tags de Texto Explícitas ---
...
...
tests/django_dsgov_test1/templates/examples_headers.html
View file @
98f84dfe
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
{% br_header %}
{% br_header %}
{# Bloco Superior: Logo, Ações, Links, Funções, Busca e Login #}
{# Bloco Superior: Logo, Ações, Links, Funções, Busca e Login #}
{% br_header_top %}
{% br_header_top %}
{% br_header_logo src="https://cdngovbr-ds.estaleiro.serpro.gov.br/design-system/images/logo-positive.png" alt="logo" signature="Assinatura" %}
{% br_header_logo src="https://cdngovbr-ds.estaleiro.serpro.gov.br/design-system/images/logo-positive.png"
href="https://www.gov.br/ds/components/menu?tab=desenvolvedor"
alt="logo" signature="Assinatura" %}
{% br_header_actions %}
{% br_header_actions %}
{% br_header_links %}
{% br_header_links %}
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
{% br_header class="bg-blue-warm-vivid-90" %}
{% br_header class="bg-blue-warm-vivid-90" %}
{# Bloco Superior: Logo, Ações, Links, Funções, Busca e Login #}
{# Bloco Superior: Logo, Ações, Links, Funções, Busca e Login #}
{% br_header_top %}
{% br_header_top %}
{% br_header_logo src="https://cdngovbr-ds.estaleiro.serpro.gov.br/design-system/images/logo-negative.png" alt="logo" signature="Assinatura" signature_style="color: white;" %}
{% br_header_logo src="https://cdngovbr-ds.estaleiro.serpro.gov.br/design-system/images/logo-negative.png"
href="https://www.gov.br/ds/components/menu?tab=desenvolvedor"
alt="logo" signature="Assinatura" signature_style="color: white;" %}
{% br_header_actions %}
{% br_header_actions %}
{% br_header_links icon_style="color: white;" %}
{% br_header_links icon_style="color: white;" %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment