diff --git a/.eslintrc.js b/.eslintrc.js index d213e9b85..41defa8f6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,7 +6,8 @@ module.exports = { "no-multiple-empty-lines": ["error", { max: 2, maxEOF: 0 }], "quote-props": ["error", "as-needed"], "brace-style": ["error", "1tbs", { allowSingleLine: true }], - "semi": ["error", "always"], + semi: ["error", "always"], + "newline-per-chained-call": ["error"] }, env: { browser: true, diff --git a/ietf/static/css/datatables.scss b/ietf/static/css/datatables.scss deleted file mode 100644 index ac34cc1ed..000000000 --- a/ietf/static/css/datatables.scss +++ /dev/null @@ -1 +0,0 @@ -@import "../../../node_modules/datatables.net-bs5/css/dataTables.bootstrap5"; \ No newline at end of file diff --git a/ietf/static/css/ietf.scss b/ietf/static/css/ietf.scss index d018877b9..7efedc11b 100644 --- a/ietf/static/css/ietf.scss +++ b/ietf/static/css/ietf.scss @@ -61,10 +61,6 @@ $bootstrap-icons-font-src: url("~node_modules/bootstrap-icons/font/fonts/bootstr url("~node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff?a97b3594ad416896e15824f6787370e0") format("woff") !default; @import "../../../node_modules/bootstrap-icons/font/bootstrap-icons"; -// Install the datatables.net bootstrap5 styles. -// FIXME: Including this with ~ fails for some odd reason? -@import "../../../node_modules/datatables.net-bs5/css/dataTables.bootstrap5"; - // Leave room for fixed-top navbar. body { padding-top: 60px; diff --git a/ietf/static/js/datatables.js b/ietf/static/js/datatables.js deleted file mode 100644 index 891ea9ed2..000000000 --- a/ietf/static/js/datatables.js +++ /dev/null @@ -1,14 +0,0 @@ -require('datatables.net')(window, $); -require('datatables.net-bs5')(window, $); - -// Disable datatable paging by default. -$.extend($.fn.dataTable.defaults, { - info : false, - paging : false, - order: [], - "search": { - "caseInsensitive": true - } -}); - -$(document).ready(function() { $(".tablesorter").DataTable(); }); \ No newline at end of file diff --git a/ietf/static/js/list.js b/ietf/static/js/list.js new file mode 100644 index 000000000..dd49e96b7 --- /dev/null +++ b/ietf/static/js/list.js @@ -0,0 +1,78 @@ +import * as List from "list.js"; + +$(document) + .ready(function () { + $("table.tablesorter") + .each(function () { + var searcher = $.parseHTML(` +
+ + +
`); + + $(this) + .before(searcher); + + var fields = $(this) + .find("thead > tr:first") + .children("th") + .map(function () { + return $(this) + .attr("data-field"); + }) + .toArray(); + console.log(fields); + + var search_field = $(searcher) + .find("input.search"); + + var reset_search = $(searcher) + .find("button.search-reset"); + + if (fields.length == 0) { + searcher.addClass("visually-hidden"); + } else { + console.log($(this)[0]); + var list = new List($(this) + .parent()[0], { valueNames: fields }); + + reset_search.on("click", function () { + search_field.val(""); + list.search(); + }); + + search_field.on("keydown", function (e) { + if (e.key == "Escape") { + reset_search.trigger("click"); + } + }); + + list.on("searchComplete", function () { + var last_show_with_children = -1; + for (var i = 0; i < list.items.length; i++) { + if ($(list.items[i].elm) + .hasClass("show-with-children")) { + last_show_with_children = i; + } + + if (list.items[i].found && + last_show_with_children >= 0 && + list.items[last_show_with_children].found == false) { + list.items[last_show_with_children].found = true; + list.items[last_show_with_children].show(); + last_show_with_children = -1; + } + + if ($(list.items[i].elm) + .hasClass("show-always")) { + list.items[i].found = true; + list.items[i].show(); + } + } + list.update(); + }); + } + }); + }); \ No newline at end of file diff --git a/ietf/templates/meeting/agenda.html b/ietf/templates/meeting/agenda.html index 824b22d54..3cb569ff0 100644 --- a/ietf/templates/meeting/agenda.html +++ b/ietf/templates/meeting/agenda.html @@ -118,96 +118,106 @@

Check boxes below to select individual sessions.

{% endif %} - - {% for item in filtered_assignments %} - - {% ifchanged item.timeslot.time|date:"Y-m-d" %} - - +
- {# The anchor here needs to be in a div, not in the th, in order for the anchor-target margin hack to work #} -
-
{{ item.timeslot.time|date:"l, F j, Y" }}
-
+ + + + + + + + - {% endifchanged %} + + + {% for item in filtered_assignments %} + {% ifchanged item.timeslot.time|date:"Y-m-d" %} + + + + {% endifchanged %} + {% if item|is_special_agenda_item %} + + - {% if item|is_special_agenda_item %} - - + + - - - - - + + {% elif item|is_regular_agenda_item or item|is_plenary_agenda_item %} {% if item|is_regular_agenda_item %} {% ifchanged %} - - + {% endifchanged %} {% endif %} @@ -232,10 +242,10 @@ {% if item.slot_type.slug == 'plenary' %} - + - - + - {% endif %} - + {% endif %} {% endif %} {% endfor %} +
+ {# The anchor here needs to be in a div, not in the th, in order for the anchor-target margin hack to work #} +
+
{{ item.timeslot.time|date:"l, F j, Y" }}
+
+ {% if item.session_keyword %} + + {% endif %} +
- {% if item.session_keyword %} - + + {% include "meeting/timeslot_start_end.html" %} + + {% location_anchor item.timeslot %} + {{ item.timeslot.get_html_location }} + {% end_location_anchor %} + {% if item.timeslot.show_location and item.timeslot.get_html_location %} + {% with item.timeslot.location.floorplan as floor %} + {% if item.timeslot.location.floorplan %} + + {% endif %} + {% endwith %} + {% endif %} + + {% agenda_anchor item.session %} + {% assignment_display_name item %} + {% end_agenda_anchor %} + + {% if item.session.current_status == 'canceled' %} + CANCELLED + {% else %} +
+ {% if item.slot_type.slug == 'other' %} + {% if item.session.agenda or item.session.remote_instructions or item.session.agenda_note %} + {% include "meeting/session_buttons_include.html" with show_agenda=True item=item schedule=schedule %} + {% else %} + {% for slide in item.session.slides %} + {{ slide.title|clean_whitespace }} +
+ {% endfor %} + {% endif %} {% endif %} -
- {% include "meeting/timeslot_start_end.html" %} - - {% location_anchor item.timeslot %} - {{ item.timeslot.get_html_location }} - {% end_location_anchor %} - {% if item.timeslot.show_location and item.timeslot.get_html_location %} - {% with item.timeslot.location.floorplan as floor %} - {% if item.timeslot.location.floorplan %} - - {% endif %} - {% endwith %} - {% endif %} - - {% agenda_anchor item.session %} - {% assignment_display_name item %} - {% end_agenda_anchor %} - - {% if item.session.current_status == 'canceled' %} - CANCELLED - {% else %} -
- {% if item.slot_type.slug == 'other' %} - {% if item.session.agenda or item.session.remote_instructions or item.session.agenda_note %} - {% include "meeting/session_buttons_include.html" with show_agenda=True item=item schedule=schedule %} - {% else %} - {% for slide in item.session.slides %} - {{ slide.title|clean_whitespace }} -
- {% endfor %} - {% endif %} +
{% endif %} - - {% endif %} -
+ {% include "meeting/timeslot_start_end.html" %} - - + + {{ item.timeslot.time|date:"l"}} {{item.timeslot.name|capfirst_allcaps}} - +
+ {% include "meeting/timeslot_start_end.html" %} - - + {% location_anchor item.timeslot %} {{item.timeslot.get_html_location}} {% end_location_anchor %} @@ -252,15 +262,15 @@ {% endif %} {% endwith %} + {% location_anchor item.timeslot %} {{item.timeslot.get_html_location}} {% end_location_anchor %}
{{item.session.historic_group.historic_parent.acronym}}
{{item.session.historic_group.historic_parent.acronym}}
+ {% if item.session.historic_group %} {{item.session.historic_group.acronym}} {% else %} @@ -269,7 +279,7 @@ + {% agenda_anchor item.session %} {% assignment_display_name item %} {% end_agenda_anchor %} @@ -291,7 +301,7 @@ RESCHEDULED {% if item.session.rescheduled_to %} TO -
+
{% if "-utc" in request.path %} {{ item.session.rescheduled_to.utc_start_time|date:"l G:i"|upper }}-{{ item.session.rescheduled_to.utc_end_time|date:"G:i" }} {% else %} @@ -309,9 +319,11 @@ {% endif %}
{% include "meeting/agenda_personalize_buttonlist.html" with meeting=schedule.meeting only %} @@ -428,6 +440,7 @@ } + @@ -496,7 +509,7 @@ }); document.getElementById('agenda-table') - .addEventListener('click', handleTableClick); + .addEventListener('click', handleTableClick); {% else %} agenda_filter.set_update_callback(update_view); {% endif %} diff --git a/package-lock.json b/package-lock.json index 2a3ae375d..6f5101b8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,10 +9,9 @@ "bootstrap": "^5.1.3", "bootstrap-icons": "^1.7.0", "d3": "^3.5.17", - "datatables.net": "^1.11.3", - "datatables.net-bs5": "^1.11.3", "jquery": "^3.6.0", "js-cookie": "^3.0.1", + "list.js": "^2.3.1", "moment": "^2.29.1", "moment-timezone": "^0.5.34" }, @@ -3194,23 +3193,6 @@ "whatwg-url": "^7.0.0" } }, - "node_modules/datatables.net": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.11.3.tgz", - "integrity": "sha512-VMj5qEaTebpNurySkM6jy6sGpl+s6onPK8xJhYr296R/vUBnz1+id16NVqNf9z5aR076OGcpGHCuiTuy4E05oQ==", - "dependencies": { - "jquery": ">=1.7" - } - }, - "node_modules/datatables.net-bs5": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/datatables.net-bs5/-/datatables.net-bs5-1.11.3.tgz", - "integrity": "sha512-u0tosKUR1XNpXzxOOt2NInnNYayt7GQoG+OM1xPRhdkZ7ZBD4oNF8S0aKve8yvSUq/ZwTMh4WJeh80GdmrJAdQ==", - "dependencies": { - "datatables.net": ">=1.10.25", - "jquery": ">=1.7" - } - }, "node_modules/debug": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", @@ -5568,6 +5550,17 @@ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", "dev": true }, + "node_modules/list.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/list.js/-/list.js-2.3.1.tgz", + "integrity": "sha512-jnmm7DYpKtH3DxtO1E2VNCC9Gp7Wrp/FWA2JxQrZUhVJ2RCQBd57pCN6W5w6jpsfWZV0PCAbTX2NOPgyFeeZZg==", + "dependencies": { + "string-natural-compare": "^2.0.2" + }, + "engines": { + "node": "^6.0 || ^8.0 || ^10.0 || ^12.0 || >=14" + } + }, "node_modules/lmdb-store": { "version": "1.6.13", "resolved": "https://registry.npmjs.org/lmdb-store/-/lmdb-store-1.6.13.tgz", @@ -8096,6 +8089,11 @@ "integrity": "sha1-6Kr8CsGFW0Zmkp7X3RJ1311sgRs=", "dev": true }, + "node_modules/string-natural-compare": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/string-natural-compare/-/string-natural-compare-2.0.3.tgz", + "integrity": "sha512-4Kcl12rNjc+6EKhY8QyDVuQTAlMWwRiNbsxnVwBUKFr7dYPQuXVrtNU4sEkjF9LHY0AY6uVbB3ktbkIH4LC+BQ==" + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -11206,23 +11204,6 @@ "whatwg-url": "^7.0.0" } }, - "datatables.net": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.11.3.tgz", - "integrity": "sha512-VMj5qEaTebpNurySkM6jy6sGpl+s6onPK8xJhYr296R/vUBnz1+id16NVqNf9z5aR076OGcpGHCuiTuy4E05oQ==", - "requires": { - "jquery": ">=1.7" - } - }, - "datatables.net-bs5": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/datatables.net-bs5/-/datatables.net-bs5-1.11.3.tgz", - "integrity": "sha512-u0tosKUR1XNpXzxOOt2NInnNYayt7GQoG+OM1xPRhdkZ7ZBD4oNF8S0aKve8yvSUq/ZwTMh4WJeh80GdmrJAdQ==", - "requires": { - "datatables.net": ">=1.10.25", - "jquery": ">=1.7" - } - }, "debug": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", @@ -13009,6 +12990,14 @@ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", "dev": true }, + "list.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/list.js/-/list.js-2.3.1.tgz", + "integrity": "sha512-jnmm7DYpKtH3DxtO1E2VNCC9Gp7Wrp/FWA2JxQrZUhVJ2RCQBd57pCN6W5w6jpsfWZV0PCAbTX2NOPgyFeeZZg==", + "requires": { + "string-natural-compare": "^2.0.2" + } + }, "lmdb-store": { "version": "1.6.13", "resolved": "https://registry.npmjs.org/lmdb-store/-/lmdb-store-1.6.13.tgz", @@ -14930,6 +14919,11 @@ "integrity": "sha1-6Kr8CsGFW0Zmkp7X3RJ1311sgRs=", "dev": true }, + "string-natural-compare": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/string-natural-compare/-/string-natural-compare-2.0.3.tgz", + "integrity": "sha512-4Kcl12rNjc+6EKhY8QyDVuQTAlMWwRiNbsxnVwBUKFr7dYPQuXVrtNU4sEkjF9LHY0AY6uVbB3ktbkIH4LC+BQ==" + }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", diff --git a/package.json b/package.json index 23c3d902e..27ee7100e 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,9 @@ "bootstrap": "^5.1.3", "bootstrap-icons": "^1.7.0", "d3": "^3.5.17", - "datatables.net": "^1.11.3", - "datatables.net-bs5": "^1.11.3", "jquery": "^3.6.0", "js-cookie": "^3.0.1", + "list.js": "^2.3.1", "moment": "^2.29.1", "moment-timezone": "^0.5.34" }, @@ -19,7 +18,7 @@ }, "source": [ "ietf/static/js/ietf.js", - "ietf/static/js/datatables.js", + "ietf/static/js/list.js", "ietf/static/js/document_timeline.js", "ietf/static/js/d3.js", "ietf/static/js/moment.js", @@ -33,7 +32,6 @@ "ietf/static/js/doc-search.js", "ietf/static/js/moment-timezone-with-data-10-year-range.js", "ietf/static/css/ietf.scss", - "ietf/static/css/datatables.scss", "ietf/static/images/ietflogo-small-transparent.png", "ietf/static/images/ietflogo.png", "ietf/static/images/apple-touch-icon.png",