Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Debian New Member Process
nm.debian.org
Commits
c129ccfc
Commit
c129ccfc
authored
Oct 25, 2021
by
urbec
🐣
Browse files
Disabling invalid contributors links in dropdown. Closes: #996745
parent
37c34347
Changes
3
Show whitespace changes
Inline
Side-by-side
backend/mixins.py
View file @
c129ccfc
...
...
@@ -95,9 +95,13 @@ class VisitPersonMixin(VisitorMixin):
res
=
super
().
get_person_menu_entries
()
res
.
append
(
NavLink
(
self
.
person
.
get_ddpo_url
(),
_
(
"DDPO"
),
"tasks"
))
res
.
append
(
NavLink
(
self
.
person
.
get_portfolio_url
(),
_
(
"Portfolio"
),
"newspaper-o"
))
url
=
self
.
person
.
get_contributors_url
url
=
self
.
person
.
get_contributors_url
()
if
url
:
res
.
append
(
NavLink
(
self
.
person
.
get_contributors_url
(),
_
(
"Contributor"
),
"address-card"
))
disabled
=
False
else
:
disabled
=
True
url
=
"#"
res
.
append
(
NavLink
(
url
,
_
(
"Contributor"
),
"address-card"
,
disabled
))
if
self
.
request
.
user
.
is_authenticated
:
res
.
append
(
NavLink
(
reverse
(
"minechangelogs:search"
,
kwargs
=
{
"key"
:
self
.
person
.
lookup_key
}),
_
(
"Changelogs"
),
"history"
))
...
...
nmlayout/mixins.py
View file @
c129ccfc
...
...
@@ -9,6 +9,7 @@ class NavLink:
url
:
str
label
:
str
icon
:
Optional
[
str
]
=
None
disabled
:
Optional
[
bool
]
=
False
# if True, link should be shown as disabled
class
NM2LayoutMixin
(
assets
.
AssetMixin
):
...
...
nmlayout/templates/nm2-base.html
View file @
c129ccfc
...
...
@@ -36,7 +36,13 @@ window.nm2.url_api_people = "{% url 'api:people' %}";
</a>
<div
class=
"dropdown-menu"
role=
"menu"
aria-labelledby=
"navbarDropdown"
>
{% for link in navbar.person %}
<a
class=
"dropdown-item"
href=
"{{link.url}}"
>
{% if link.icon %}
<span
class=
"fa fa-{{link.icon}}"
></span>
{% endif %}{{link.label}}
</a>
<a
class=
{%
if
link.disabled
%}
"
dropdown-item
disabled
"
{%
else
%}
"
dropdown-item
"
{%
endif
%}
href=
"{{link.url}}"
>
{% if link.icon %}
<span
class=
"fa fa-{{link.icon}}"
></span>
{% endif %}{{link.label}}
</a>
{% endfor %}
{% if user != person %}
<form
class=
"form-inline"
method=
"POST"
action=
"{% url 'impersonate:impersonate' %}"
>
{% csrf_token %}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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