From e2541030d35898332403a7ce8dc4398da4c748b3 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Wed, 1 Dec 2021 18:45:19 +0000 Subject: [PATCH] More bs5 changes - Legacy-Id: 19725 --- ietf/static/js/ietf.js | 53 +++++- ietf/static/js/manage-community-list.js | 36 ++++ ietf/templates/api/openid-issuer.html | 11 +- ietf/templates/base/menu_active_groups.html | 9 +- ietf/templates/base/menu_wg.html | 6 +- ietf/templates/community/list_menu.html | 44 ++--- ietf/templates/community/manage_list.html | 122 ++++++------ ietf/templates/community/track_document.html | 29 ++- ietf/templates/community/view_list.html | 19 +- .../doc/search/search_result_row.html | 175 ++++++++++-------- .../liaisons/liaison_deadline_mail.txt | 4 +- ietf/templates/sync/discrepancies.html | 26 ++- ietf/templates/sync/notify.html | 15 +- ietf/templates/sync/rfceditor_undo.html | 30 +-- package.json | 1 + 15 files changed, 343 insertions(+), 237 deletions(-) create mode 100644 ietf/static/js/manage-community-list.js diff --git a/ietf/static/js/ietf.js b/ietf/static/js/ietf.js index a78cca2a2..7e3f3df27 100644 --- a/ietf/static/js/ietf.js +++ b/ietf/static/js/ietf.js @@ -108,7 +108,6 @@ $(document) // Automatically add a navigation pane to long pages $(document) .ready(function () { - var headings = $("#content") .find("h1, h2, h3, h4, h5, h6"); @@ -123,11 +122,6 @@ $(document) var last_level; var nav; - $("body") - .attr("data-bs-spy", "scroll") - .attr("data-bs-target", "#righthand-nav") - .scrollspy("refresh"); - $("#content") .attr("data-bs-offset", 0) .attr("tabindex", 0) @@ -185,5 +179,52 @@ $(document) item[0].scrollIntoView({ block: "center" }); } }); + + $("body") + .attr("data-bs-spy", "scroll") + .attr("data-bs-target", "#righthand-nav") + .scrollspy("refresh"); + + $(window) + .on("activate.bs.scrollspy", function () { + console.log("X"); + }); } + }); + +// Replace track/untrack functionality with js. +$(document) + .ready(function () { + $('.review-wish-add-remove-doc.ajax, .track-untrack-doc') + .click(function (e) { + e.preventDefault(); + var trigger = $(this); + $.ajax({ + url: trigger.attr('href'), + type: 'POST', + cache: false, + dataType: 'json', + success: function (response) { + if (response.success) { + trigger.parent() + .find(".track-untrack-doc") + .tooltip("hide"); + trigger.addClass("visually-hidden"); + + var target_unhide = null; + if (trigger.hasClass('review-wish-add-remove-doc')) { + target_unhide = '.review-wish-add-remove-doc'; + } else if (trigger.hasClass('track-untrack-doc')) { + target_unhide = '.track-untrack-doc'; + } + if (target_unhide) { + trigger.parent() + .find(target_unhide) + .not(trigger) + .removeClass("visually-hidden"); + } + } + } + }); + }); }); \ No newline at end of file diff --git a/ietf/static/js/manage-community-list.js b/ietf/static/js/manage-community-list.js new file mode 100644 index 000000000..34cca4861 --- /dev/null +++ b/ietf/static/js/manage-community-list.js @@ -0,0 +1,36 @@ +$(document) + .ready(function () { + $("[name=rule_type]") + .on("click change keypress", function () { + var form = $(this) + .closest("form"); + var ruleType = $(this) + .val(); + var emptyForms = $(".empty-forms"); + + var currentFormContent = form.find(".form-content-placeholder .rule-type"); + if (!ruleType || !currentFormContent.hasClass(ruleType)) { + // move previous back into the collection + if (currentFormContent.length > 0) + emptyForms.append(currentFormContent); + else + currentFormContent.html(""); // make sure it's empty + + // insert new + if (ruleType) + form.find(".form-content-placeholder") + .append(emptyForms.find("." + ruleType)); + } + }); + + $("[name=rule_type]") + .each(function () { + // don't trigger the handler if we have a form with errors + var placeholderContent = $(this) + .closest("form") + .find(".form-content-placeholder >"); + if (placeholderContent.length == 0 || placeholderContent.hasClass("rule-type")) + $(this) + .trigger("change"); + }); + }); \ No newline at end of file diff --git a/ietf/templates/api/openid-issuer.html b/ietf/templates/api/openid-issuer.html index 3f844ee1a..2c1b09937 100644 --- a/ietf/templates/api/openid-issuer.html +++ b/ietf/templates/api/openid-issuer.html @@ -1,17 +1,14 @@ +{# bs5ok #} {# Copyright The IETF Trust 2007, All Rights Reserved #} {% extends "base.html" %} {% block title %}OpenID Connect Issuer{% endblock %} - {% block content %} - -

