#9072: Implement a mechanism for dynamically registering model detail views

This commit is contained in:
jeremystretch
2022-10-06 16:20:35 -04:00
parent 664d5db5eb
commit 0d7851ed9d
7 changed files with 158 additions and 26 deletions

View File

@@ -4,6 +4,7 @@
{% load helpers %}
{% load perms %}
{% load plugins %}
{% load tabs %}
{% comment %}
Blocks:
@@ -83,34 +84,11 @@ Context:
<a class="nav-link{% if not active_tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
</li>
{# Include any additional tabs #}
{# Include any extra tabs passed by the view #}
{% block extra_tabs %}{% endblock %}
{# Object journal #}
{% if perms.extras.view_journalentry %}
{% with journal_viewname=object|viewname:'journal' %}
{% url journal_viewname pk=object.pk as journal_url %}
{% if journal_url %}
<li role="presentation" class="nav-item">
<a href="{{ journal_url }}" class="nav-link{% if active_tab == 'journal'%} active{% endif %}">
Journal {% badge object.journal_entries.count %}
</a>
</li>
{% endif %}
{% endwith %}
{% endif %}
{# Object changelog #}
{% if perms.extras.view_objectchange %}
{% with changelog_viewname=object|viewname:'changelog' %}
{% url changelog_viewname pk=object.pk as changelog_url %}
{% if changelog_url %}
<li role="presentation" class="nav-item">
<a href="{{ changelog_url }}" class="nav-link{% if active_tab == 'changelog'%} active{% endif %}">Change Log</a>
</li>
{% endif %}
{% endwith %}
{% endif %}
{# Include tabs for registered model views #}
{% model_view_tabs object %}
</ul>
{% endblock tabs %}