migrate tour & swiss forms, yarn add flatpickr

js-sound-v2
Thibault Duplessis 2020-09-12 11:59:04 +02:00
parent 02700539c6
commit a3add3987f
9 changed files with 330 additions and 313 deletions

View File

@ -16,10 +16,7 @@ object form {
views.html.base.layout(
title = "New Swiss tournament",
moreCss = cssTag("swiss.form"),
moreJs = frag(
flatpickrTag,
jsTag("tournamentForm.js")
)
moreJs = jsModule("tour-form")
) {
val fields = new SwissFields(form)
main(cls := "page-small")(
@ -52,10 +49,7 @@ object form {
views.html.base.layout(
title = swiss.name,
moreCss = cssTag("swiss.form"),
moreJs = frag(
flatpickrTag,
jsTag("tournamentForm.js")
)
moreJs = jsModule("tour-form")
) {
val fields = new SwissFields(form)
main(cls := "page-small")(

View File

@ -16,10 +16,7 @@ object form {
views.html.base.layout(
title = trans.newTournament.txt(),
moreCss = cssTag("tournament.form"),
moreJs = frag(
flatpickrTag,
jsTag("tournamentForm.js")
)
moreJs = jsModule("tour-form")
) {
val fields = new TourFields(form, none)
main(cls := "page-small")(
@ -58,10 +55,7 @@ object form {
views.html.base.layout(
title = tour.name(),
moreCss = cssTag("tournament.form"),
moreJs = frag(
flatpickrTag,
jsTag("tournamentForm.js")
)
moreJs = jsModule("tour-form")
) {
val fields = new TourFields(form, tour.some)
main(cls := "page-small")(

View File

@ -1,22 +0,0 @@
$(function() {
var $variant = $('#form3-variant');
function showPosition() {
document.querySelector('.form3 .position')?.classList.toggle('none', $variant.val() != 1);
};
$variant.on('change', showPosition);
showPosition();
$('form .conditions a.show').on('click', function() {
$(this).remove();
$('form .conditions').addClass('visible');
});
$("main form .flatpickr").flatpickr({
minDate: 'today',
maxDate: new Date(Date.now() + 1000 * 3600 * 24 * 31 * 3),
dateFormat: 'Z',
altInput: true,
altFormat: 'Y-m-d h:i K'
});
});

View File

@ -16,7 +16,7 @@ mkdir -p public/compiled
apps1="common"
apps2="chess ceval game tree chat nvui"
apps3="site swiss msg chat cli challenge notify learn insight editor puzzle round analyse lobby tournament tournamentSchedule tournamentCalendar simul dasher speech palantir serviceWorker"
site_plugins="tvEmbed puzzleEmbed analyseEmbed user modUser clas coordinate captcha expandText team forum account coachForm challengePage checkout login teamBattleForm dgt gameSearch userComplete infiniteScroll"
site_plugins="tvEmbed puzzleEmbed analyseEmbed user modUser clas coordinate captcha expandText team forum account coachForm challengePage checkout login tourForm teamBattleForm dgt gameSearch userComplete infiniteScroll"
round_plugins="keyboardMove nvui"
analyse_plugins="nvui"

File diff suppressed because it is too large Load Diff

View File

@ -12,8 +12,9 @@
"typescript": "^4.0.2"
},
"dependencies": {
"debounce-promise": "^3.1.2",
"chessops": "^0.7.0",
"debounce-promise": "^3.1.2",
"flatpickr": "^4.6.6",
"highcharts": "=4.2.5",
"hopscotch": "^0.3.1",
"jquery-bar-rating": "^1.2.2",

View File

@ -149,6 +149,10 @@ export default rollupProject({
input: 'src/team-battle-form.ts',
output: 'team-battle-form'
},
tourForm: {
input: 'src/tour-form.ts',
output: 'tour-form'
},
dgt: {
input: 'src/dgt/dgt.ts',
output: 'dgt',

View File

@ -0,0 +1,26 @@
import flatpickr from "flatpickr";
window.lichess.load.then(() => {
const $variant = $('#form3-variant'),
showPosition = () => $('.form3 .position').toggleClass('none', $variant.val() != '1');
$variant.on('change', showPosition);
showPosition();
$('form .conditions a.show').on('click', function(this: HTMLAnchorElement) {
$(this).remove();
$('form .conditions').addClass('visible');
});
$(".flatpickr").each(function(this: HTMLInputElement) {
flatpickr(this, {
minDate: 'today',
maxDate: new Date(Date.now() + 1000 * 3600 * 24 * 31 * 3),
dateFormat: 'Z',
altInput: true,
altFormat: 'Y-m-d h:i K',
monthSelectorType: 'static'
});
});
});

View File

@ -1490,6 +1490,11 @@ flagged-respawn@^1.0.0:
resolved "https://registry.yarnpkg.com/flagged-respawn/-/flagged-respawn-1.0.1.tgz#e7de6f1279ddd9ca9aac8a5971d618606b3aab41"
integrity sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==
flatpickr@^4.6.6:
version "4.6.6"
resolved "https://registry.yarnpkg.com/flatpickr/-/flatpickr-4.6.6.tgz#34d2ad80adfa34254e62583a34264d472f1038d6"
integrity sha512-EZ48CJMttMg3maMhJoX+GvTuuEhX/RbA1YeuI19attP3pwBdbYy6+yqAEVm0o0hSBFYBiLbVxscLW6gJXq6H3A==
flush-write-stream@^1.0.2:
version "1.1.1"
resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8"