edgeconnect-cryptpad-deploy.../www/form/templates.js
Richard Robert Reitz addc3725ea
Some checks failed
build / build (push) Has been cancelled
first commit
2025-08-28 15:13:14 +02:00

53 lines
1.3 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
//
// SPDX-License-Identifier: AGPL-3.0-or-later
define([
'/customize/messages.js'
], function (Messages) {
var pollValues = [];
var d8 = new Date();
d8.setDate(d8.getDate() - d8.getDay() + 7); // set sunday
d8.setHours(8);
d8.setMinutes(0);
d8.setSeconds(0);
d8.setMilliseconds(0);
var d14 = new Date(d8);
d14.setHours(14);
[0,1,2].forEach(function (el) {
d8.setDate(d8.getDate() + 1);
d14.setDate(d14.getDate() + 1);
if (el === 2) {
d8.setHours(10);
}
pollValues.push(+d8);
if (el === 2) { return; }
pollValues.push(+d14);
});
return [{
id: 'a',
used: 1,
name: Messages.form_template_poll,
content: {
answers: {
anonymous: true,
},
form: {
"1": {
type: 'md'
},
"2": {
type: 'poll',
opts: {
type: 'time',
values: pollValues
}
}
},
order: ["1", "2"],
metadata: {
title: Messages.form_template_poll
}
}
}];
});