Skip to content

Commit

Permalink
feat(relations): new template to list relations
Browse files Browse the repository at this point in the history
Displays the relations in a tabbed view with ALL tab appearing in the
beginning, followed by the other target groups.

closes #489
  • Loading branch information
gythaogg committed Oct 22, 2024
1 parent fad4fd6 commit 3fd5d1b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

{% block col-one %}
{% include "relations/list_relations_include.html" %}

{{ block.super }}
{% endblock col-one %}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
{% endblock content %}

{% block col-one %}

{% include "relations/list_relations_include.html" with edit=True %}

{{ block.super }}
{% endblock col-one %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load relations %}
{% load django_tables2 %}
<div id="rel_{{ object.id }}_{{ target.name }}" hx-swap-oob="true">
<div id="rel_{{ object.id }}_{{ target.name }} hx-swap-oob="true">

{% block relations_list %}
{% relations_list_table relations target as table %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% load relations %}
{% relations_from from_obj=object as relations %}
{% possible_relation_types_from object as possible_relations %}
{% get_relation_targets_from object as possible_targets %}
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active"
data-toggle="tab"
href="#reltab_{{ object.id }}_ALL">All</a>
</li>
{% for target in possible_targets %}
<li class="nav-item">
<a class="nav-link"
data-toggle="tab"
href="#reltab_{{ object.id }}_{{ target.name }}">{{ target.name | title }}</a>
</li>
{% endfor %}
</ul>
<div class="tab-content">
<div class="tab-pane container active"
id="reltab_{{ object.id }}_ALL"
hx-swap-oob="true">{% include "relations/list_relations.html" %}</div>
{% for target in possible_targets %}
<div class="tab-pane container"
id="reltab_{{ object.id }}_{{ target.name }}"
hx-swap-oob="true">{% include "relations/list_relations.html" %}</div>
{% endfor %}
</div>

0 comments on commit 3fd5d1b

Please sign in to comment.