Skip to content

Commit 8bc7fde

Browse files
committed
More fixes.
- Legacy-Id: 19828
1 parent 373b5db commit 8bc7fde

File tree

132 files changed

+3342
-2720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+3342
-2720
lines changed

ietf/doc/templatetags/ballot_icon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def sort_key(t):
133133

134134
# add sufficient table calls to last row to avoid HTML validation warning
135135
while (i + 1) % 5 != 0:
136-
res.append('<td class="empty"></td>')
136+
res.append('<td class="position-empty"></td>')
137137
i = i + 1
138138

139139
res.append("</tr></table></a>")

ietf/doc/templatetags/ietf_filters.py

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -419,14 +419,11 @@ def format_history_text(text, trunc_words=25):
419419
def format_snippet(text, trunc_words=25):
420420
# urlize if there aren't already links present
421421
if not 'href=' in text:
422-
# django's urlize() cannot handle adjacent parentheszised
423-
# expressions, for instance [REF](http://example.com/foo)
424-
# Use bleach.linkify instead
425-
text = bleach.linkify(text)
422+
text = bleach.linkify(text, parse_email=True)
426423
full = keep_spacing(collapsebr(linebreaksbr(mark_safe(sanitize_fragment(text)))))
427424
snippet = truncatewords_html(full, trunc_words)
428425
if snippet != full:
429-
return mark_safe('<div class="snippet">%s<button class="btn btn-sm btn-primary show-all"><i class="bi bi-caret-down"></i></button></div><div class="hidden full">%s</div>' % (snippet, full))
426+
return mark_safe('<div class="snippet">%s<button class="btn btn-sm btn-primary show-all"><i class="bi bi-caret-down"></i></button></div><div class="visually-hidden full">%s</div>' % (snippet, full))
430427
return full
431428

432429
@register.simple_tag
@@ -493,18 +490,32 @@ def consensus(doc):
493490
return "Unknown"
494491

495492
@register.filter
496-
def pos_to_label(text):
497-
"""Return a valid Bootstrap label type for a ballot position."""
493+
def pos_to_label_format(text):
494+
"""Returns valid Bootstrap classes to label a ballot position."""
498495
return {
499-
'Yes': 'success',
500-
'No Objection': 'info',
501-
'Abstain': 'warning',
502-
'Discuss': 'danger',
503-
'Block': 'danger',
504-
'Recuse': 'primary',
505-
'Not Ready': 'danger',
506-
'Need More Time': 'danger',
507-
}.get(str(text), 'secondary')
496+
'Yes': 'bg-yes text-light',
497+
'No Objection': 'bg-noobj text-dark',
498+
'Abstain': 'bg-abstain text-light',
499+
'Discuss': 'bg-discuss text-light',
500+
'Block': 'bg-discuss text-light',
501+
'Recuse': 'bg-recuse text-light',
502+
'Not Ready': 'bg-discuss text-light',
503+
'Need More Time': 'bg-discuss text-light',
504+
}.get(str(text), 'bg-norecord text-dark')
505+
506+
@register.filter
507+
def pos_to_border_format(text):
508+
"""Returns valid Bootstrap classes to label a ballot position border."""
509+
return {
510+
'Yes': 'border-yes',
511+
'No Objection': 'border-noobj',
512+
'Abstain': 'border-abstain',
513+
'Discuss': 'border-discuss',
514+
'Block': 'border-discuss',
515+
'Recuse': 'border-recuse',
516+
'Not Ready': 'border-discuss',
517+
'Need More Time': 'border-discuss',
518+
}.get(str(text), 'border-norecord')
508519

509520
@register.filter
510521
def capfirst_allcaps(text):

ietf/doc/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ def test_document_ballot(self):
15311531
doc.save_with_history([e])
15321532
r = self.client.get(urlreverse("ietf.doc.views_doc.document_ballot", kwargs=dict(name=doc.name)))
15331533
self.assertEqual(r.status_code, 200)
1534-
self.assertContains(r, '(%s for -%s)' % (pos.comment_time.strftime('%Y-%m-%d'), oldrev))
1534+
self.assertRegex(r.content.decode(), r'\(\s*%s\s+for\s+-%s\s*\)' % (pos.comment_time.strftime('%Y-%m-%d'), oldrev))
15351535

