_activity-timeline.html 2.41 KB
Newer Older
1
{% load i18n %}
2 3 4

<div id="activity-timeline" class="timeline">

5
{% for a in activities %}
6
<div class="activity{% if a.pk == active.pk %} activity-active{%endif%}" data-activity-id="{{ a.pk }}">
7
  <span class="timeline-icon{% if a.has_failed %} timeline-icon-failed{% endif %}">
8
  <i class="fa {% if not a.finished %}fa-refresh fa-spin {% else %}fa-plus{% endif %}"></i>
9
</span>
10 11
<strong{% if a.result %} title="{{ a.result.get_user_text }}"{% endif %}>
  <a href="{{ a.get_absolute_url }}">
12
    {% if a.times > 1 %}({{ a.times }}x){% endif %}
13
    {{ a.readable_name.get_user_text|capfirst }}</a>
14 15 16 17

{% if a.has_percent %}
  - {{ a.percentage }}%
{% endif %}
18
</strong>
19
{% if a.times < 2%}{{ a.started|date:"Y-m-d H:i" }}{% endif %}{% if a.user %},
20
  <a class="no-style-link" href="{% url "dashboard.views.profile" username=a.user.username %}">
21 22
    {% include "dashboard/_display-name.html" with user=a.user show_org=True %}
  </a>
23
{% endif %}
24 25
{% if a.is_abortable_for_user %}
<form action="{{ a.instance.get_absolute_url }}" method="POST" class="pull-right">
Kálmán Viktor committed
26
  {% csrf_token %}
27
  <input type="hidden" name="abort_operation"/>
Kálmán Viktor committed
28
  <input type="hidden" name="activity" value="{{ a.pk }}"/>
29
  <button class="btn btn-danger btn-xs"><i class="fa fa-bolt"></i> {% trans "Abort" %}</button>
Kálmán Viktor committed
30 31
</form>
{% endif %}
32 33 34
  {% if a.children.count > 0 %}
    <div class="sub-timeline">
      {% for s in a.children.all %}
35
      <div data-activity-id="{{ s.pk }}" class="sub-activity{% if s.has_failed %} sub-activity-failed{% endif %}{% if s.pk == active.pk %} sub-activity-active{% endif %}">
36 37
        <span{% if s.result %} title="{{ s.result.get_user_text }}"{% endif %}>
          <a href="{{ s.get_absolute_url }}">
38
              {{ s.readable_name.get_user_text|capfirst }}</a></span> &ndash;
39 40 41
        {% if s.finished %}
          {{ s.finished|time:"H:i:s" }}
        {% else %}
42
          <i class="fa fa-refresh fa-spin" class="sub-activity-loading-icon"></i>
43
        {% endif %}
44 45 46
        {% if s.has_failed %}
          <div class="label label-danger">{% trans "failed" %}</div>
        {% endif %}
47 48 49 50 51 52
        </div>
      {% endfor %}
    </div>
  {% endif %}
</div>
{% endfor %}
53 54 55 56 57 58 59 60 61 62 63 64 65
</div>

{% if show_show_all %}
<div id="show-all-activities-container">
  <a id="show-all-activities" href="#">
    {% if activities|length > 10 %}
      <span>{% trans "Show less activities" %}</span>
    {% else %}
      <span>{% trans "Show all activities" %}</span>
    {% endif %}
  </a>
</div>
{% endif %}