cryptpad/www/form/templates.js

51 lines
1.3 KiB
JavaScript
Raw Normal View History

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