Skip to content

Commit

Permalink
fix: Never show AD col on drafts_for_ad.html (#6914)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jennifer-richards committed Jan 12, 2024
1 parent b70be9b commit cb70da9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
16 changes: 9 additions & 7 deletions ietf/doc/utils_search.py
Expand Up @@ -181,7 +181,7 @@ def augment_docs_with_related_docs_info(docs):
originalDoc = d.related_that_doc('conflrev')[0]
d.pages = originalDoc.pages

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

meta['headers'] = [{'title': 'Document', 'key':'document'},
{'title': 'Title', 'key':'title'},
{'title': 'Date', 'key':'date'},
{'title': 'Status', 'key':'status'},
{'title': 'IPR', 'key':'ipr'},
{'title': 'AD / Shepherd', 'key':'ad'}]
meta['headers'] = [{'title': 'Document', 'key': 'document'},
{'title': 'Title', 'key': 'title'},
{'title': 'Date', 'key': 'date'},
{'title': 'Status', 'key': 'status'},
{'title': 'IPR', 'key': 'ipr'}]
if show_ad_and_shepherd:
meta['headers'].append({'title': 'AD / Shepherd', 'key': 'ad'})
meta['show_ad_and_shepherd'] = show_ad_and_shepherd

if query and hasattr(query, "urlencode"): # fed a Django QueryDict
d = query.copy()
Expand Down
7 changes: 4 additions & 3 deletions ietf/doc/views_search.py
Expand Up @@ -591,9 +591,10 @@ def sort_key(doc):
if not ad:
raise Http404

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

# filter out some results
results = [
Expand Down Expand Up @@ -691,7 +692,7 @@ def sort_key(doc):
{
"docs": results,
"meta": meta,
"ad_name": ad.name,
"ad": ad,
"blocked_docs": blocked_docs,
"not_balloted_docs": not_balloted_docs,
},
Expand Down
10 changes: 5 additions & 5 deletions ietf/templates/doc/drafts_for_ad.html
Expand Up @@ -6,13 +6,13 @@
{% block pagehead %}
<link rel="stylesheet" href="{% static "ietf/css/list.css" %}">
{% endblock %}
{% block title %}Documents for {{ ad_name }}{% endblock %}
{% block title %}Documents for {{ ad.name }}{% endblock %}
{% block content %}
{% origin %}
<h1>Documents for {{ ad_name }}</h1>
<h1>Documents for {{ ad.name }}</h1>
<a class="btn btn-primary my-3" href="{% url 'ietf.doc.views_search.ad_workload' %}">IESG dashboard</a>
{% if blocked_docs %}
<h2 class="mt-4">Blocking positions held by {{ ad_name }}</h2>
<h2 class="mt-4">Blocking positions held by {{ ad.name }}</h2>
<table class="table table-sm table-striped tablesorter">
<thead>
<tr>
Expand Down Expand Up @@ -54,7 +54,7 @@ <h2 class="mt-4">Blocking positions held by {{ ad_name }}</h2>
</table>
{% endif %}
{% if not_balloted_docs %}
<h2 class="mt-4">Missing ballot positions for {{ ad_name }}</h2>
<h2 class="mt-4">Missing ballot positions for {{ ad.name }}</h2>
<table class="table table-sm table-striped tablesorter">
<thead>
<tr>
Expand All @@ -80,7 +80,7 @@ <h2 class="mt-4">Missing ballot positions for {{ ad_name }}</h2>
</tbody>
</table>
{% endif %}
<h2 class="mt-4">Documents for {{ ad_name }}</h2>
<h2 class="mt-4">Documents for {{ ad.name }}</h2>
{% include "doc/search/search_results.html" with start_table=True end_table=True %}
{% endblock %}
{% block js %}
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/doc/search/search_result_row.html
Expand Up @@ -142,7 +142,7 @@
</a>
{% endif %}
</td>
{% if ad_name == None or ad_name != doc.ad.plain_name %}
{% if show_ad_and_shepherd %}
<td class="d-none d-sm-table-cell bg-transparent">
{% if doc.ad %}
{% person_link doc.ad title="Area Director" %}
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/doc/search/search_results.html
Expand Up @@ -55,7 +55,7 @@
</tbody>
<tbody>
{% for doc in doc_group.list %}
{% include "doc/search/search_result_row.html" %}
{% include "doc/search/search_result_row.html" with show_ad_and_shepherd=meta.show_ad_and_shepherd %}
{% endfor %}
</tbody>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/iesg/agenda_documents.html
Expand Up @@ -55,7 +55,7 @@ <h2>
</thead>
<tbody>
{% for doc in section.docs %}
{% include "doc/search/search_result_row.html" with color_ad_position=True %}
{% include "doc/search/search_result_row.html" with color_ad_position=True show_ad_and_shepherd=True %}
{% endfor %}
</tbody>
</table>
Expand Down

0 comments on commit cb70da9

Please sign in to comment.