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
d232a6d1
Commit
d232a6d1
authored
Oct 28, 2025
by
Adryan Reis
Browse files
br link button
parent
8b319d7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
dsgov/templatetags/br_components.py
View file @
d232a6d1
...
...
@@ -50,6 +50,20 @@ def br_button(text='', button_type='', style='', extra_classes='', icon_class=''
return
format_html
(
'<button type="{}" class="{}">{}{}</button>'
,
button_type
,
classes
,
icon_html
,
text
)
@
register
.
simple_tag
def
br_link_button
(
text
=
''
,
href
=
''
,
style
=
''
,
extra_classes
=
''
,
icon_class
=
''
,
target
=
''
):
"""
Renderiza um link estilizado como botão DSGov.
Permite definir URL, estilo, classes extras, ícone e target.
"""
style_class
=
f
'
{
style
}
'
if
style
in
[
'primary'
,
'secondary'
]
else
''
classes
=
f
'br-button
{
style_class
}
{
extra_classes
}
'
.
strip
()
icon_html
=
format_html
(
'<i class="{}" aria-hidden="true"></i>'
,
icon_class
)
if
icon_class
else
''
target_attr
=
f
' target="
{
target
}
"'
if
target
else
''
return
format_html
(
'<a href="{}" class="{}"{target_attr}>{}{}</a>'
,
href
,
classes
,
icon_html
,
text
,
target_attr
=
target_attr
)
@
register
.
simple_tag
def
br_tag
(
tag_text
=
""
,
tag_id
=
""
,
icon_class
=
""
,
close_button
=
""
,
close_icon_class
=
""
,
button_extra_classes
=
""
,
extra_classes
=
""
,
density
=
""
):
"""
...
...
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