Skip to content

Commit abe97ee

Browse files
Make docs in Auth48 state visually distinct. Fixes ietf-tools#2925. Commit ready for merge.
- Legacy-Id: 18189
1 parent 6e97a89 commit abe97ee

4 files changed

Lines changed: 65 additions & 1 deletion

File tree

ietf/doc/templatetags/ballot_icon.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,19 @@ def state_age_colored(doc):
218218
's' if days != 1 else ''))
219219
else:
220220
return ""
221+
222+
@register.filter
223+
def state_alert_badge(doc):
224+
"""Return alert badge, if any, for a document"""
225+
if doc.type_id != 'draft':
226+
return ''
227+
228+
iesg_state = doc.get_state('draft-iesg')
229+
if iesg_state.slug != 'rfcqueue':
230+
return ''
231+
232+
rfced_state = doc.get_state('draft-rfceditor')
233+
if rfced_state.slug == 'auth48':
234+
return mark_safe('<span class="label label-info" title="AUTH48">AUTH48</span>')
235+
236+
return ''
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from ietf.doc.factories import WgDraftFactory
2+
from ietf.doc.templatetags.ballot_icon import state_alert_badge
3+
from ietf.utils.test_utils import TestCase
4+
5+
6+
class BallotIconTests(TestCase):
7+
def test_state_alert_badge_marks_auth48(self):
8+
draft = WgDraftFactory(states=[
9+
('draft','active'),
10+
('draft-iesg','rfcqueue'),
11+
('draft-rfceditor', 'auth48'),
12+
])
13+
output = state_alert_badge(draft)
14+
self.assertIn('AUTH48', output)
15+
16+
def test_state_alert_badge_ignores_others(self):
17+
# If the state_alert_badge() method becomes more complicated, more
18+
# sophisticated testing can be added.
19+
# For now, just test a couple states that should not be marked.
20+
draft = WgDraftFactory(states=[
21+
('draft', 'active'),
22+
('draft-iesg', 'approved'), # not in rfcqueue state
23+
('draft-rfceditor', 'auth48'),
24+
])
25+
output = state_alert_badge(draft)
26+
self.assertEqual('', output)
27+
28+
draft = WgDraftFactory(states=[
29+
('draft', 'active'),
30+
('draft-iesg', 'rfcqueue'),
31+
('draft-rfceditor', 'auth48-done'), # not in auth48 state
32+
])
33+
output = state_alert_badge(draft)
34+
self.assertEqual('', output)

ietf/doc/tests.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,19 @@ def test_docs_for_ad(self):
249249
self.assertContains(r, charter.name)
250250

251251
self.assertContains(r, discuss_other.doc.name)
252-
252+
253+
def test_auth48_doc_for_ad(self):
254+
"""Docs in AUTH48 state should have a decoration"""
255+
ad = RoleFactory(name_id='ad', group__type_id='area', group__state_id='active').person
256+
draft = IndividualDraftFactory(ad=ad,
257+
states=[('draft', 'active'),
258+
('draft-iesg', 'rfcqueue'),
259+
('draft-rfceditor', 'auth48')])
260+
r = self.client.get(urlreverse('ietf.doc.views_search.docs_for_ad',
261+
kwargs=dict(name=ad.full_name_as_key())))
262+
self.assertEqual(r.status_code, 200)
263+
self.assertContains(r, draft.name)
264+
self.assertContains(r, 'title="AUTH48"') # title attribute of AUTH48 badge in state_alert_badge filter
253265

254266
def test_drafts_in_last_call(self):
255267
draft = IndividualDraftFactory(pages=1)

ietf/templates/doc/search/status_columns.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<wbr>: <a href="https://www.rfc-editor.org/queue2.html#{{ doc.name }}">{{ doc|state:"draft-rfceditor" }}</a>
1818
{% endif %}
1919

20+
<wbr>{{ doc|state_alert_badge }}
21+
2022
<wbr>{{ doc|state_age_colored }}
2123

2224
{% if doc.telechat_date %}

0 commit comments

Comments
 (0)