OpenID Connect Issuer

+

OpenID Connect Issuer

This is the IETF Datatracker's OpenID Connect Issuer endpoint. The OpenID Connect provider info is at - {% url 'oidc_provider:provider-info' %}" + {% url 'oidc_provider:provider-info' %}

- -{% endblock %} - +{% endblock %} \ No newline at end of file diff --git a/ietf/templates/base/menu_active_groups.html b/ietf/templates/base/menu_active_groups.html index 8dd6635ee..8771c2674 100644 --- a/ietf/templates/base/menu_active_groups.html +++ b/ietf/templates/base/menu_active_groups.html @@ -1,17 +1,18 @@ +{# bs5ok #} {# Copyright The IETF Trust 2015, All Rights Reserved #} - {% load origin %} {% origin %} - \ No newline at end of file diff --git a/ietf/templates/base/menu_wg.html b/ietf/templates/base/menu_wg.html index 71a30fc27..347934067 100644 --- a/ietf/templates/base/menu_wg.html +++ b/ietf/templates/base/menu_wg.html @@ -1,11 +1,11 @@ +{# bs5ok #} {# Copyright The IETF Trust 2015, All Rights Reserved #} - {% load origin %} {% origin %} - {% for p in parents %}
  • - + {{ p.short_name }}
  • diff --git a/ietf/templates/community/list_menu.html b/ietf/templates/community/list_menu.html index 5ffbbfce2..f444c75b7 100644 --- a/ietf/templates/community/list_menu.html +++ b/ietf/templates/community/list_menu.html @@ -1,29 +1,31 @@ - \ No newline at end of file + + Export as CSV + + \ No newline at end of file diff --git a/ietf/templates/community/manage_list.html b/ietf/templates/community/manage_list.html index 3c9312c11..e82d05c68 100644 --- a/ietf/templates/community/manage_list.html +++ b/ietf/templates/community/manage_list.html @@ -1,39 +1,43 @@ +{# bs5ok #} {% extends "base.html" %} {# Copyright The IETF Trust 2015, All Rights Reserved #} {% load origin %} {% load django_bootstrap5 %} {% load static %} {% load misc_filters %} - {% block pagehead %} + {{ all_forms|merge_media:'css' }} {% endblock %} - {% block title %}Manage {{ clist.long_name }}{% endblock %} - {% block content %} {% origin %}

    Manage {{ clist.long_name }}

    - - - {% bootstrap_messages %} - -

    The list currently tracks {{ total_count }} document{{ total_count|pluralize }}.

    - -

    Back to list

    - +

    + The list currently tracks + {{ total_count }} document{{ total_count|pluralize }} + . +

    +

    + Back to list +

    Individual documents

    - {% if individually_added %} -

    The list tracks {{ individually_added|length }} individually added document{{ individually_added|length|pluralize }}:

    - +

    + The list tracks {{ individually_added|length }} individually added document{{ individually_added|length|pluralize }}: +

    +
    + + + + {% for d in individually_added %}
    DocumentManage
    {{ d.name }} -
    + {% csrf_token %} @@ -44,32 +48,44 @@
    {% else %} -

    The list does not track any individually added documents yet.

    +

    + The list does not track any individually added documents yet. +

    {% endif %} - {% if clist.group %} -

    Add individual documents here:

    +

    + Add individual documents here: +

    {% else %} -

    Conveniently track individual documents in your personal list with the track icon in search results.

    - -

    You can also add documents here:

    +

    + Conveniently track individual documents in your personal list with the track icon + + in + search results + . +

    +

    + You can also add documents here: +

    {% endif %} - {% csrf_token %} - {% bootstrap_field add_doc_form.documents show_label=False %} - + {% bootstrap_form add_doc_form show_label=False %} + {% bootstrap_button button_type="submit" name="action" value="add_documents" content="Add documents" %} - -

    Search rules

    - -

    You can track documents with a search rule. When a document fulfills the search criteria, it will automatically show up in the list.

    - +

    + You can track documents with a search rule. When a document fulfills the search criteria, it will automatically show up in the list. +

    {% if rules %} - +
    - + + + + + + {% for rule in rules %} @@ -86,7 +102,7 @@ {{ rule.text }} {% endif %} - +
    RuleValueDocuments
    RuleValueMatching DocumentsManage
    {{ rule.matching_documents_count }} match{{ rule.matching_documents_count|pluralize:"es" }}{{ rule.matching_documents_count }}
    {% csrf_token %} @@ -98,47 +114,37 @@ {% endfor %}
    - {% else %} - -

    No rules defined.

    - +

    + No rules defined. +

    {% endif %} - -
    Add a new rule
    - -
    -

    Add a new rule

    - +
    + Add a new rule +
    +
    {% csrf_token %} - {% bootstrap_form rule_type_form %} - + {% bootstrap_form rule_type_form layout="horizontal" %}
    {% if rule_form %} - {% bootstrap_form rule_form %} + {% bootstrap_form rule_form layout="horizontal" %} {% endif %}
    - - - - - - -
    +
    {% for rule_type, f in empty_rule_forms.items %} -
    - {% bootstrap_form f %} -
    +
    {% bootstrap_form f layout="horizontal" %}
    {% endfor %}
    - {% endblock %} - {% block js %} {{ all_forms|merge_media:'js' }} + -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/ietf/templates/community/track_document.html b/ietf/templates/community/track_document.html index bf00e7b2c..ea33fb649 100644 --- a/ietf/templates/community/track_document.html +++ b/ietf/templates/community/track_document.html @@ -1,18 +1,15 @@ +{# bs5ok #} {# Copyright The IETF Trust 2015, All Rights Reserved #} -{% load origin %}{% origin %} -{% load django_bootstrap5 %} - +{% extends "base.html" %} +{% load origin %} +{% origin %} {% block title %}Track document {{ name }}{% endblock %} - -{% bootstrap_messages %} - -
    - {% csrf_token %} -

    Add {{ name }} to the list?

    - - - - - - -
    +{% block content %} +
    + {% csrf_token %} +

    + Add {{ name }} to the list? +

    + +
    +{% endblock %} \ No newline at end of file diff --git a/ietf/templates/community/view_list.html b/ietf/templates/community/view_list.html index 5daabadc1..d54e740d0 100644 --- a/ietf/templates/community/view_list.html +++ b/ietf/templates/community/view_list.html @@ -1,23 +1,26 @@ +{# bs5ok #} {% extends "base.html" %} {# Copyright The IETF Trust 2015, All Rights Reserved #} {% load origin %} -{% load django_bootstrap5 %} - +{% load static django_bootstrap5 %} {% block title %}{{ clist.long_name }}{% endblock %} - +{% block pagehead %} + +{% endblock %} {% block content %} {% origin %}

    {{ clist.long_name }}

    - {% bootstrap_messages %} - {% if can_manage_list %} - + Manage list {% endif %} - - {% include "doc/search/search_results.html" with skip_no_matches_warning=True %} + {% include "doc/search/search_results.html" with skip_no_matches_warning=True start_table=True end_table=True %} {% include "community/list_menu.html" %} {% endblock %} +{% block js %} + +{% endblock %} \ No newline at end of file diff --git a/ietf/templates/doc/search/search_result_row.html b/ietf/templates/doc/search/search_result_row.html index bb3f36eb3..2ca91f9e3 100644 --- a/ietf/templates/doc/search/search_result_row.html +++ b/ietf/templates/doc/search/search_result_row.html @@ -1,66 +1,80 @@ -{# Copyright The IETF Trust 2015, All Rights Reserved #}{% load origin %}{% origin %} +{# bs5ok #} +{# Copyright The IETF Trust 2015, All Rights Reserved #} +{% load origin %} +{% origin %} {% load widget_tweaks %} {% load ietf_filters %} {% load ballot_icon %} {% load person_filters %} {% load django_bootstrap5 %} - - + {% endspaceless %}> {% if user.is_authenticated %} - + - +
    {% endif %} {% if user.review_teams %} - + - +
    {% endif %} - {% for session in doc.sessions %} + title="Calendar entry: document is on the agenda for {{ session.group.acronym }}@{{ session.meeting }}"> {% endfor %} - - {% if doc.pages %} - {{doc.pages}} page{{ doc.pages|pluralize }} - {% endif %} - + {% if doc.pages %}{{ doc.pages }} page{{ doc.pages|pluralize }}{% endif %}
    - {% if doc.get_state_slug == "rfc" %}RFC {{ doc.rfc_number }}{% else %}{{ doc.name }}-{{ doc.rev }}{% endif %} - - {% if doc.get_state_slug == "rfc" and "draft" in doc.name %} - (was {{ doc.name }}) - {% endif %} + + {% if doc.get_state_slug == "rfc" %} + RFC {{ doc.rfc_number }} + {% else %} + {{ doc.name }}-{{ doc.rev }} + {% endif %} + + {% if doc.get_state_slug == "rfc" and "draft" in doc.name %}(was {{ doc.name }}){% endif %}
    {{ doc.title }} {% if doc.has_verified_errata %} - Errata + + Errata + {% elif doc.has_errata %} - Errata + + Errata + {% endif %}
    - {% if user|has_role:"Secretariat" and doc.reschedule_form %}
    {% bootstrap_form doc.reschedule_form layout="floating" %} @@ -70,68 +84,69 @@
    {% endif %} - - {% if doc.latest_revision_date|timesince_days|new_enough:request and doc.get_state_slug != "rfc" %} - - {% if doc.rev != "00" %} - {% elif doc.replaces %}{% endif %} - - {% endif %} - {% if doc.get_state_slug == "rfc" %}{{ doc.latest_revision_date|date:"Y-m" }}{% else %}{{ doc.latest_revision_date|date:"Y-m-d" }}{% endif %} - {% if doc.latest_revision_date|timesince_days|new_enough:request and doc.get_state_slug != "rfc" %} - {% if doc.rev != "00" or doc.replaces %}{% endif %} - {% endif %} - - - {% comment %} + {% if doc.rev != "00" %} + + {% elif doc.replaces %} + + {% endif %} + {% endif %} + {% if doc.get_state_slug == "rfc" %} + {{ doc.latest_revision_date|date:"Y-m" }} + {% else %} + {{ doc.latest_revision_date|date:"Y-m-d" }} + {% endif %} + {% if doc.latest_revision_date|timesince_days|new_enough:request and doc.get_state_slug != "rfc" %} + {% if doc.rev != "00" or doc.replaces %}{% endif %} + {% endif %} + + {% comment %} {% for check in doc.submission.latest_checks %} {% if check.passed != None and check.symbol.strip %} {% if check.errors or check.warnings %} - {{ check.symbol|safe }} + {{ check.symbol|safe }} {% else %} - {{ check.symbol|safe }} + {{ check.symbol|safe }} {% endif %} {% include "doc/yang-check-modal-overlay.html" %} {% endif %} {% endfor %} - {% endcomment %} - - {% if doc.latest_revision_date|timesince_days|new_enough:request %} -
    New
    - {% endif %} - - {% if doc.get_state_slug == "active" and doc.expirable and doc.expires|timesince_days|expires_soon:request %} - Expires soon - {% endif %} - - - - {% include "doc/search/status_columns.html" %} - - - {% if doc.related_ipr %} - - {{ doc.related_ipr|length }} - - {% endif %} - - - {% if ad_name == None or ad_name != doc.ad.plain_name %} - - {% if doc.ad %} - {% person_link doc.ad title="Area Director" %}
    +{% endcomment %} + {% if doc.latest_revision_date|timesince_days|new_enough:request %} + +
    + New +
    + {% endif %} + {% if doc.get_state_slug == "active" and doc.expirable and doc.expires|timesince_days|expires_soon:request %} + + Expires soon + {% endif %} + + {% include "doc/search/status_columns.html" %} + + {% if doc.related_ipr %} + + {{ doc.related_ipr|length }} + + {% endif %} + + {% if ad_name == None or ad_name != doc.ad.plain_name %} + + {% if doc.ad %} + {% person_link doc.ad title="Area Director" %} +
    + {% endif %} + {% if doc.shepherd %} + {% email_person_link doc.shepherd title="Shepherd" class="small text-muted" %} + {% endif %} + {% endif %} - {% if doc.shepherd %}{% email_person_link doc.shepherd title="Shepherd" class="small text-muted" %}{% endif %} - - {% endif %} - - {% if color_row_positions %} - {% with doc|ballotposition:user as pos %} - - {% endwith %} - {% endif %} - - \ No newline at end of file + {% if color_row_positions %} + {% with doc|ballotposition:user as pos %} + + {% endwith %} + {% endif %} + \ No newline at end of file diff --git a/ietf/templates/liaisons/liaison_deadline_mail.txt b/ietf/templates/liaisons/liaison_deadline_mail.txt index 329471939..ddd7f72ab 100644 --- a/ietf/templates/liaisons/liaison_deadline_mail.txt +++ b/ietf/templates/liaisons/liaison_deadline_mail.txt @@ -1,4 +1,4 @@ -{% autoescape off %}The following liaison {{ days_msg }}. Plase take actions. +{% autoescape off %}The following liaison {{ days_msg }}. Please take actions. {% include "liaisons/liaison_mail.txt" %} -{% endautoescape %} +{% endautoescape %} \ No newline at end of file diff --git a/ietf/templates/sync/discrepancies.html b/ietf/templates/sync/discrepancies.html index b70d41691..199269b1e 100644 --- a/ietf/templates/sync/discrepancies.html +++ b/ietf/templates/sync/discrepancies.html @@ -1,34 +1,32 @@ +{# bs5ok #} {% extends "base.html" %} {# Copyright The IETF Trust 2015, All Rights Reserved #} {% load origin static %} - {% block pagehead %} {% endblock %} - {% block title %}Sync discrepancies{% endblock %} - {% block content %} {% origin %}

    Sync discrepancies

    - {% for title, docs in sections %}

    {{ title }}

    - {% if docs %} - - - - + + + + {% for d in docs %} - + @@ -37,12 +35,12 @@
    Draft nameIESG stateRFC Editor stateIANA Action stateDraft nameIESG stateRFC Editor stateIANA Action state
    {{ d.name }} + {{ d.name }} + {{ d.iesg_state|default:"" }} {{ d.rfc_state|default:"" }} {{ d.iana_action_state|default:"" }}
    {% else %} -

    (None)

    +

    + (None) +

    {% endif %} - {% endfor %} {% endblock %} - {% block js %} -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/ietf/templates/sync/notify.html b/ietf/templates/sync/notify.html index d7e388f60..788a8ef75 100644 --- a/ietf/templates/sync/notify.html +++ b/ietf/templates/sync/notify.html @@ -1,17 +1,18 @@ +{# bs5ok #} {% extends "base.html" %} {# Copyright The IETF Trust 2015, All Rights Reserved #} {% load origin %} - {% block title %}Trigger {{ notification }} sync for {{ org }}{% endblock %} - {% block content %} {% origin %}

    Trigger {{ notification }} sync for {{ org }}

    - -

    Update the Datatracker with {{ help_text|safe }} at {{ org }}.

    - +

    + Update the Datatracker with {{ help_text|safe }} at {{ org }}. +

    {% csrf_token %} - +
    -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/ietf/templates/sync/rfceditor_undo.html b/ietf/templates/sync/rfceditor_undo.html index 25eef5f62..c83e70c8c 100644 --- a/ietf/templates/sync/rfceditor_undo.html +++ b/ietf/templates/sync/rfceditor_undo.html @@ -1,28 +1,32 @@ +{# bs5ok #} {% extends "base.html" %} {# Copyright The IETF Trust 2015-2019, All Rights Reserved #} -{% load origin %} - +{% load origin static %} {% block title %}Undo RFC Editor state events{% endblock %} +{% block pagehead %} + +{% endblock %} + {% block content %} {% origin %}

    Undo RFC Editor state events

    - - +
    - - - - + + + + - {% for e in events %} - - + +
    TimeDocumentTextUndoTimeDocumentTextUndo
    {{ e.time|date:"Y-m-d H:i:s"}}{{ e.doc.name }}{{ e.time|date:"Y-m-d H:i:s" }} + {{ e.doc.name }} + {{ e.desc|safe }}
    @@ -36,3 +40,7 @@
    {% endblock %} + +{% block js %} + +{% endblock %} \ No newline at end of file diff --git a/package.json b/package.json index 84ae6bd79..d82e7fde1 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "ietf/static/js/ietf.js", "ietf/static/js/liaisons.js", "ietf/static/js/list.js", + "ietf/static/js/manage-community-list.js", "ietf/static/js/moment-timezone-with-data-10-year-range.js", "ietf/static/js/moment.js", "ietf/static/js/review-stats.js",