From bc0f26dacad68ceb217695265374f84021cc9f7e Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Fri, 12 Jan 2024 11:09:31 -0400 Subject: [PATCH 1/4] fix: Pass ad as Person instead of name --- ietf/doc/views_search.py | 2 +- ietf/templates/doc/drafts_for_ad.html | 10 +++++----- ietf/templates/doc/search/search_result_row.html | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ietf/doc/views_search.py b/ietf/doc/views_search.py index 0117886f70..0f204df664 100644 --- a/ietf/doc/views_search.py +++ b/ietf/doc/views_search.py @@ -691,7 +691,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, }, diff --git a/ietf/templates/doc/drafts_for_ad.html b/ietf/templates/doc/drafts_for_ad.html index 28ebb2225b..18e5960e81 100644 --- a/ietf/templates/doc/drafts_for_ad.html +++ b/ietf/templates/doc/drafts_for_ad.html @@ -6,13 +6,13 @@ {% block pagehead %} {% endblock %} -{% block title %}Documents for {{ ad_name }}{% endblock %} +{% block title %}Documents for {{ ad.name }}{% endblock %} {% block content %} {% origin %} -

Documents for {{ ad_name }}

+

Documents for {{ ad.name }}

IESG dashboard {% if blocked_docs %} -

Blocking positions held by {{ ad_name }}

+

Blocking positions held by {{ ad.name }}

@@ -54,7 +54,7 @@

Blocking positions held by {{ ad_name }}

{% endif %} {% if not_balloted_docs %} -

Missing ballot positions for {{ ad_name }}

+

Missing ballot positions for {{ ad.name }}

@@ -80,7 +80,7 @@

Missing ballot positions for {{ ad_name }}

{% endif %} -

Documents for {{ ad_name }}

+

Documents for {{ ad.name }}

{% include "doc/search/search_results.html" with start_table=True end_table=True %} {% endblock %} {% block js %} diff --git a/ietf/templates/doc/search/search_result_row.html b/ietf/templates/doc/search/search_result_row.html index 57ad1f01a0..e3a2a0741d 100644 --- a/ietf/templates/doc/search/search_result_row.html +++ b/ietf/templates/doc/search/search_result_row.html @@ -142,7 +142,7 @@ {% endif %} - {% if ad_name == None or ad_name != doc.ad.plain_name %} + {% if ad is None or ad != doc.ad %} {% if doc.ad %} {% person_link doc.ad title="Area Director" %} From f5fd9acd4a3be89bff243882c1c225da3e5c3994 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Fri, 12 Jan 2024 11:30:23 -0400 Subject: [PATCH 2/4] refactor: Remove redundant AD check Results being shown are already filtered by AD if the `ad` variable is not `None` --- ietf/templates/doc/search/search_result_row.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ietf/templates/doc/search/search_result_row.html b/ietf/templates/doc/search/search_result_row.html index e3a2a0741d..8b5c106c0b 100644 --- a/ietf/templates/doc/search/search_result_row.html +++ b/ietf/templates/doc/search/search_result_row.html @@ -142,7 +142,7 @@ {% endif %} - {% if ad is None or ad != doc.ad %} + {% if ad is None %} {% if doc.ad %} {% person_link doc.ad title="Area Director" %} From 50e5bfff79dd0f12bd2c6290afc3db039a93de89 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Fri, 12 Jan 2024 12:26:06 -0400 Subject: [PATCH 3/4] refactor: Add show_ad... flag to prepare_document_table --- ietf/doc/utils_search.py | 16 +++++++++------- ietf/doc/views_search.py | 5 +++-- ietf/templates/doc/search/search_result_row.html | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ietf/doc/utils_search.py b/ietf/doc/utils_search.py index 5a6a43a63b..8e89139e31 100644 --- a/ietf/doc/utils_search.py +++ b/ietf/doc/utils_search.py @@ -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 @@ -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() diff --git a/ietf/doc/views_search.py b/ietf/doc/views_search.py index 0f204df664..28be793a19 100644 --- a/ietf/doc/views_search.py +++ b/ietf/doc/views_search.py @@ -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 = [ diff --git a/ietf/templates/doc/search/search_result_row.html b/ietf/templates/doc/search/search_result_row.html index 8b5c106c0b..225c33c59c 100644 --- a/ietf/templates/doc/search/search_result_row.html +++ b/ietf/templates/doc/search/search_result_row.html @@ -142,7 +142,7 @@ {% endif %} - {% if ad is None %} + {% if meta.show_ad_and_shepherd %} {% if doc.ad %} {% person_link doc.ad title="Area Director" %} From 1bce1921a0a1f45b30176485633e70c1acd67947 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Fri, 12 Jan 2024 13:21:29 -0400 Subject: [PATCH 4/4] refactor: Expose show_ad_and_shepherd flag --- ietf/templates/doc/search/search_result_row.html | 2 +- ietf/templates/doc/search/search_results.html | 2 +- ietf/templates/iesg/agenda_documents.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ietf/templates/doc/search/search_result_row.html b/ietf/templates/doc/search/search_result_row.html index 225c33c59c..c273153466 100644 --- a/ietf/templates/doc/search/search_result_row.html +++ b/ietf/templates/doc/search/search_result_row.html @@ -142,7 +142,7 @@ {% endif %} - {% if meta.show_ad_and_shepherd %} + {% if show_ad_and_shepherd %} {% if doc.ad %} {% person_link doc.ad title="Area Director" %} diff --git a/ietf/templates/doc/search/search_results.html b/ietf/templates/doc/search/search_results.html index 7a1e149a58..bd6b072f0d 100644 --- a/ietf/templates/doc/search/search_results.html +++ b/ietf/templates/doc/search/search_results.html @@ -55,7 +55,7 @@ {% 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 %} {% endfor %} diff --git a/ietf/templates/iesg/agenda_documents.html b/ietf/templates/iesg/agenda_documents.html index c388c16baf..80dd9956fa 100644 --- a/ietf/templates/iesg/agenda_documents.html +++ b/ietf/templates/iesg/agenda_documents.html @@ -55,7 +55,7 @@

{% 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 %}