Skip to content

Commit cb70da9

Browse files
fix: Never show AD col on drafts_for_ad.html (#6914)
* fix: Pass ad as Person instead of name * refactor: Remove redundant AD check Results being shown are already filtered by AD if the `ad` variable is not `None` * refactor: Add show_ad... flag to prepare_document_table * refactor: Expose show_ad_and_shepherd flag
1 parent b70be9b commit cb70da9

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

ietf/doc/utils_search.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def augment_docs_with_related_docs_info(docs):
181181
originalDoc = d.related_that_doc('conflrev')[0]
182182
d.pages = originalDoc.pages
183183

184-
def prepare_document_table(request, docs, query=None, max_results=200):
184+
def prepare_document_table(request, docs, query=None, max_results=200, show_ad_and_shepherd=True):
185185
"""Take a queryset of documents and a QueryDict with sorting info
186186
and return list of documents with attributes filled in for
187187
displaying a full table of information about the documents, plus
@@ -259,12 +259,14 @@ def num(i):
259259
if len(docs) == max_results:
260260
meta['max'] = max_results
261261

262-
meta['headers'] = [{'title': 'Document', 'key':'document'},
263-
{'title': 'Title', 'key':'title'},
264-
{'title': 'Date', 'key':'date'},
265-
{'title': 'Status', 'key':'status'},
266-
{'title': 'IPR', 'key':'ipr'},
267-
{'title': 'AD / Shepherd', 'key':'ad'}]
262+
meta['headers'] = [{'title': 'Document', 'key': 'document'},
263+
{'title': 'Title', 'key': 'title'},
264+
{'title': 'Date', 'key': 'date'},
265+
{'title': 'Status', 'key': 'status'},
266+
{'title': 'IPR', 'key': 'ipr'}]
267+
if show_ad_and_shepherd:
268+
meta['headers'].append({'title': 'AD / Shepherd', 'key': 'ad'})
269+
meta['show_ad_and_shepherd'] = show_ad_and_shepherd
268270

269271
if query and hasattr(query, "urlencode"): # fed a Django QueryDict
270272
d = query.copy()

ietf/doc/views_search.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,10 @@ def sort_key(doc):
591591
if not ad:
592592
raise Http404
593593

594-
results, meta = prepare_document_table(request, Document.objects.filter(ad=ad), max_results=500)
594+
results, meta = prepare_document_table(
595+
request, Document.objects.filter(ad=ad), max_results=500, show_ad_and_shepherd=False
596+
)
595597
results.sort(key=lambda d: sort_key(d))
596-
del meta["headers"][-1]
597598

598599
# filter out some results
599600
results = [
@@ -691,7 +692,7 @@ def sort_key(doc):
691692
{
692693
"docs": results,
693694
"meta": meta,
694-
"ad_name": ad.name,
695+
"ad": ad,
695696
"blocked_docs": blocked_docs,
696697
"not_balloted_docs": not_balloted_docs,
697698
},

ietf/templates/doc/drafts_for_ad.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
{% block pagehead %}
77
<link rel="stylesheet" href="{% static "ietf/css/list.css" %}">
88
{% endblock %}
9-
{% block title %}Documents for {{ ad_name }}{% endblock %}
9+
{% block title %}Documents for {{ ad.name }}{% endblock %}
1010
{% block content %}
1111
{% origin %}
12-
<h1>Documents for {{ ad_name }}</h1>
12+
<h1>Documents for {{ ad.name }}</h1>
1313
<a class="btn btn-primary my-3" href="{% url 'ietf.doc.views_search.ad_workload' %}">IESG dashboard</a>
1414
{% if blocked_docs %}
15-
<h2 class="mt-4">Blocking positions held by {{ ad_name }}</h2>
15+
<h2 class="mt-4">Blocking positions held by {{ ad.name }}</h2>
1616
<table class="table table-sm table-striped tablesorter">
1717
<thead>
1818
<tr>
@@ -54,7 +54,7 @@ <h2 class="mt-4">Blocking positions held by {{ ad_name }}</h2>
5454
</table>
5555
{% endif %}
5656
{% if not_balloted_docs %}
57-
<h2 class="mt-4">Missing ballot positions for {{ ad_name }}</h2>
57+
<h2 class="mt-4">Missing ballot positions for {{ ad.name }}</h2>
5858
<table class="table table-sm table-striped tablesorter">
5959
<thead>
6060
<tr>
@@ -80,7 +80,7 @@ <h2 class="mt-4">Missing ballot positions for {{ ad_name }}</h2>
8080
</tbody>
8181
</table>
8282
{% endif %}
83-
<h2 class="mt-4">Documents for {{ ad_name }}</h2>
83+
<h2 class="mt-4">Documents for {{ ad.name }}</h2>
8484
{% include "doc/search/search_results.html" with start_table=True end_table=True %}
8585
{% endblock %}
8686
{% block js %}

ietf/templates/doc/search/search_result_row.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
</a>
143143
{% endif %}
144144
</td>
145-
{% if ad_name == None or ad_name != doc.ad.plain_name %}
145+
{% if show_ad_and_shepherd %}
146146
<td class="d-none d-sm-table-cell bg-transparent">
147147
{% if doc.ad %}
148148
{% person_link doc.ad title="Area Director" %}

ietf/templates/doc/search/search_results.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
</tbody>
5656
<tbody>
5757
{% for doc in doc_group.list %}
58-
{% include "doc/search/search_result_row.html" %}
58+
{% include "doc/search/search_result_row.html" with show_ad_and_shepherd=meta.show_ad_and_shepherd %}
5959
{% endfor %}
6060
</tbody>
6161
{% endfor %}

ietf/templates/iesg/agenda_documents.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ <h2>
5555
</thead>
5656
<tbody>
5757
{% for doc in section.docs %}
58-
{% include "doc/search/search_result_row.html" with color_ad_position=True %}
58+
{% include "doc/search/search_result_row.html" with color_ad_position=True show_ad_and_shepherd=True %}
5959
{% endfor %}
6060
</tbody>
6161
</table>

0 commit comments

Comments
 (0)