15361536
# Now simulate a new ballot against the new revision and make sure the "was" position is included
15371537
pos2 = BallotPositionDocEvent.objects.create(
@@ -1579,7 +1579,7 @@ def test_document_ballot_popup_unique_anchors_per_doc(self):
15791579
href = q(f'div.balloter-name a[href$="{author_slug}"]').attr('href')
15801580
ids = [
15811581
target.attr('id')
1582-
for target in q(f'h4.anchor-target[id$="{author_slug}"]').items()
1582+
for target in q(f'h5[id$="{author_slug}"]').items()
15831583
]
15841584
self.assertEqual(len(ids), 1, 'Should be exactly one link for the balloter')
15851585
self.assertEqual(href, f'#{ids[0]}', 'Anchor href should match ID')

ietf/doc/tests_charter.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,27 @@ def test_view_revisions(self):
4949
url = urlreverse('ietf.doc.views_doc.document_main',kwargs={'name':charter.name})
5050
r = self.client.get(url)
5151
q = PyQuery(r.content)
52-
self.assertIn('The information below is for a proposed recharter. The current approved charter is',q('#message-row').text())
52+
self.assertIn('The information below is for a proposed recharter. The current approved charter is',q('.alert').text())
5353

5454
url = urlreverse('ietf.doc.views_doc.document_main',kwargs={'name':charter.name,'rev':'02-00'})
5555
r = self.client.get(url)
5656
q = PyQuery(r.content)
57-
self.assertIn('The information below is for an older version of the current proposed rechartering effort',q('#message-row').text())
57+
self.assertIn('The information below is for an older version of the current proposed rechartering effort',q('.alert').text())
5858

5959
url = urlreverse('ietf.doc.views_doc.document_main',kwargs={'name':charter.name,'rev':'02'})
6060
r = self.client.get(url)
6161
q = PyQuery(r.content)
62-
self.assertIn('The information below is for the currently approved charter, but newer proposed charter text exists',q('#message-row').text())
62+
self.assertIn('The information below is for the currently approved charter, but newer proposed charter text exists',q('.alert').text())
6363

6464
url = urlreverse('ietf.doc.views_doc.document_main',kwargs={'name':charter.name,'rev':'01-00'})
6565
r = self.client.get(url)
6666
q = PyQuery(r.content)
67-
self.assertIn('The information below is for an older proposed',q('#message-row').text())
67+
self.assertIn('The information below is for an older proposed',q('.alert').text())
6868

6969
url = urlreverse('ietf.doc.views_doc.document_main',kwargs={'name':charter.name,'rev':'01'})
7070
r = self.client.get(url)
7171
q = PyQuery(r.content)
72-
self.assertIn('The information below is for an older approved',q('#message-row').text())
72+
self.assertIn('The information below is for an older approved',q('.alert').text())
7373

7474
e = NewRevisionDocEventFactory(doc=charter,rev="03")
7575
charter.rev='03'
@@ -78,7 +78,7 @@ def test_view_revisions(self):
7878
url = urlreverse('ietf.doc.views_doc.document_main',kwargs={'name':charter.name})
7979
r = self.client.get(url)
8080
q = PyQuery(r.content)
81-
self.assertEqual('',q('#message-row').text())
81+
self.assertEqual('',q('.alert').text())
8282

8383

8484

@@ -838,4 +838,4 @@ def test_chartering_from_bof(self):
838838
ad_role = RoleFactory(group__type_id='area',name_id='ad')
839839
charter = CharterFactory(group__type_id='wg',group__state_id='bof',group__parent=ad_role.group)
840840
e1,_ = default_review_text(charter.group, charter, Person.objects.get(name="(System)"))
841-
self.assertTrue('A new IETF WG has been proposed' in e1.text)
841+
self.assertTrue('A new IETF WG has been proposed' in e1.text)

ietf/doc/tests_status_change.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def test_edit_relations(self):
396396
q = PyQuery(r.content)
397397
self.assertEqual(len(q('#content [type=submit]:contains("Save")')),1)
398398
# There should be three rows on the form
399-
self.assertEqual(len(q('#content .row')),3)
399+
self.assertEqual(len(q('#content .input-group')),3)
400400

401401
# Try to add a relation to an RFC that doesn't exist
402402
r = self.client.post(url,dict(new_relation_row_blah="rfc9997",
@@ -534,4 +534,4 @@ def test_subsequent_submission(self):
534534

535535
def setUp(self):
536536
super().setUp()
537-
DocumentFactory(type_id='statchg',name='status-change-imaginary-mid-review',notify='notify@example.org')
537+
DocumentFactory(type_id='statchg',name='status-change-imaginary-mid-review',notify='notify@example.org')

ietf/doc/views_doc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,6 @@ def document_history(request, name):
867867
person__user=request.user)))
868868
else:
869869
can_add_comment = has_role(request.user, ("Area Director", "Secretariat", "IRTF Chair"))
870-
871870
return render(request, "doc/document_history.html",
872871
dict(doc=doc,
873872
top=top,

ietf/group/tests_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ def test_view_status_update(self):
17091709
response = self.client.get(url)
17101710
self.assertEqual(response.status_code,200)
17111711
q=PyQuery(response.content)
1712-
self.assertTrue(bleach.linkify(escape(event.desc)) in str(q('pre')))
1712+
self.assertTrue(bleach.linkify(escape(event.desc), parse_email=True) in str(q('pre')))
17131713
self.assertFalse(q('a#edit_button'))
17141714
self.client.login(username=chair.person.user.username,password='%s+password'%chair.person.user.username)
17151715
response = self.client.get(url)

ietf/secr/templates/announcement/confirm.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{% block title %}Announcement{% endblock %}
55

66
{% block extrahead %}{{ block.super }}
7-
<script type="text/javascript" src="{% static 'secr/js/utils.js' %}"></script>
7+
<script src="{% static 'secr/js/utils.js' %}"></script>
88
{% endblock %}
99

1010
{% block breadcrumbs %}{{ block.super }}

ietf/secr/templates/areas/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block title %}Areas{% endblock %}
44

55
{% block extrahead %}{{ block.super }}
6-
<script type="text/javascript" src="{% static 'secr/js/utils.js' %}"></script>
6+
<script src="{% static 'secr/js/utils.js' %}"></script>
77
{% endblock %}
88

99
{% block breadcrumbs %}{{ block.super }}

ietf/secr/templates/areas/people.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
{% block extrahead %}{{ block.super }}
66
<link rel="stylesheet" type="text/css" href="{% static 'ietf/css/jquery-ui.css' %}" />
7-
<script type="text/javascript" src="{% static 'ietf/js/jquery-ui.js' %}"></script>
8-
<script type="text/javascript" src="{% static 'secr/js/utils.js' %}"></script>
7+
<script src="{% static 'ietf/js/jquery-ui.js' %}"></script>
8+
<script src="{% static 'secr/js/utils.js' %}"></script>
99
{% endblock %}
1010

1111
{% block breadcrumbs %}{{ block.super }}

0 commit comments

Comments
 (0)