Merge branch 'form' into staging

pull/1/head
ansuz 4 years ago
commit 0bc678b9dd

@ -1,7 +1,7 @@
define(['/api/config'], function (ApiConfig) {
var Module = {};
var apps = ['code', 'slide', 'pad', 'kanban', 'whiteboard', 'sheet', 'poll', 'teams'];
var apps = ['code', 'slide', 'pad', 'kanban', 'whiteboard', 'sheet', 'poll', 'teams', 'form'];
var app = window.location.pathname.slice(1, -1); // remove "/" at the beginnin and the end
var suffix = apps.indexOf(app) !== -1 ? '-'+app : '';

@ -1868,6 +1868,7 @@ define([
console.error(err || data.error);
return void UI.warn(Messages.error);
}
evOnChange.fire(false, true);
window.onbeforeunload = undefined;
if (!update) {
// Add results button
@ -1947,9 +1948,13 @@ define([
var _answers = Util.clone(answers || {});
delete _answers._proof;
delete _answers._userdata;
evOnChange.reg(function (noBeforeUnload) {
evOnChange.reg(function (noBeforeUnload, isSave) {
if (noBeforeUnload) { return; }
var results = getFormResults();
if (isSave) {
answers = Util.clone(results || {});
_answers = Util.clone(answers);
}
if (!answers || Sortify(_answers) !== Sortify(results)) {
window.onbeforeunload = function () {
return true;
@ -2068,6 +2073,9 @@ define([
h('span.cp-form-block-question-number', (n++)+'.'),
h('span', block.q || Messages.form_default)
]);
// Static blocks don't have questions ("q" is not used) so we can decrement n
if (isStatic) { n--; }
var editButtons, editContainer;
APP.formBlocks.push(data);

Loading…
Cancel
Save