Merged in [18189] from jennifer@painless-security.com:
Make docs in Auth48 state visually distinct. Fixes #2925.
- Legacy-Id: 18210
Note: SVN reference [18189] has been migrated to Git commit abe97eeb28
This commit is contained in:
commit
d16e946ed3
|
@ -218,3 +218,19 @@ def state_age_colored(doc):
|
|||
's' if days != 1 else ''))
|
||||
else:
|
||||
return ""
|
||||
|
||||
@register.filter
|
||||
def state_alert_badge(doc):
|
||||
"""Return alert badge, if any, for a document"""
|
||||
if doc.type_id != 'draft':
|
||||
return ''
|
||||
|
||||
iesg_state = doc.get_state('draft-iesg')
|
||||
if iesg_state.slug != 'rfcqueue':
|
||||
return ''
|
||||
|
||||
rfced_state = doc.get_state('draft-rfceditor')
|
||||
if rfced_state.slug == 'auth48':
|
||||
return mark_safe('<span class="label label-info" title="AUTH48">AUTH48</span>')
|
||||
|
||||
return ''
|
34
ietf/doc/templatetags/tests_ballot_icon.py
Normal file
34
ietf/doc/templatetags/tests_ballot_icon.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
from ietf.doc.factories import WgDraftFactory
|
||||
from ietf.doc.templatetags.ballot_icon import state_alert_badge
|
||||
from ietf.utils.test_utils import TestCase
|
||||
|
||||
|
||||
class BallotIconTests(TestCase):
|
||||
def test_state_alert_badge_marks_auth48(self):
|
||||
draft = WgDraftFactory(states=[
|
||||
('draft','active'),
|
||||
('draft-iesg','rfcqueue'),
|
||||
('draft-rfceditor', 'auth48'),
|
||||
])
|
||||
output = state_alert_badge(draft)
|
||||
self.assertIn('AUTH48', output)
|
||||
|
||||
def test_state_alert_badge_ignores_others(self):
|
||||
# If the state_alert_badge() method becomes more complicated, more
|
||||
# sophisticated testing can be added.
|
||||
# For now, just test a couple states that should not be marked.
|
||||
draft = WgDraftFactory(states=[
|
||||
('draft', 'active'),
|
||||
('draft-iesg', 'approved'), # not in rfcqueue state
|
||||
('draft-rfceditor', 'auth48'),
|
||||
])
|
||||
output = state_alert_badge(draft)
|
||||
self.assertEqual('', output)
|
||||
|
||||
draft = WgDraftFactory(states=[
|
||||
('draft', 'active'),
|
||||
('draft-iesg', 'rfcqueue'),
|
||||
('draft-rfceditor', 'auth48-done'), # not in auth48 state
|
||||
])
|
||||
output = state_alert_badge(draft)
|
||||
self.assertEqual('', output)
|
|
@ -249,7 +249,19 @@ class SearchTests(TestCase):
|
|||
self.assertContains(r, charter.name)
|
||||
|
||||
self.assertContains(r, discuss_other.doc.name)
|
||||
|
||||
|
||||
def test_auth48_doc_for_ad(self):
|
||||
"""Docs in AUTH48 state should have a decoration"""
|
||||
ad = RoleFactory(name_id='ad', group__type_id='area', group__state_id='active').person
|
||||
draft = IndividualDraftFactory(ad=ad,
|
||||
states=[('draft', 'active'),
|
||||
('draft-iesg', 'rfcqueue'),
|
||||
('draft-rfceditor', 'auth48')])
|
||||
r = self.client.get(urlreverse('ietf.doc.views_search.docs_for_ad',
|
||||
kwargs=dict(name=ad.full_name_as_key())))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertContains(r, draft.name)
|
||||
self.assertContains(r, 'title="AUTH48"') # title attribute of AUTH48 badge in state_alert_badge filter
|
||||
|
||||
def test_drafts_in_last_call(self):
|
||||
draft = IndividualDraftFactory(pages=1)
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
<wbr>: <a href="https://www.rfc-editor.org/queue2.html#{{ doc.name }}">{{ doc|state:"draft-rfceditor" }}</a>
|
||||
{% endif %}
|
||||
|
||||
<wbr>{{ doc|state_alert_badge }}
|
||||
|
||||
<wbr>{{ doc|state_age_colored }}
|
||||
|
||||
{% if doc.telechat_date %}
|
||||
|
|
Loading…
Reference in a new issue