From e1b9392dadcb762c0d9fe6b4e7c851e2349cc627 Mon Sep 17 00:00:00 2001
From: Jennifer Richards
Date: Fri, 25 Mar 2022 16:50:36 -0300
Subject: [PATCH 01/11] feat: render second tz select widget on agenda RH panel
* add "minimal" option to render tz select buttons only
* move tz-display "onchange" events into timezone.js
* update timezone.js to handle radio inputs in addition to select
* render second timezone select widget on the agenda's floating RH panel
---
ietf/static/js/timezone.js | 23 +++++++----
ietf/templates/meeting/agenda.html | 15 +++++--
ietf/templates/meeting/tz-display.html | 55 +++++++++++++++-----------
3 files changed, 58 insertions(+), 35 deletions(-)
diff --git a/ietf/static/js/timezone.js b/ietf/static/js/timezone.js
index 21f6cad774..97b3228ae8 100644
--- a/ietf/static/js/timezone.js
+++ b/ietf/static/js/timezone.js
@@ -1,5 +1,5 @@
- // Copyright The IETF Trust 2021, All Rights Reserved
-
+// Copyright The IETF Trust 2021, All Rights Reserved
+/* global moment */
/*
Timezone selection handling. Relies on the moment.js library.
@@ -13,8 +13,9 @@ window.ietf_timezone; // public interface
(function () {
'use strict';
// Callback for timezone change - called after current_timezone is updated
- var timezone_change_callback;
- var current_timezone;
+ let timezone_change_callback;
+ let current_timezone;
+ let tz_radios;
// Select timezone to use. Arg is name of a timezone or 'local' to guess local tz.
function use_timezone(newtz) {
@@ -31,9 +32,16 @@ window.ietf_timezone; // public interface
if (timezone_change_callback) {
timezone_change_callback(newtz);
}
+ tz_radios.filter(`[value="${newtz}"]`).prop('checked', true);
+ tz_radios.filter(`[value!="${newtz}"]`).prop('checked', false);
}
}
+ function handle_change_event(evt) {
+ const newtz = evt.target.value;
+ use_timezone(newtz); // use the requested timezone
+ }
+
/* Initialize timezone system
*
* This will set the timezone to the value of 'current'. Set up the tz_change callback
@@ -42,7 +50,6 @@ window.ietf_timezone; // public interface
function timezone_init(current) {
var tz_names = moment.tz.names();
var select = $('select.tz-select');
-
select.empty();
$.each(tz_names, function (i, item) {
select.append($('', {
@@ -51,9 +58,9 @@ window.ietf_timezone; // public interface
value: item
}));
});
- select.on("change", function () {
- use_timezone(this.value);
- });
+ tz_radios = $('input.tz-select[type="radio"]');
+ tz_radios.on('change', handle_change_event);
+ select.on('change', handle_change_event);
/* When navigating back/forward, the browser may change the select input's
* value after the window load event. It does not fire the change event on
* the input when it does this. The pageshow event occurs after such an update,
diff --git a/ietf/templates/meeting/agenda.html b/ietf/templates/meeting/agenda.html
index 9ba9f0e3cb..42c4bd9dfb 100644
--- a/ietf/templates/meeting/agenda.html
+++ b/ietf/templates/meeting/agenda.html
@@ -25,7 +25,15 @@
{% endif %}
{# the contents of #extra-nav will be moved into the RH nav panel #}
{% endif %}
- {% include 'meeting/tz-display.html' with id_suffix="" timezone=timezone %}
+ {% include 'meeting/tz-display.html' with meeting_timezone=timezone only %}
{% include "meeting/agenda_filter.html" with filter_categories=filter_categories customize_button_text="Personalize the agenda view..." always_show=personalize %}
{% include "meeting/agenda_personalize_buttonlist.html" with meeting=schedule.meeting only %}