From aa29480498a29e8226f491d0f4a74b17219f3f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Sat, 8 Jul 2017 23:00:54 +0200 Subject: [PATCH] Apply filtering to ICS button. --- src/program/static/js/event_instance_websocket.js | 8 ++++++++ src/program/templates/schedule_base.html | 2 +- src/program/templates/schedule_overview.html | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/program/static/js/event_instance_websocket.js b/src/program/static/js/event_instance_websocket.js index 5d19080c..5cfa2f94 100644 --- a/src/program/static/js/event_instance_websocket.js +++ b/src/program/static/js/event_instance_websocket.js @@ -108,6 +108,7 @@ function render() { parameters = get_parameters(); toggleFilterBoxes(parameters['types'], parameters['locations']); render_day_menu(parameters['day']); + setICSButtonHref(location.search); if(parameters['day'] != null) { render_day(parameters['types'], parameters['locations'], parameters['day']); @@ -473,6 +474,13 @@ function setHistoryState(parts) { } history.replaceState({}, '', query); + setICSButtonHref(query); +} + +function setICSButtonHref(query) { + // Update ICS button as well + var ics_button = document.querySelector('#ics-button'); + ics_button.setAttribute('href', CONFIG['ics_button_href'] + query); } function toggleFilterBoxes(types, locations) { diff --git a/src/program/templates/schedule_base.html b/src/program/templates/schedule_base.html index f46aa206..a7b3ebd7 100644 --- a/src/program/templates/schedule_base.html +++ b/src/program/templates/schedule_base.html @@ -73,7 +73,7 @@ - + ICS diff --git a/src/program/templates/schedule_overview.html b/src/program/templates/schedule_overview.html index 012f44f6..d5a587b7 100644 --- a/src/program/templates/schedule_overview.html +++ b/src/program/templates/schedule_overview.html @@ -14,6 +14,7 @@ init( { 'schedule_timeslot_length_minutes': Number('{{ schedule_timeslot_length_minutes }}') , 'schedule_midnight_offset_hours': Number('{{ schedule_midnight_offset_hours }}') + , 'ics_button_href': "{% url 'ics_view' camp_slug=camp.slug %}" } );