Display all timers to any user with view_timer access.

This commit is contained in:
Christopher Charbonneau Wells 2017-09-09 11:57:58 -04:00
parent 1ae44c408f
commit 4def741d37
3 changed files with 10 additions and 5 deletions

View File

@ -11,12 +11,15 @@
<span class="timer-minutes">{{ object.current_duration|minutes }}</span>m
<span class="timer-seconds">{{ object.current_duration|seconds }}</span>s
</h1>
<p class="lead text-muted">
<p class="lead text-secondary">
Started {{ object.start }}
{% if not object.active %}
/ Stopped {{ object.end }}
{% endif %}
</p>
<p class="text-muted">
Created by {{ object.user }}
</p>
{% if perms.core.add_feeding %}
<a class="btn btn-success btn-lg btn-block p-3 mb-3"

View File

@ -19,10 +19,12 @@
<i class="fa fa-list" aria-hidden="true"></i> View Timers
</a>
{% endif %}
<div class="dropdown-divider"></div>
<h6 class="dropdown-header">Active Timers</h6>
{% for timer in timers %}
<div class="dropdown-divider"></div>
<h6 class="dropdown-header">Active Timers</h6>
<a class="dropdown-item" href="{% url 'timer-detail' timer.id %}">{{ timer }}</a>
<a class="dropdown-item" href="{% url 'timer-detail' timer.id %}">{{ timer }} ({{ timer.user }})</a>
{% empty %}
None
{% endfor %}
</div>
</li>

View File

@ -12,7 +12,7 @@ register = template.Library()
@register.inclusion_tag('core/timer_nav.html', takes_context=True)
def timer_nav(context, active=True):
request = context['request'] or None
timers = Timer.objects.filter(user=request.user, active=active)
timers = Timer.objects.filter(active=active)
perms = context['perms'] or None
# The 'next' parameter is currently not used.
return {'timers': timers, 'perms': perms, 'next': request.path}