From 448c6dbe9e3f56212228a99f07800b483cdd6f7f Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Wed, 1 Dec 2021 13:52:50 +0000 Subject: [PATCH] And more bs5 stuff - Legacy-Id: 19717 --- ietf/static/css/select2.scss | 5 + ietf/static/images/nopictureavailable.jpg | Bin 1618 -> 0 bytes ietf/static/js/flot.js | 2 +- ietf/static/js/highcharts-export-data.js | 2 +- ietf/static/js/highcharts-exporting.js | 2 +- ietf/static/js/highcharts-highcharts.js | 2 +- ietf/static/js/highcharts-highstock.js | 2 +- .../static/js/highcharts-offline-exporting.js | 2 +- ietf/static/js/ietf.js | 5 + ietf/static/js/liaisons.js | 334 ++++++++++++++++++ ietf/static/js/list.js | 116 +++--- ietf/static/js/select2.js | 4 + ietf/templates/401.html | 35 +- ietf/templates/base.html | 12 +- .../doc/add_sessionpresentation.html | 2 +- ietf/templates/doc/ballot/approvaltext.html | 2 +- ietf/templates/doc/ballot/approve_ballot.html | 2 +- .../doc/ballot/approve_downrefs.html | 2 +- ietf/templates/doc/ballot/ballot_issued.html | 2 +- ietf/templates/doc/ballot/clear_ballot.html | 2 +- ietf/templates/doc/ballot/defer_ballot.html | 2 +- ietf/templates/doc/ballot/edit_position.html | 2 +- ietf/templates/doc/ballot/lastcalltext.html | 2 +- ietf/templates/doc/ballot/rfceditornote.html | 2 +- ietf/templates/doc/ballot/undefer_ballot.html | 2 +- ietf/templates/doc/ballot/writeupnotes.html | 2 +- ietf/templates/doc/bofreq/change_editors.html | 2 +- .../doc/bofreq/change_responsible.html | 2 +- ietf/templates/doc/change_ad.html | 2 +- ietf/templates/doc/change_shepherd.html | 2 +- ietf/templates/doc/change_shepherd_email.html | 2 +- ietf/templates/doc/change_state.html | 2 +- ietf/templates/doc/change_title.html | 2 +- .../doc/charter/action_announcement_text.html | 2 +- .../doc/charter/ballot_writeupnotes.html | 2 +- ietf/templates/doc/charter/change_ad.html | 2 +- .../doc/charter/review_announcement_text.html | 2 +- ietf/templates/doc/conflict_review/start.html | 2 +- .../templates/doc/conflict_review/submit.html | 2 +- ietf/templates/doc/document_charter.html | 2 +- .../doc/document_conflict_review.html | 2 +- ietf/templates/doc/document_material.html | 2 +- ietf/templates/doc/document_review.html | 2 +- ietf/templates/doc/document_writeup.html | 2 +- .../doc/draft/add_iana_experts_comment.html | 2 +- ietf/templates/doc/draft/change_ad.html | 2 +- .../templates/doc/draft/change_consensus.html | 2 +- .../doc/draft/change_iana_state.html | 2 +- .../doc/draft/change_intended_status.html | 2 +- ietf/templates/doc/draft/change_replaces.html | 2 +- .../doc/draft/change_shepherd_writeup.html | 2 +- ietf/templates/doc/draft/change_state.html | 2 +- ietf/templates/doc/draft/change_stream.html | 2 +- .../doc/draft/change_stream_state.html | 2 +- ietf/templates/doc/draft/edit_iesg_note.html | 2 +- ietf/templates/doc/draft/edit_info.html | 2 +- ietf/templates/doc/draft/make_last_call.html | 2 +- .../doc/draft/request_publication.html | 2 +- .../doc/draft/request_resurrect.html | 2 +- ietf/templates/doc/draft/resurrect.html | 2 +- ietf/templates/doc/edit_action_holders.html | 2 +- ietf/templates/doc/edit_authors.html | 6 +- ietf/templates/doc/edit_field.html | 2 +- ietf/templates/doc/edit_notify.html | 2 +- .../doc/edit_sessionpresentation.html | 2 +- ietf/templates/doc/edit_telechat_date.html | 2 +- .../doc/material/choose_material_type.html | 2 +- .../templates/doc/material/edit_material.html | 2 +- ietf/templates/doc/remind_action_holders.html | 2 +- .../templates/doc/review/assign_reviewer.html | 2 +- ietf/templates/doc/review/close_request.html | 2 +- .../doc/review/edit_request_comment.html | 2 +- .../doc/review/edit_request_deadline.html | 2 +- .../mark_reviewer_assignment_no_response.html | 2 +- .../review/reject_reviewer_assignment.html | 2 +- ietf/templates/doc/review/request_review.html | 2 +- ietf/templates/doc/review/review_request.html | 2 +- .../review/withdraw_reviewer_assignment.html | 2 +- ietf/templates/doc/shepherd_writeup.html | 2 +- ietf/templates/doc/status_change/approve.html | 2 +- .../doc/status_change/last_call.html | 2 +- .../doc/status_change/make_last_call.html | 2 +- ietf/templates/doc/status_change/submit.html | 2 +- ietf/templates/doc/submit_to_iesg.html | 2 +- ietf/templates/group/add_comment.html | 2 +- ietf/templates/iesg/photos.html | 10 +- ietf/templates/ipr/add_comment.html | 2 +- ietf/templates/ipr/add_email.html | 2 +- ietf/templates/ipr/details_history.html | 2 +- ietf/templates/ipr/details_view.html | 2 +- ietf/templates/ipr/email.html | 2 +- ietf/templates/ipr/notify.html | 2 +- ietf/templates/ipr/state.html | 2 +- ietf/templates/liaisons/add_comment.html | 33 +- ietf/templates/liaisons/detail.html | 156 ++++---- ietf/templates/liaisons/detail_history.html | 35 +- ietf/templates/liaisons/detail_tabs.html | 5 +- ietf/templates/liaisons/edit.html | 92 ++--- ietf/templates/liaisons/field_help.html | 301 +++++++++------- ietf/templates/liaisons/guide_from_ietf.html | 180 ++++++---- ietf/templates/liaisons/guide_to_ietf.html | 104 ++++-- ietf/templates/liaisons/help.html | 19 +- ietf/templates/liaisons/liaison_base.html | 36 +- ietf/templates/liaisons/liaison_table.html | 41 ++- ietf/templates/liaisons/liaison_title.html | 4 +- ietf/templates/liaisons/search_form.html | 89 ++--- ietf/templates/meeting/group_materials.html | 2 +- ietf/templates/meeting/interim_announce.html | 4 +- ietf/templates/meeting/interim_pending.html | 4 +- ietf/templates/meeting/interim_request.html | 4 +- .../meeting/interim_request_cancel.html | 4 +- .../meeting/interim_request_details.html | 4 +- .../meeting/interim_request_edit.html | 4 +- .../meeting/interim_send_announcement.html | 4 +- .../meeting/proceedings/material_details.html | 2 +- .../meeting/proceedings/materials_table.html | 2 +- ietf/templates/message/message.html | 2 +- ietf/templates/nomcom/edit_nominee.html | 2 +- ietf/templates/nomcom/public_nominate.html | 2 +- ietf/templates/release/release.html | 2 +- ietf/templates/submit/email.html | 2 +- ietf/templates/utf8_4byte_failed.html | 13 +- ietf/utils/fields.py | 10 +- package-lock.json | 30 +- package.json | 8 +- 125 files changed, 1209 insertions(+), 684 deletions(-) create mode 100644 ietf/static/css/select2.scss delete mode 100644 ietf/static/images/nopictureavailable.jpg create mode 100644 ietf/static/js/liaisons.js create mode 100644 ietf/static/js/select2.js diff --git a/ietf/static/css/select2.scss b/ietf/static/css/select2.scss new file mode 100644 index 000000000..14e3785ea --- /dev/null +++ b/ietf/static/css/select2.scss @@ -0,0 +1,5 @@ +@import "~/node_modules/bootstrap/scss/functions"; +@import "~/node_modules/bootstrap/scss/variables"; +@import "~/node_modules/bootstrap/scss/mixins"; +@import "node_modules/select2/src/scss/core"; +@import "node_modules/select2-bootstrap-5-theme/src/include-all"; \ No newline at end of file diff --git a/ietf/static/images/nopictureavailable.jpg b/ietf/static/images/nopictureavailable.jpg deleted file mode 100644 index 0895f9f57c74c6199a8eed323d71fe1caae52c9e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1618 zcmeH|+dmTu0LM3)k;R%}$~pEytF;rIK#{T{wAzdTR(6Uqv@3IG5=8S8}c`bFZuk(c|` z37l)*0KhioXnT84ti3(dGco>jbnGbrz`CG-5FDjP&_s16MH=lH!^a-VId>PWyjQu@ z=THr+BV%?J5l6=&rVM#R@#nD{Psgk+J2z`Q96Zx3mMb;;pR{K}jlZf+qgdwG6!uO{ zK#ftX?-Wnom0Er|(y~0dqj~Ps=QLrJ;8yDAN09;$?@_%Uy+jiTuDEBa4d*1~7SWEG z6jO7nwdHDjaS)T>I#(HlhvNAMf%EpgsUdG)&2BLo+Z`cV(6jpCtsn0y(u#mz?hrM7-%sLZuf(pZ);jyrh8$_!!!CwW8+(-yM}C7WZF= zRJ+CS>v@ZRhFAVETiu)>2-{+idZKcKq`o`jrs>S(#*nYoIlT6F;?h&jEzp3S)3_~5cZI+uzN!Z@b1aVzdKe9vS zp5*@a!vSk+$Zg$u9f1|ALx~a+{?;0Iartn?NNNg3y74&0NlZ>;9Qm}A#uHNMrrV`| zUoWF*^;2jWHIBAoE@!KG##v2PCq{P>n_+hKFO@*^_rauE-nfgBw$+5b3z)x=W$U0vN7n?|9 zZokX;;JezMI27=_v&FSIYv{$8`GBa&D6-*v3EJ zOvRCT9kda%?xW*gfMJR#qFffNYaiKobFgca{ER$G9wYYz%akBTs@}5~%o6mILI%Y# zLfwG*RB+19_Q)mr8K$#=QLNT(aAGfF0T%{e+ovQSVTYT{qBrs-V21gvV-S@H{f~Df zL2NT0V4kE|M&!0dAb2k&l15Z>P&`U-0duX!wbMXTYFc#XQ| z30u|N*4pH1l8i(Oc~uwJ;|JFv(c+75;IOA3qaS)%o;L^+d2Mh`y9wxNS$h# z?tzpzr76Cf__iW`vH`!4zB#cp)1SoTnr1$*LRLMQ7o2;II{u>p5Lu7`tY)MUJVUqQ z0RR~Q7Gvvu0r;uZLZR=V=D^fd{(2^A2py^jjCW{&8()!)FE06#D%d1{JvP|QwXj+; zY|r9f@Hd}iV#4az7686bOo)NGF$DB2}c8==|f?7-9&`9RxkOH`QrTlKbV z`4>C<)mn^VLF%_PTA;)elM04T`-rx~h4-~E#qPt|#gH%)8no*Fq5r@UKi@Jb9qAz3 erH0!=i&Q7I<(v2jXU|_>0l+%AWA537X8#0-_TYm6 diff --git a/ietf/static/js/flot.js b/ietf/static/js/flot.js index dc382dfb7..545503c25 100644 --- a/ietf/static/js/flot.js +++ b/ietf/static/js/flot.js @@ -1 +1 @@ -import "~/node_modules/flot"; \ No newline at end of file +import "flot"; \ No newline at end of file diff --git a/ietf/static/js/highcharts-export-data.js b/ietf/static/js/highcharts-export-data.js index 35a37c607..804a40c14 100644 --- a/ietf/static/js/highcharts-export-data.js +++ b/ietf/static/js/highcharts-export-data.js @@ -1 +1 @@ -import "~/node_modules/highcharts/modules/export-data"; \ No newline at end of file +import "highcharts/modules/export-data"; \ No newline at end of file diff --git a/ietf/static/js/highcharts-exporting.js b/ietf/static/js/highcharts-exporting.js index 1cc0d8600..85e069513 100644 --- a/ietf/static/js/highcharts-exporting.js +++ b/ietf/static/js/highcharts-exporting.js @@ -1 +1 @@ -import "~/node_modules/highcharts/modules/exporting"; \ No newline at end of file +import "highcharts/modules/exporting"; \ No newline at end of file diff --git a/ietf/static/js/highcharts-highcharts.js b/ietf/static/js/highcharts-highcharts.js index 160fc45b6..27255bd00 100644 --- a/ietf/static/js/highcharts-highcharts.js +++ b/ietf/static/js/highcharts-highcharts.js @@ -1,3 +1,3 @@ -import * as Highcharts from "~/node_modules/highcharts"; +import * as Highcharts from "highcharts"; window.Highcharts = Highcharts; \ No newline at end of file diff --git a/ietf/static/js/highcharts-highstock.js b/ietf/static/js/highcharts-highstock.js index ff140524f..140b587e0 100644 --- a/ietf/static/js/highcharts-highstock.js +++ b/ietf/static/js/highcharts-highstock.js @@ -1,3 +1,3 @@ -import * as Highcharts from "~/node_modules/highcharts/highstock"; +import * as Highcharts from "highcharts/highstock"; window.Highcharts = Highcharts; \ No newline at end of file diff --git a/ietf/static/js/highcharts-offline-exporting.js b/ietf/static/js/highcharts-offline-exporting.js index f0cd077b6..e38ee045d 100644 --- a/ietf/static/js/highcharts-offline-exporting.js +++ b/ietf/static/js/highcharts-offline-exporting.js @@ -1 +1 @@ -import "~/node_modules/highcharts/modules/offline-exporting"; \ No newline at end of file +import "highcharts/modules/offline-exporting"; \ No newline at end of file diff --git a/ietf/static/js/ietf.js b/ietf/static/js/ietf.js index 8a509fa46..a78cca2a2 100644 --- a/ietf/static/js/ietf.js +++ b/ietf/static/js/ietf.js @@ -123,6 +123,11 @@ $(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) diff --git a/ietf/static/js/liaisons.js b/ietf/static/js/liaisons.js new file mode 100644 index 000000000..a12a4532e --- /dev/null +++ b/ietf/static/js/liaisons.js @@ -0,0 +1,334 @@ +var attachmentWidget = { + button: null, + config: {}, + count: 0, + + readConfig: function () { + var buttonFormGroup = attachmentWidget.button.parents('.form-group'); + var disabledLabel = buttonFormGroup.find('.attachDisabledLabel'); + + if (disabledLabel.length) { + attachmentWidget.config.disabledLabel = disabledLabel.html(); + var required = []; + buttonFormGroup.find('.attachRequiredField') + .each(function (index, field) { + required.push('#' + $(field) + .text()); + }); + attachmentWidget.config.basefields = $(required.join(",")); + } + + attachmentWidget.config.showOn = $('#' + buttonFormGroup.find('.showAttachsOn') + .html()); + attachmentWidget.config.showOnDisplay = attachmentWidget.config.showOn.find('.attachedFiles'); + attachmentWidget.count = attachmentWidget.config.showOnDisplay.find('.initialAttach') + .length; + attachmentWidget.config.showOnEmpty = attachmentWidget.config.showOn.find('.showAttachmentsEmpty') + .html(); + attachmentWidget.config.enabledLabel = buttonFormGroup.find('.attachEnabledLabel') + .html(); + }, + + setState: function () { + var enabled = true; + attachmentWidget.config.fields.each(function () { + if (!$(this) + .val()) { + enabled = false; + return; + } + }); + if (enabled) { + attachmentWidget.button.removeAttr('disabled') + .removeClass('disabledAddAttachment'); + attachmentWidget.button.val(attachmentWidget.config.enabledLabel); + } else { + attachmentWidget.button.attr('disabled', 'disabled') + .addClass('disabledAddAttachment'); + attachmentWidget.button.val(attachmentWidget.config.disabledLabel); + } + }, + + cloneFields: function () { + var html = '
'; + if (attachmentWidget.count) { + html = attachmentWidget.config.showOnDisplay.html() + html; + } + attachmentWidget.config.fields.each(function () { + var field = $(this); + var container = $(this) + .parents('.form-group'); + if (container.find(':file') + .length) { + html += ' (' + field.val() + ')'; + } else { + html += ' ' + field.val(); + } + html += ''; + container.hide(); + }); + //html += ' '; + html += ' Delete'; + html += '
'; + attachmentWidget.config.showOnDisplay.html(html); + attachmentWidget.count += 1; + attachmentWidget.initFileInput(); + }, + + doAttach: function () { + attachmentWidget.cloneFields(); + attachmentWidget.setState(); + }, + + removeAttachment: function () { + var attach = $(this) + .parent('.attachedFileInfo'); + var fields = attach.find('.removeField'); + fields.each(function () { + $('#' + $(this) + .html()) + .remove(); + }); + attach.remove(); + if (!attachmentWidget.config.showOnDisplay.html()) { + attachmentWidget.config.showOnDisplay.html(attachmentWidget.config.showOnEmpty); + attachmentWidget.count = 0; + } + return false; + }, + + initTriggers: function () { + attachmentWidget.config.showOnDisplay.on('click', 'a.removeAttach', attachmentWidget.removeAttachment); + attachmentWidget.button.click(attachmentWidget.doAttach); + }, + + initFileInput: function () { + var fieldids = []; + attachmentWidget.config.basefields.each(function () { + var field = $(this); + var oldcontainer = $(this) + .parents('.form-group'); + var newcontainer = oldcontainer.clone(); + var newfield = newcontainer.find('#' + field.attr('id')); + newfield.attr('name', newfield.attr('name') + '_' + attachmentWidget.count); + newfield.attr('id', newfield.attr('id') + '_' + attachmentWidget.count); + newcontainer.attr('id', 'container_id_' + newfield.attr('name')); + oldcontainer.after(newcontainer); + oldcontainer.hide(); + newcontainer.show(); + fieldids.push('#' + newfield.attr('id')); + }); + attachmentWidget.config.fields = $(fieldids.join(",")); + attachmentWidget.config.fields.change(attachmentWidget.setState); + attachmentWidget.config.fields.keyup(attachmentWidget.setState); + }, + + initWidget: function () { + attachmentWidget.button = $(this); + attachmentWidget.readConfig(); + attachmentWidget.initFileInput(); + attachmentWidget.initTriggers(); + attachmentWidget.setState(); + }, +}; + +var liaisonForm = { + initVariables: function () { + liaisonForm.is_edit_form = liaisonForm.form.attr("data-edit-form") == "True"; + liaisonForm.from_groups = liaisonForm.form.find('#id_from_groups'); + liaisonForm.from_contact = liaisonForm.form.find('#id_from_contact'); + liaisonForm.response_contacts = liaisonForm.form.find('#id_response_contacts'); + liaisonForm.to_groups = liaisonForm.form.find('#id_to_groups'); + liaisonForm.to_contacts = liaisonForm.form.find('#id_to_contacts'); + liaisonForm.cc = liaisonForm.form.find('#id_cc_contacts'); + liaisonForm.purpose = liaisonForm.form.find('#id_purpose'); + liaisonForm.deadline = liaisonForm.form.find('#id_deadline'); + liaisonForm.submission_date = liaisonForm.form.find('#id_submitted_date'); + liaisonForm.approval = liaisonForm.form.find('#id_approved'); + liaisonForm.initial_approval_label = liaisonForm.form.find("label[for='id_approved']") + .text(); + liaisonForm.cancel = liaisonForm.form.find('#id_cancel'); + liaisonForm.cancel_dialog = liaisonForm.form.find('#cancel-dialog'); + liaisonForm.config = {}; + liaisonForm.related_trigger = liaisonForm.form.find('.id_related_to'); + liaisonForm.related_url = liaisonForm.form.find('#id_related_to') + .parent() + .find('.listURL') + .text(); + liaisonForm.related_dialog = liaisonForm.form.find('#related-dialog'); + liaisonForm.unrelate_trigger = liaisonForm.form.find('.id_no_related_to'); + }, + + render_mails_into: function (container, person_list, as_html) { + var html = ''; + + $.each(person_list, function (index, person) { + if (as_html) { + html += person[0] + ' <' + person[1] + '>
'; + } else { + //html += person[0] + ' <'+person[1]+'>\n'; + html += person + '\n'; + } + }); + container.html(html); + }, + + toggleApproval: function (needed) { + if (!liaisonForm.approval.length) { + return; + } + if (!needed) { + liaisonForm.approval.prop('checked', true); + liaisonForm.approval.hide(); + //$("label[for='id_approved']").text("Approval not required"); + var nodes = $("label[for='id_approved']:not(.control-label)")[0].childNodes; + nodes[nodes.length - 1].nodeValue = 'Approval not required'; + return; + } + if (needed && !$('#id_approved') + .is(':visible')) { + liaisonForm.approval.prop('checked', false); + liaisonForm.approval.show(); + //$("label[for='id_approved']").text(initial_approval_label); + nodes = $("label[for='id_approved']:not(.control-label)")[0].childNodes; + nodes[nodes.length - 1].nodeValue = liaisonForm.initial_approval_label; + return; + } + }, + + checkPostOnly: function (post_only) { + if (post_only) { + $("button[name=send]") + .hide(); + } else { + $("button[name=send]") + .show(); + } + }, + + updateInfo: function (first_time, sender) { + // don't overwrite fields when editing existing liaison + if (liaisonForm.is_edit_form) { + return false; + } + + var from_ids = liaisonForm.from_groups.val(); + var to_ids = liaisonForm.to_groups.val(); + var url = liaisonForm.form.data("ajaxInfoUrl"); + $.ajax({ + url: url, + type: 'GET', + cache: false, + async: true, + dataType: 'json', + data: { + from_groups: from_ids, + to_groups: to_ids + }, + success: function (response) { + if (!response.error) { + if (!first_time || !liaisonForm.cc.text()) { + liaisonForm.render_mails_into(liaisonForm.cc, response.cc, false); + } + //render_mails_into(poc, response.poc, false); + if (sender.attr('id') == 'id_to_groups') { + liaisonForm.to_contacts.val(response.to_contacts); + } + if (sender.attr('id') == 'id_from_groups') { + liaisonForm.toggleApproval(response.needs_approval); + liaisonForm.response_contacts.val(response.response_contacts); + } + liaisonForm.checkPostOnly(response.post_only); + } + } + }); + return false; + }, + + updatePurpose: function () { + var deadlinecontainer = liaisonForm.deadline.closest('.form-group'); + var value = liaisonForm.purpose.val(); + + if (value == 'action' || value == 'comment') { + liaisonForm.deadline.prop('required', true); + deadlinecontainer.show(); + } else { + liaisonForm.deadline.prop('required', false); + deadlinecontainer.hide(); + liaisonForm.deadline.val(''); + } + }, + + cancelForm: function () { + liaisonForm.cancel_dialog.dialog("open"); + }, + + checkSubmissionDate: function () { + var date_str = liaisonForm.submission_date.val(); + if (date_str) { + var sdate = new Date(date_str); + var today = new Date(); + if (Math.abs(today - sdate) > 2592000000) { // 2592000000 = 30 days in milliseconds + return confirm('Submission date ' + date_str + ' differ more than 30 days.\n\nDo you want to continue and post this liaison using that submission date?\n'); + } + return true; + } else + return false; + }, + + init: function () { + liaisonForm.form = $(this); + liaisonForm.initVariables(); + $('#id_from_groups') + .select2(); + $('#id_to_groups') + .select2(); + liaisonForm.to_groups.change(function () { liaisonForm.updateInfo(false, $(this)); }); + liaisonForm.from_groups.change(function () { liaisonForm.updateInfo(false, $(this)); }); + liaisonForm.purpose.change(liaisonForm.updatePurpose); + liaisonForm.form.submit(liaisonForm.checkSubmissionDate); + $('.addAttachmentWidget') + .each(attachmentWidget.initWidget); + + liaisonForm.updatePurpose(); + if ($('#id_to_groups') + .val()) { + $('#id_to_groups') + .trigger('change'); + } + if ($('#id_from_groups') + .val()) { + $('#id_from_groups') + .trigger('change'); + } + }, +}; + +var searchForm = { + // search form, based on doc search feature + init: function () { + searchForm.form = $(this); + $("#search-clear-btn") + .on("click", searchForm.clearForm); + }, + + clearForm: function () { + var form = $(this) + .parents("form"); + form.find("input") + .val(""); + } +}; + +$(document) + .ready(function () { + // use traditional style URL parameters + $.ajaxSetup({ traditional: true }); + + $('form.liaisons-form') + .each(liaisonForm.init); + $('#liaison_search_form') + .each(searchForm.init); + }); \ No newline at end of file diff --git a/ietf/static/js/list.js b/ietf/static/js/list.js index 0e45753f1..9b79a6276 100644 --- a/ietf/static/js/list.js +++ b/ietf/static/js/list.js @@ -13,8 +13,26 @@ function text_sort(a, b, options) { .replaceAll(/\s+/g, ' ')); } +function replace_with_internal(table, internal_table, i) { + $(table) + .children("tbody") + .eq(i) + .replaceWith(internal_table[i] + .children("table") + .children("tbody") + .clone());} + +function field_magic(i, e, fields) { + if (fields[i] == "date" || fields[i] == "num") { + $(e) + .addClass("text-end"); + } +} + $(document) .ready(function () { + var n = 1; + var items_per_page = 10; $("table.tablesorter") .each(function () { var table = $(this); @@ -37,16 +55,13 @@ $(document) } else { + $(table) + .wrap(`
{ - if (fields[i] == "date" || fields[i] == "num") { - // magic - $(e) - .addClass("text-end"); - } - }); + .each((i, e) => field_magic(i, e, fields)); if ($(header_row) .text() @@ -73,23 +88,25 @@ $(document) var reset_search = $(searcher) .children("button.search-reset"); - // var pager = $.parseHTML(` - // `); + var pager = $.parseHTML(` + `); - // $(table) - // .after(pager); + $(table) + .before(pager); var list_instance = []; var internal_table = []; - // var pagination = $(table) - // .children("tbody") - // .length == 1; + var pagination = $(table) + .children("tbody") + .length == 1; + + pagination = false; // FIXME: pagination not working yet. // list.js cannot deal with tables with multiple tbodys, - // so maintain separate internal "tables" for + // so maintain separate internal "table" copies for // sorting/searching and update the DOM based on them $(table) .children("tbody, tfoot") @@ -104,11 +121,7 @@ $(document) .each((i, e) => { $(e) .addClass(fields[i]); - if (fields[i] == "date" || fields[i] == "num") { - // magic - $(e) - .addClass("text-end"); - } + field_magic(i, e, fields); }); }); @@ -120,36 +133,49 @@ $(document) var tbody = $(this) .clone(); - if ($(tbody) + var tbody_rows = $(tbody) .find("tr") - .length == 0) { + .length; + + if (tbody_rows == 0) { console.log("Skipping empty tbody"); return; + } else if (tbody_rows <= items_per_page) { + pagination = false; } var parent = $(table) - .clone() + .parent() + .clone(); + + $(parent) + .children("table") .empty() .removeClass("tablesorter") - .wrap("
' - // }; - // } + var hook = `tablewrapper-${n}`; + if (pagination) { + console.log("Enabling pager."); + $(pager) + .removeClass("visually-hidden"); + pagination = { + innerWindow: 5, + left: 1, + right: 1, + item: '
  • ' + }; + } else { + hook = parent[0]; + } list_instance.push( - new List(parent[0], { + new List(hook, { valueNames: fields, - // pagination: pagination, - // page: 10 + pagination: pagination, + page: items_per_page })); }); @@ -184,13 +210,7 @@ $(document) $.each(list_instance, (i, e) => { e.on("sortComplete", function () { - $(table) - .children("tbody") - .eq(i) - .replaceWith(internal_table[i] - .children("tbody") - .clone()); - + replace_with_internal(table, internal_table, i); if (i == list_instance.length - 1) { $(table) .find("thead:first tr") @@ -236,14 +256,10 @@ $(document) }); e.update(); - $(table) - .children("tbody") - .eq(i) - .replaceWith(internal_table[i] - .children("tbody") - .clone()); + replace_with_internal(table, internal_table, i); }); }); } }); + n++; }); \ No newline at end of file diff --git a/ietf/static/js/select2.js b/ietf/static/js/select2.js new file mode 100644 index 000000000..453218676 --- /dev/null +++ b/ietf/static/js/select2.js @@ -0,0 +1,4 @@ +import $ from "jquery"; +import select2 from "select2"; + +select2($); \ No newline at end of file diff --git a/ietf/templates/401.html b/ietf/templates/401.html index d7e9e945a..d00974e99 100644 --- a/ietf/templates/401.html +++ b/ietf/templates/401.html @@ -1,20 +1,29 @@ +{# bs5ok #} {# Copyright The IETF Trust 2012, All Rights Reserved #} {% extends "base.html" %} {% load static %} {% block title %}401 Unauthorized{% endblock %} {% block content %} - - - -

    Authentication Required

    - -

    The server could not verify that you are authorized to view this page using - the username and password you provided. You can now:

    - + +

    Authentication Required

    +

    + The server could not verify that you are authorized to view this page using + the username and password you provided. You can now: +

    - -

    If you think this is a server error, please contact webtools@ietf.org.

    -{% endblock %} +

    + If you think this is a server error, please contact + webtools@ietf.org + . +

    +{% endblock %} \ No newline at end of file diff --git a/ietf/templates/base.html b/ietf/templates/base.html index ca3b72269..c5a5cf91f 100644 --- a/ietf/templates/base.html +++ b/ietf/templates/base.html @@ -35,8 +35,7 @@ href="{% static 'ietf/images/apple-touch-icon.png' %}"/> -