mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #12061: Improve handling of insufficient permissions for widget content
This commit is contained in:
@@ -3,12 +3,19 @@
|
||||
{% if counts %}
|
||||
<div class="list-group list-group-flush">
|
||||
{% for model, count in counts %}
|
||||
<a href="{% url model|viewname:"list" %}" class="list-group-item list-group-item-action">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center">
|
||||
{% if count != None %}
|
||||
<a href="{% url model|viewname:"list" %}" class="list-group-item list-group-item-action">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center">
|
||||
{{ model|meta:"verbose_name_plural"|bettertitle }}
|
||||
<h6 class="mb-1">{{ count }}</h6>
|
||||
</div>
|
||||
</a>
|
||||
{% else %}
|
||||
<div class="list-group-item list-group-item-action d-flex w-100 justify-content-between align-items-center">
|
||||
{{ model|meta:"verbose_name_plural"|bettertitle }}
|
||||
<h6 class="mb-1">{{ count }}</h6>
|
||||
<h6 class="mb-1" title="No permission"><i class="mdi mdi-lock-outline"></i></h6>
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@@ -1,5 +1,9 @@
|
||||
{% if htmx_url %}
|
||||
{% if htmx_url and has_permission %}
|
||||
<div class="htmx-container" hx-get="{{ htmx_url }}{% if page_size %}?per_page={{ page_size }}{% endif %}" hx-trigger="load"></div>
|
||||
{% elif htmx_url %}
|
||||
<div class="text-muted text-center">
|
||||
<i class="mdi mdi-lock-outline"></i> No permission to view this content.
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-danger text-center">
|
||||
<i class="mdi mdi-alert"></i> Unable to load content. Invalid view name: <span class="font-monospace">{{ viewname }}</span>
|
||||
|
Reference in New Issue
Block a user