Pairing tab in progress
This commit is contained in:
@@ -65,6 +65,7 @@
|
||||
#if($tour)
|
||||
const tour_id = ${tour.id};
|
||||
const tour_rounds = ${tour.rounds};
|
||||
let activeRound = 1;
|
||||
#end
|
||||
#set($datepickerLocale = $translate.datepickerLocale($request.lang, $request.loc))
|
||||
const datepickerLocale = '$datepickerLocale';
|
||||
@@ -100,6 +101,20 @@
|
||||
|
||||
onLoad(() => {
|
||||
|
||||
if (!window.location.hash && window.location.search) {
|
||||
window.location.hash = '#information'
|
||||
}
|
||||
if (window.location.hash) {
|
||||
let step = window.location.hash.substring(1);
|
||||
let suffix = /^(.)+-(\d+)$/.exec(step);
|
||||
if (suffix) {
|
||||
step = suffix[1];
|
||||
activeRound = parseInt(suffix[2]);
|
||||
$('.active-round').forEach(e => e.innerHTML = `${activeRound}`);
|
||||
}
|
||||
chooseStep(step);
|
||||
}
|
||||
|
||||
$('.step').on('click', e => {
|
||||
let tab = e.target.closest('.step');
|
||||
if (tab.classList.contains('active')) return;
|
||||
@@ -125,10 +140,28 @@
|
||||
}
|
||||
});
|
||||
|
||||
// prev/next round buttons
|
||||
if (activeRound === 1) {
|
||||
$('.prev-round').addClass('disabled');
|
||||
}
|
||||
if (activeRound === tour_rounds) {
|
||||
$('.next-round').addClass('disabled');
|
||||
}
|
||||
$('.prev-round').on('click', e => {
|
||||
let base = window.location.href.replace(/-\d+$/g, '');
|
||||
window.location.href = `#${base}-${activeRound - 1}`;
|
||||
window.location.reload();
|
||||
});
|
||||
$('.next-round').on('click', e => {
|
||||
let base = window.location.href.replace(/-\d+$/g, '');
|
||||
window.location.href = `#${base}-${activeRound + 1}`;
|
||||
window.location.reload();
|
||||
});
|
||||
});
|
||||
// ]]#
|
||||
#include('/js/tour-information.inc.js')
|
||||
#include('/js/tour-registration.inc.js')
|
||||
#include('/js/tour-pairing.inc.js')
|
||||
</script>
|
||||
<div id="invalid_character" class="hidden">Invalid character</div>
|
||||
<script type="text/javascript" src="/lib/datepicker-1.3.4/datepicker-full.min.js"></script>
|
||||
|
Reference in New Issue
Block a user