Integrate week-view timezone handling with changes to main agenda page. Commit ready for merge.
- Legacy-Id: 18803
This commit is contained in:
parent
ce0f749293
commit
86dd2b2e67
|
@ -917,7 +917,7 @@ class WeekviewTests(MeetingTestCase):
|
|||
return expected_items
|
||||
|
||||
def test_timezone_default(self):
|
||||
"""Week view should show local times by default"""
|
||||
"""Week view should show UTC times by default"""
|
||||
self.assertNotEqual(self.meeting.time_zone.lower(), 'utc',
|
||||
'Cannot test local time weekview because meeting is using UTC time.')
|
||||
self.login()
|
||||
|
@ -929,8 +929,8 @@ class WeekviewTests(MeetingTestCase):
|
|||
expected_name = item.timeslot.name
|
||||
else:
|
||||
expected_name = item.session.group.name
|
||||
expected_time = '-'.join([item.timeslot.local_start_time().strftime('%H%M'),
|
||||
item.timeslot.local_end_time().strftime('%H%M')])
|
||||
expected_time = '-'.join([item.timeslot.utc_start_time().strftime('%H%M'),
|
||||
item.timeslot.utc_end_time().strftime('%H%M')])
|
||||
WebDriverWait(self.driver, 2).until(
|
||||
expected_conditions.presence_of_element_located(
|
||||
(By.XPATH,
|
||||
|
@ -974,7 +974,7 @@ class WeekviewTests(MeetingTestCase):
|
|||
def test_event_wrapping(self):
|
||||
"""Events that overlap midnight should be shown on both days
|
||||
|
||||
This assumes that the meeting is in America/New_York timezone.
|
||||
This assumes that the meeting is in US/Eastern timezone.
|
||||
"""
|
||||
def _assert_wrapped(displayed, expected_time_string):
|
||||
self.assertEqual(len(displayed), 2)
|
||||
|
@ -995,6 +995,9 @@ class WeekviewTests(MeetingTestCase):
|
|||
self.assertIn(expected_time_string, first_parent.text)
|
||||
|
||||
duration = datetime.timedelta(minutes=120) # minutes
|
||||
local_tz = self.meeting.time_zone
|
||||
self.assertEqual(local_tz.lower(), 'us/eastern',
|
||||
'Test logic error - meeting local time zone must be US/Eastern')
|
||||
|
||||
# Session during a single day in meeting local time but multi-day UTC
|
||||
# Compute a time that overlaps midnight, UTC, but won't when shifted to a local time zone
|
||||
|
@ -1046,7 +1049,7 @@ class WeekviewTests(MeetingTestCase):
|
|||
self.login()
|
||||
|
||||
# Test in meeting local time
|
||||
self.driver.get(self.absreverse('ietf.meeting.views.week_view'))
|
||||
self.driver.get(self.absreverse('ietf.meeting.views.week_view') + '?tz=%s' % local_tz.lower())
|
||||
|
||||
time_string = '-'.join([daytime_timeslot.local_start_time().strftime('%H%M'),
|
||||
daytime_timeslot.local_end_time().strftime('%H%M')])
|
||||
|
|
|
@ -1765,7 +1765,6 @@ def week_view(request, num=None, name=None, owner=None):
|
|||
|
||||
return render(request, "meeting/week-view.html", {
|
||||
"items": json.dumps(items),
|
||||
"timezone": meeting.time_zone,
|
||||
})
|
||||
|
||||
@role_required('Area Director','Secretariat','IAB')
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Callback for timezone change - called after current_timezone is updated
|
||||
var timezone_change_callback;
|
||||
|
||||
// Initialize moments
|
||||
function initialize_moments() {
|
||||
var times=$('span.time')
|
||||
|
@ -195,7 +198,9 @@ function update_times(newtz) {
|
|||
});
|
||||
update_tooltips_all();
|
||||
update_clock();
|
||||
// update_calendar(agenda_filter.get_filter())
|
||||
if (timezone_change_callback) {
|
||||
timezone_change_callback(newtz);
|
||||
}
|
||||
}
|
||||
|
||||
// Highlight ongoing based on the current time
|
||||
|
@ -253,3 +258,7 @@ function init_timers() {
|
|||
setInterval(function() { update_tooltips_all(); }, 3600000 / speedup);
|
||||
}
|
||||
|
||||
// Register a callback for timezone change
|
||||
function set_tz_change_callback(cb) {
|
||||
timezone_change_callback = cb;
|
||||
}
|
|
@ -342,7 +342,9 @@
|
|||
|
||||
<script src="{% static 'ietf/js/agenda/agenda_filter.js' %}"></script>
|
||||
<script>
|
||||
// Update the agenda display with specified filters
|
||||
var current_timezone = 'UTC';
|
||||
|
||||
// Update the agenda display with specified filters
|
||||
function update_agenda_display(filter_params) {
|
||||
var agenda_rows=$('[id^="row-"]')
|
||||
|
||||
|
@ -380,46 +382,44 @@
|
|||
}
|
||||
}
|
||||
|
||||
function update_weekview(filter_params) {
|
||||
var weekview = $("#weekview");
|
||||
|
||||
if (!agenda_filter.filtering_is_enabled(filter_params)) {
|
||||
weekview.addClass("hidden");
|
||||
return;
|
||||
}
|
||||
|
||||
// Filtering is enabled
|
||||
weekview.removeClass("hidden");
|
||||
|
||||
var wv_iframe = document.getElementById('weekview');
|
||||
var wv_window = wv_iframe.contentWindow;
|
||||
var queryparams = window.location.search;
|
||||
{% if "-utc" in request.path %}
|
||||
if (queryparams) {
|
||||
queryparams += '&tz=utc';
|
||||
} else {
|
||||
queryparams = '?tz=utc';
|
||||
}
|
||||
{% endif %}
|
||||
var new_url = 'week-view.html' + queryparams;
|
||||
if (wv_iframe.src && wv_window.history && wv_window.history.replaceState) {
|
||||
wv_window.history.replaceState({}, '', new_url);
|
||||
wv_window.redraw_weekview();
|
||||
} else {
|
||||
// either have not yet loaded the iframe or we do not support history replacement
|
||||
wv_iframe.src = new_url;
|
||||
}
|
||||
}
|
||||
|
||||
function update_weekview(filter_params) {
|
||||
var weekview = $("#weekview");
|
||||
if (agenda_filter.filtering_is_enabled(filter_params)) {
|
||||
weekview.removeClass("hidden");
|
||||
} else {
|
||||
weekview.addClass("hidden");
|
||||
}
|
||||
update_weekview_display();
|
||||
}
|
||||
|
||||
function update_weekview_display() {
|
||||
var weekview = $("#weekview");
|
||||
if (!weekview.hasClass('hidden')) {
|
||||
var queryparams = window.location.search;
|
||||
if (queryparams) {
|
||||
queryparams += '&tz=' + current_timezone.toLowerCase();
|
||||
} else {
|
||||
queryparams = '?tz=' + current_timezone.toLowerCase();
|
||||
}
|
||||
var new_url = 'week-view.html' + queryparams;
|
||||
var wv_iframe = document.getElementById('weekview');
|
||||
var wv_window = wv_iframe.contentWindow;
|
||||
if (wv_iframe.src && wv_window.history && wv_window.history.replaceState) {
|
||||
wv_window.history.replaceState({}, '', new_url);
|
||||
wv_window.redraw_weekview();
|
||||
} else {
|
||||
// either have not yet loaded the iframe or we do not support history replacement
|
||||
wv_iframe.src = new_url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function update_view(filter_params) {
|
||||
update_agenda_display(filter_params);
|
||||
update_weekview(filter_params)
|
||||
update_ical_links(filter_params)
|
||||
}
|
||||
|
||||
agenda_filter.set_update_callback(update_view);
|
||||
agenda_filter.enable();
|
||||
|
||||
/**
|
||||
* Retrieve and display materials for a session
|
||||
*
|
||||
|
@ -519,7 +519,6 @@
|
|||
// Get meeting and local times, initialize timezone system
|
||||
meeting_timezone = "{{timezone}}";
|
||||
local_timezone = moment.tz.guess();
|
||||
current_timezone = 'UTC';
|
||||
{% if "-utc" in request.path %}
|
||||
timezone_init('UTC');
|
||||
{% else %}
|
||||
|
@ -528,5 +527,9 @@
|
|||
|
||||
init_timers();
|
||||
|
||||
set_tz_change_callback(update_weekview_display);
|
||||
agenda_filter.set_update_callback(update_view);
|
||||
agenda_filter.enable();
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -601,8 +601,8 @@
|
|||
// Set up events for drawing the calendar
|
||||
function redraw_weekview() {
|
||||
var query_params = agenda_filter.parse_query_params(window.location.search);
|
||||
var timezone_name = query_params.tz || '{{ timezone }}';
|
||||
|
||||
var timezone_name = query_params.tz || 'utc';
|
||||
|
||||
items = prepare_items(all_items, timezone_name);
|
||||
draw_calendar(items, agenda_filter.get_filter_params(query_params));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue