Apply filtering to ICS button.

This commit is contained in:
Víðir Valberg Guðmundsson 2017-07-08 23:00:54 +02:00
parent d38d6ce66a
commit aa29480498
3 changed files with 10 additions and 1 deletions

View file

@ -108,6 +108,7 @@ function render() {
parameters = get_parameters(); parameters = get_parameters();
toggleFilterBoxes(parameters['types'], parameters['locations']); toggleFilterBoxes(parameters['types'], parameters['locations']);
render_day_menu(parameters['day']); render_day_menu(parameters['day']);
setICSButtonHref(location.search);
if(parameters['day'] != null) { if(parameters['day'] != null) {
render_day(parameters['types'], parameters['locations'], parameters['day']); render_day(parameters['types'], parameters['locations'], parameters['day']);
@ -473,6 +474,13 @@ function setHistoryState(parts) {
} }
history.replaceState({}, '', query); 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) { function toggleFilterBoxes(types, locations) {

View file

@ -73,7 +73,7 @@
</ul> </ul>
</div> </div>
<a href="{% url 'ics_view' camp_slug=camp.slug %}{{ get_string }}" class="btn btn-default form-control filter-control"> <a id="ics-button" class="btn btn-default form-control filter-control">
<i class="fa fa-calendar"></i> ICS <i class="fa fa-calendar"></i> ICS
</a> </a>
</div> </div>

View file

@ -14,6 +14,7 @@
init( init(
{ 'schedule_timeslot_length_minutes': Number('{{ schedule_timeslot_length_minutes }}') { 'schedule_timeslot_length_minutes': Number('{{ schedule_timeslot_length_minutes }}')
, 'schedule_midnight_offset_hours': Number('{{ schedule_midnight_offset_hours }}') , 'schedule_midnight_offset_hours': Number('{{ schedule_midnight_offset_hours }}')
, 'ics_button_href': "{% url 'ics_view' camp_slug=camp.slug %}"
} }
); );
</script> </script>