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($('