Pairing tab in progress
This commit is contained in:
@@ -47,14 +47,9 @@ Element.prototype.toggleClass = function(className) {
|
||||
return this;
|
||||
}
|
||||
NodeList.prototype.hasClass = function(className) {
|
||||
console.log('nodelist.hasClass')
|
||||
console.log(this.item(0));
|
||||
return this.item(0).classList.contains(className);
|
||||
}
|
||||
Element.prototype.hasClass = function(className) {
|
||||
console.log('element.hasClass')
|
||||
console.log(this.classList)
|
||||
console.log(this.classList.contains(className))
|
||||
return this.classList.contains(className);
|
||||
}
|
||||
Node.prototype.offset = function() {
|
||||
|
@@ -148,13 +148,4 @@ onLoad(() => {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (!window.location.hash && window.location.search) {
|
||||
window.location.hash = '#information'
|
||||
}
|
||||
if (window.location.hash) {
|
||||
let step = window.location.hash.substring(1);
|
||||
chooseStep(step);
|
||||
}
|
||||
|
||||
});
|
||||
|
2
view-webapp/src/main/webapp/js/tour-pairing.inc.js
Normal file
2
view-webapp/src/main/webapp/js/tour-pairing.inc.js
Normal file
@@ -0,0 +1,2 @@
|
||||
onLoad(()=>{
|
||||
});
|
@@ -1,3 +1,29 @@
|
||||
#set($paired = $api.get("tour/${params.id}/part"))
|
||||
<div class="tab-content" id="pairing">
|
||||
Pairing...
|
||||
<div id="pairing-content">
|
||||
<div id="pairing-round">
|
||||
Pairings for round
|
||||
<button class="ui floating choose-round prev-round button">«</button>
|
||||
<span class="active-round">1</span>
|
||||
<button class="ui floating choose-round next-round button">»</button>
|
||||
</div>
|
||||
<div id="pairing-lists">
|
||||
<div id="pairables" class="multi-select" title="pairable players">
|
||||
</div>
|
||||
<div id="pairing-buttons">
|
||||
<button id="pair" class="ui blue right labeled icon floating button">
|
||||
<i class="angle double right icon"></i>
|
||||
Pair
|
||||
</button>
|
||||
<button id="unpair" class="ui orange right labeled icon floating button">
|
||||
<i class="angle double left icon"></i>
|
||||
Unpair
|
||||
</button>
|
||||
</div>
|
||||
<div id="paired" class="multi-select" title="games">
|
||||
</div>
|
||||
</div>
|
||||
<div id="unpairables" class="multi-select" title="unpairable players">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -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