Show objects and subjects on the view page.

This commit is contained in:
Edward Betts 2018-06-04 17:18:34 +01:00
parent 206562a8f9
commit f9b510a967

View file

@ -89,7 +89,7 @@
{%- for start, line in iter_lines(text) if line != '\r\n' -%} {%- for start, line in iter_lines(text) if line != '\r\n' -%}
{# <p data-start="{{ start }}">{% if line != "\n" and line != "\r\n" %}{{ line }}{% else %}&nbsp;{% endif {# <p data-start="{{ start }}">{% if line != "\n" and line != "\r\n" %}{{ line }}{% else %}&nbsp;{% endif
%}</p>#} %}</p>#}
<p class="card-text{% if line.startswith('-') %} margin-bottom-zero{% endif %}" data-start="{{ start }}">{{ nbsp_at_start(line) }}</p> <p class="card-text{% if doc.type != 'xanadoc' or line.startswith('-') %} margin-bottom-zero{% endif %}" data-start="{{ start }}">{{ nbsp_at_start(line) }}</p>
{%- endfor -%} {%- endfor -%}
{% endif %} {% endif %}
</div> </div>
@ -103,9 +103,40 @@
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<h4>references</h4> <h4>References</h4>
<ul> {% set subject_count = doc.subjects.count() %}
</ul> {% if subject_count %}
<p>There are {{ subject_count }} documents that refer to this {{ doc.type }}.</p>
<ul>
{% for item in doc.subjects %}
<li><a href="{{ item.url }}">{{ item.title() }}</a>
&mdash; {{ item.user.username }} &mdash; {{ item.created | datetime }}
</li>
{% endfor %}
</ul>
{% else %}
<p>There are no documents that refer to this {{ doc.type }}.</p>
{% endif %}
{% if doc.type == 'xanalink' %}
<h4>Documents referred to</h4>
{% set object_count = doc.objects.count() %}
{% if object_count %}
<p>There are {{ object_count }} document(s) referred to by this {{ doc.type }}.</p>
<ul>
{% for item in doc.objects %}
<li><a href="{{ item.url }}">{{ item.title() }}</a>
&mdash; {{ item.user.username }} &mdash; {{ item.created | datetime }}
</li>
{% endfor %}
</ul>
{% else %}
<p>This link doesn't refer to any documents.</p>
{% endif %}
{% endif %}
</div> </div>
</div> </div>