Test schedule nav
This commit is contained in:
parent
b89b5b5aa2
commit
ea613bccb8
1 changed files with 10 additions and 5 deletions
|
@ -91,22 +91,27 @@
|
||||||
'friday': '25'
|
'friday': '25'
|
||||||
};
|
};
|
||||||
var trailing = ' January 2019';
|
var trailing = ' January 2019';
|
||||||
|
|
||||||
|
|
||||||
$('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
|
$('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
|
||||||
var day = e.target.attributes['aria-controls'].value.split('-');
|
var controls = e.target.attributes['aria-controls'].value
|
||||||
|
var day = controls.split('-');
|
||||||
day = day[day.length - 1];
|
day = day[day.length - 1];
|
||||||
$('#schedule-date').text(day + ' ' + dates[day] + trailing);
|
$('#schedule-date').text(day + ' ' + dates[day] + trailing);
|
||||||
|
var loc = window.location.toString().split('?')[0] += '?schedule=' + controls;
|
||||||
|
window.history.pushState({path: loc}, '', loc);
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const scheduleName = urlParams.get('schedule');
|
const scheduleName = urlParams.get('schedule');
|
||||||
if (schedule == null) {
|
if(scheduleName !== null) {
|
||||||
var currentName = $('div#schedule-nav').children('a.active').first().attr('aria-controls');
|
|
||||||
window.location += '?schedule=' + currentName;
|
|
||||||
} else {
|
|
||||||
$('a[href="#' + scheduleName + '"]').tab('show');
|
$('a[href="#' + scheduleName + '"]').tab('show');
|
||||||
|
} else {
|
||||||
|
var currLoc = $('a[data-toggle="tab"].active').first().attr('aria-controls');
|
||||||
|
var loc = window.location.toString().split('?')[0] += '?schedule=' + currLoc;
|
||||||
|
window.history.replaceState({path: loc}, '', loc);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
Loading…
Reference in a new issue