EGF and FFG exports
This commit is contained in:
@@ -153,11 +153,6 @@
|
||||
<artifactId>kotlin-reflect</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlinx</groupId>
|
||||
<artifactId>kotlinx-datetime-jvm</artifactId>
|
||||
<version>0.4.0</version>
|
||||
</dependency>
|
||||
<!-- servlets and mail APIs -->
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
|
@@ -54,6 +54,11 @@
|
||||
|
||||
/* registration section */
|
||||
|
||||
#players-list {
|
||||
max-width: 95vw;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
#player {
|
||||
&.create {
|
||||
.edition {
|
||||
@@ -280,4 +285,8 @@
|
||||
justify-content: space-around;
|
||||
}
|
||||
}
|
||||
#standings-container {
|
||||
max-width: 95vw;
|
||||
overflow-x: auto;
|
||||
}
|
||||
}
|
||||
|
@@ -9,13 +9,16 @@ const apiVersion = '1.0';
|
||||
// .catch(err => { ... });
|
||||
|
||||
const base = '/api/';
|
||||
let headers = function() {
|
||||
let headers = function(withJson) {
|
||||
let ret = {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Accept-Version": apiVersion,
|
||||
"Accept": "application/json",
|
||||
"X-Browser-Key": store('browserKey')
|
||||
'Accept-Version': apiVersion,
|
||||
'Accept': 'application/json',
|
||||
'X-Browser-Key': store('browserKey')
|
||||
};
|
||||
if (typeof(withJson) === 'undefined') withJson = true;
|
||||
if (withJson) {
|
||||
ret['Content-Type'] = 'application/json';
|
||||
}
|
||||
let accessToken = store('accessToken');
|
||||
if (accessToken) {
|
||||
ret['Authorization'] = `Bearer ${accessToken}`;
|
||||
|
@@ -1,3 +1,20 @@
|
||||
function publish(format, extension) {
|
||||
let form = $('#tournament-infos')[0];
|
||||
let shortName = form.val('shortName');
|
||||
let hdrs = headers();
|
||||
hdrs['Accept'] = `application/${format}`
|
||||
fetch(`api/tour/${tour_id}/standings/${activeRound}`, {
|
||||
headers: hdrs
|
||||
}).then(resp => {
|
||||
if (resp.ok) return resp.text()
|
||||
else throw "publish error"
|
||||
}).then(txt => {
|
||||
let blob = new Blob(['\uFEFF', txt.trim()], {type: 'plain/text;charset=utf-8'});
|
||||
downloadFile(blob, `${shortName}.${extension}`);
|
||||
close_modal();
|
||||
}).catch(err => showError(err));
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
$('.criterium').on('click', e => {
|
||||
let alreadyOpen = e.target.closest('select');
|
||||
@@ -45,4 +62,10 @@ onLoad(() => {
|
||||
$('#publish-modal').on('click', e => {
|
||||
close_modal();
|
||||
});
|
||||
$('.publish-ffg').on('click', e => {
|
||||
publish('ffg', 'tou');
|
||||
});
|
||||
$('.publish-egf').on('click', e => {
|
||||
publish('egf', 'h9');
|
||||
});
|
||||
});
|
||||
|
@@ -101,9 +101,9 @@
|
||||
</div>
|
||||
<div class="popup-footer">
|
||||
<div class="form-actions">
|
||||
<button class="ui gray floating cancel button">Cancel</button>
|
||||
<button class="ui blue floating button">EGF</button>
|
||||
<button class="ui blue floating button">FFG</button>
|
||||
<button type="button" class="ui gray floating cancel button">Cancel</button>
|
||||
<button type="button" class="ui blue floating publish-egf button">EGF</button>
|
||||
<button type="button" class="ui blue floating publish-ffg button">FFG</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user