Skip to content

Commit

Permalink
Make docs in Auth48 state visually distinct. Fixes #2925. Commit read…
Browse files Browse the repository at this point in the history
…y for merge.

 - Legacy-Id: 18189
  • Loading branch information
jennifer-richards committed Jul 17, 2020
1 parent 6e97a89 commit abe97ee
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
16 changes: 16 additions & 0 deletions ietf/doc/templatetags/ballot_icon.py
Expand Up @@ -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 changes: 34 additions & 0 deletions ietf/doc/templatetags/tests_ballot_icon.py
@@ -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)
14 changes: 13 additions & 1 deletion ietf/doc/tests.py
Expand Up @@ -249,7 +249,19 @@ def test_docs_for_ad(self):
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)
Expand Down
2 changes: 2 additions & 0 deletions ietf/templates/doc/search/status_columns.html
Expand Up @@ -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 %}
Expand Down

0 comments on commit abe97ee

Please sign in to comment.