Adds queue counts to the navbar (bug 622169)
This commit is contained in:
Родитель
5c4449abdc
Коммит
0497473aff
|
@ -23,13 +23,13 @@
|
|||
{{ _('Queues') }}</a>
|
||||
<ul>
|
||||
<li><a href="{{ remora_url('/editors/queue/nominated') }}">
|
||||
{{ _('Full Reviews') }}</a></li>
|
||||
{{ _('Full Reviews') }} ({{ queue_counts['nominated'] }})</a></li>
|
||||
<li><a href="{{ remora_url('/editors/queue/pending') }}">
|
||||
{{ _('Pending Updates') }}</a></li>
|
||||
{{ _('Pending Updates') }} ({{ queue_counts['pending'] }})</a></li>
|
||||
<li><a href="{{ remora_url('/editors/queue/preliminary') }}">
|
||||
{{ _('Preliminary Reviews') }}</a></li>
|
||||
{{ _('Preliminary Reviews') }} ({{ queue_counts['prelim'] }})</a></li>
|
||||
<li><a href="{{ remora_url('/editors/queue/reviews') }}">
|
||||
{{ _('Moderated Reviews') }}</a></li>
|
||||
{{ _('Moderated Reviews') }} ({{ queue_counts['moderated'] }})</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="top">
|
||||
|
|
|
@ -310,6 +310,14 @@ class TestQueueBasics(QueueTest):
|
|||
eq_(doc('.data-grid-bottom .num-results').text(),
|
||||
u'Results 1 \u2013 1 of 2')
|
||||
|
||||
def test_navbar_queue_counts(self):
|
||||
r = self.client.get(reverse('editors.home'))
|
||||
eq_(r.status_code, 200)
|
||||
doc = pq(r.content)
|
||||
eq_(doc('#navbar li.top ul').eq(0).text(),
|
||||
'Full Reviews (2) Pending Updates (2) '
|
||||
'Preliminary Reviews (2) Moderated Reviews (0)')
|
||||
|
||||
|
||||
class TestPendingQueue(QueueTest):
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ def editor_required(func):
|
|||
|
||||
|
||||
def context(**kw):
|
||||
ctx = dict(motd=get_config('editors_review_motd'))
|
||||
ctx = dict(motd=get_config('editors_review_motd'),
|
||||
queue_counts=_queue_counts())
|
||||
ctx.update(kw)
|
||||
return ctx
|
||||
|
||||
|
@ -128,7 +129,6 @@ def _queue(request, TableObj, tab):
|
|||
pass
|
||||
order_by = request.GET.get('sort', '-waiting_time_min')
|
||||
table = TableObj(qs, order_by=order_by)
|
||||
queue_counts = _queue_counts()
|
||||
default = 100
|
||||
per_page = request.GET.get('per_page', default)
|
||||
try:
|
||||
|
@ -141,8 +141,7 @@ def _queue(request, TableObj, tab):
|
|||
table.set_page(page)
|
||||
return jingo.render(request, 'editors/queue.html',
|
||||
context(table=table, page=page, tab=tab,
|
||||
search_form=search_form,
|
||||
queue_counts=queue_counts))
|
||||
search_form=search_form))
|
||||
|
||||
|
||||
def _queue_counts(type=None):
|
||||
|
@ -197,7 +196,7 @@ def queue_moderated(request):
|
|||
return jingo.render(request, 'editors/queue.html',
|
||||
context(reviews_formset=reviews_formset,
|
||||
tab='moderated', page=page, flags=flags,
|
||||
queue_counts=_queue_counts(), search_form=None))
|
||||
search_form=None))
|
||||
|
||||
|
||||
@editor_required
|
||||
|
|
Загрузка…
Ссылка в новой задаче