Add literal ordering of timeline object types

Makes it so that timline items registered at the same moment are
always ordered "start->end", not "end->start".

Signed-off-by: Paul Konstantin Gerke <paulkgerke@craftware.info>
This commit is contained in:
Paul Konstantin Gerke 2022-01-12 09:24:20 +01:00 committed by Christopher Charbonneau Wells
parent bb1e854ab3
commit 847125b1c6
1 changed files with 45 additions and 41 deletions

View File

@ -17,48 +17,52 @@
</h3> </h3>
{% if timeline_objects %} {% if timeline_objects %}
<ul class="timeline m-auto"> <ul class="timeline m-auto">
{% for object in timeline_objects %} {% regroup timeline_objects by time as timeline_moments %}
<li{% cycle "" ' class="timeline-inverted"' %}>
<div class="timeline-badge {% if object.type == "start" %}bg-success{% elif object.type == "end" %}bg-danger{% else %}bg-info{% endif %}"> {% for moment_objects in timeline_moments %}
<i class="icon-{{ object.model_name }}"></i> {% for object in moment_objects.list|dictsort:"type" %}
</div> <li{% cycle "" ' class="timeline-inverted"' %}>
<div class="card text-right"> <div class="timeline-badge {% if object.type == "start" %}bg-success{% elif object.type == "end" %}bg-danger{% else %}bg-info{% endif %}">
<div class="card-body"> <i class="icon-{{ object.model_name }}"></i>
{{ object.event }}
{% for detail in object.details %}
<div><small>{{ detail }}</small></div>
{% endfor %}
</div> </div>
<div class="card-footer text-muted"> <div class="card text-right">
{% blocktrans trimmed with since=object.time|timesince time=object.time|time %} <div class="card-body">
{{ since }} ago ({{ time }}) {{ object.event }}
{% endblocktrans %} {% for detail in object.details %}
{% if object.duration %} <div><small>{{ detail }}</small></div>
<div> {% endfor %}
<small> </div>
{% blocktrans trimmed with duration=object.duration %} <div class="card-footer text-muted">
Duration: {{ duration }} {% blocktrans trimmed with since=object.time|timesince time=object.time|time %}
{% endblocktrans %} {{ since }} ago ({{ time }})
</small> {% endblocktrans %}
</div> {% if object.duration %}
{% endif %} <div>
{% if object.time_since_prev %} <small>
<div> {% blocktrans trimmed with duration=object.duration %}
<small> Duration: {{ duration }}
{% blocktrans trimmed with since=object.time_since_prev %} {% endblocktrans %}
{{ since }} since previous </small>
{% endblocktrans %} </div>
</small> {% endif %}
</div> {% if object.time_since_prev %}
{% endif %} <div>
{% if object.edit_link %} <small>
<div> {% blocktrans trimmed with since=object.time_since_prev %}
<small><a href="{{ object.edit_link }}">{% trans "Edit" %}</a></small> {{ since }} since previous
</div> {% endblocktrans %}
{% endif %} </small>
</div>
{% endif %}
{% if object.edit_link %}
<div>
<small><a href="{{ object.edit_link }}">{% trans "Edit" %}</a></small>
</div>
{% endif %}
</div>
</div> </div>
</div> </li>
</li> {% endfor %}
{% endfor %} {% endfor %}
</ul> </ul>
<h3 class="text-center"> <h3 class="text-center">