From fdcdd9c1a95da7927d3bbea44f561d9eb863a645 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Tue, 19 Dec 2023 04:02:18 +0100 Subject: [PATCH] Pairing tab in progress --- .../org/jeudego/pairgoth/util/Translator.kt | 2 +- view-webapp/src/main/sass/tour.scss | 60 +++++++++++++++++++ view-webapp/src/main/webapp/js/domhelper.js | 5 -- .../main/webapp/js/tour-information.inc.js | 9 --- .../src/main/webapp/js/tour-pairing.inc.js | 2 + .../src/main/webapp/tour-pairing.inc.html | 28 ++++++++- view-webapp/src/main/webapp/tour.html | 33 ++++++++++ 7 files changed, 123 insertions(+), 16 deletions(-) create mode 100644 view-webapp/src/main/webapp/js/tour-pairing.inc.js diff --git a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/util/Translator.kt b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/util/Translator.kt index b666541..96df92e 100644 --- a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/util/Translator.kt +++ b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/util/Translator.kt @@ -149,7 +149,7 @@ class Translator private constructor(private val iso: String) { private val logger = LoggerFactory.getLogger("translation") private val translatedTemplates: MutableMap, Template> = ConcurrentHashMap, Template>() private val textExtractor = Pattern.compile( - "<[^>]+\\splaceholder=\"(?[^\"]*)\"[^>]*>|(?<=>)(?:[ \\r\\n\\t\u00A0/–-]| |‐)*(?[^<>]+?)(?:[ \\r\\n\\t\u00A0/–-]| |‐)*(?=<|$)|(?<=>|^)(?:[ \\r\\n\\t\u00A0/–-]| |‐)*(?[^<>]+?)(?:[ \\r\\n\\t\u00A0/–-]| |‐)*(?=<)|^(?:[ \\r\\n\\t /–-]| |‐)*(?[^<>]+?)(?:[ \\r\\n\\t /–-]| |‐)*(?=$)", + "<[^>]+\\s(?:placeholder|title)=\"(?[^\"]*)\"[^>]*>|(?<=>)(?:[ \\r\\n\\t\u00A0/–-]| |‐)*(?[^<>]+?)(?:[ \\r\\n\\t\u00A0/–-]| |‐)*(?=<|$)|(?<=>|^)(?:[ \\r\\n\\t\u00A0/–-]| |‐)*(?[^<>]+?)(?:[ \\r\\n\\t\u00A0/–-]| |‐)*(?=<)|^(?:[ \\r\\n\\t /–-]| |‐)*(?[^<>]+?)(?:[ \\r\\n\\t /–-]| |‐)*(?=$)", Pattern.DOTALL ) private val ignoredTags = setOf("head", "script", "style") diff --git a/view-webapp/src/main/sass/tour.scss b/view-webapp/src/main/sass/tour.scss index 0a74e9b..684af4a 100644 --- a/view-webapp/src/main/sass/tour.scss +++ b/view-webapp/src/main/sass/tour.scss @@ -133,4 +133,64 @@ #player.popup { min-width: 65vw; } + + /* pairing section */ + + #pairing-content { + display: flex; + flex-flow: column; + justify-content: start; + align-items: center; + gap: 1em; + } + + #pairing-lists { + margin-top: 1em; + display: flex; + flex-flow: row wrap; + justify-content: center; + gap: 1em; + align-items: start; + } + .multi-select { + position: relative; + display: flex; + flex-flow: column nowrap; + overflow-x: hidden; + overflow-y: auto; + min-height: 30vh; + max-height: 60vh; + min-width: 20vw; + max-width: 40vw; + border: solid 2px darkgray; + border-radius: 5px; + padding-top: 1em; + &:before { + position: absolute; + content: attr(title); + top: -0.5em; + left: 50%; + transform: translate(-50%, 0px); + white-space: nowrap; + font-size: smaller; + font-weight: bold; + } + } + #pairing-buttons { + display: flex; + flex-flow: column nowrap; + justify-content: start; + align-items: stretch; + gap: 1em; + } + #unpairables { + display: flex; + flex-flow: column nowrap; + min-height: 10vh; + max-height: 30vh; + min-width: 50vw; + } + .choose-round.button { + padding: 0.2em 0.8em; + } } diff --git a/view-webapp/src/main/webapp/js/domhelper.js b/view-webapp/src/main/webapp/js/domhelper.js index b826a23..7f63ac8 100644 --- a/view-webapp/src/main/webapp/js/domhelper.js +++ b/view-webapp/src/main/webapp/js/domhelper.js @@ -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() { diff --git a/view-webapp/src/main/webapp/js/tour-information.inc.js b/view-webapp/src/main/webapp/js/tour-information.inc.js index e6d7e45..d74874b 100644 --- a/view-webapp/src/main/webapp/js/tour-information.inc.js +++ b/view-webapp/src/main/webapp/js/tour-information.inc.js @@ -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); - } - }); diff --git a/view-webapp/src/main/webapp/js/tour-pairing.inc.js b/view-webapp/src/main/webapp/js/tour-pairing.inc.js new file mode 100644 index 0000000..ae361c4 --- /dev/null +++ b/view-webapp/src/main/webapp/js/tour-pairing.inc.js @@ -0,0 +1,2 @@ +onLoad(()=>{ +}); diff --git a/view-webapp/src/main/webapp/tour-pairing.inc.html b/view-webapp/src/main/webapp/tour-pairing.inc.html index 8d80304..9d1ee5c 100644 --- a/view-webapp/src/main/webapp/tour-pairing.inc.html +++ b/view-webapp/src/main/webapp/tour-pairing.inc.html @@ -1,3 +1,29 @@ +#set($paired = $api.get("tour/${params.id}/part"))
- Pairing... +
+
+ Pairings for round + + 1 + +
+
+
+
+
+ + +
+
+
+
+
+
+
diff --git a/view-webapp/src/main/webapp/tour.html b/view-webapp/src/main/webapp/tour.html index 4dbd0a2..29a10fc 100644 --- a/view-webapp/src/main/webapp/tour.html +++ b/view-webapp/src/main/webapp/tour.html @@ -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')