polish and re-enable form response messages

pull/1/head
ansuz 3 years ago
parent 16f5979252
commit cf7593553b

@ -440,7 +440,6 @@
} }
} }
.cp-form-edit-block { .cp-form-edit-block {
button.btn-secondary { button.btn-secondary {
margin-left: 30px; margin-left: 30px;
margin-bottom: 5px; margin-bottom: 5px;
@ -487,6 +486,9 @@
p:last-child { p:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
* {
max-width: 100%;
}
} }
.cp-form-creator-results-controls { .cp-form-creator-results-controls {
@ -832,6 +834,11 @@
color: @cp_form-poll-yes-color; color: @cp_form-poll-yes-color;
} }
} }
.cp-form-response-modal {
.CodeMirror {
border: 1px solid @cp_forms-border;
}
}
.charts_main(); .charts_main();
} }

@ -2702,7 +2702,6 @@ define([
var responseMsg = h('div.cp-form-response-msg-container'); var responseMsg = h('div.cp-form-response-msg-container');
var $responseMsg = $(responseMsg); var $responseMsg = $(responseMsg);
var refreshResponse = function () { var refreshResponse = function () {
if (true) { return; } // XXX 4.11.0
$responseMsg.empty(); $responseMsg.empty();
Messages.form_updateMsg = "Update response message"; // XXX 4.11.0 Messages.form_updateMsg = "Update response message"; // XXX 4.11.0
Messages.form_addMsg = "Add response message"; // XXX 4.11.0 Messages.form_addMsg = "Add response message"; // XXX 4.11.0
@ -2713,12 +2712,23 @@ define([
var editor; var editor;
if (!APP.responseModal) { if (!APP.responseModal) {
var t = h('textarea'); var t = h('textarea');
var p = h('p', Messages.form_responseMsg);
var div = h('div', [ var div = h('div', [
h('p', Messages.form_responseMsg), p,
t h('div.cp-form-response-modal', t),
]); ]);
var cm = SFCodeMirror.create("gfm", CMeditor, t); var cm = window.my_cm = SFCodeMirror.create("gfm", CMeditor, t);
editor = APP.responseEditor = cm.editor; editor = APP.responseEditor = cm.editor;
var markdownTb = APP.common.createMarkdownToolbar(editor, {
embed: function (mt) {
editor.focus();
editor.replaceSelection($(mt)[0].outerHTML);
}
});
$(markdownTb.toolbar).insertAfter($(p));
$(markdownTb.toolbar).show();
cm.configureTheme(APP.common, function () {});
editor.setOption('lineNumbers', true); editor.setOption('lineNumbers', true);
editor.setOption('lineWrapping', true); editor.setOption('lineWrapping', true);
editor.setOption('styleActiveLine', true); editor.setOption('styleActiveLine', true);
@ -2735,7 +2745,7 @@ define([
name: Messages.settings_save, name: Messages.settings_save,
onClick: function () { onClick: function () {
var v = editor.getValue(); var v = editor.getValue();
content.answers.msg = v.trim(0, 2000); // XXX 4.11.0 max length? content.answers.msg = v.slice(0, 2000); // XXX 4.11.0 max length?
framework.localChange(); framework.localChange();
framework._.cpNfInner.chainpad.onSettle(function () { framework._.cpNfInner.chainpad.onSettle(function () {
UI.log(Messages.saved); UI.log(Messages.saved);
@ -2761,9 +2771,9 @@ define([
} }
UI.openCustomModal(APP.responseModal); UI.openCustomModal(APP.responseModal);
}); });
// $responseMsg.append(btn); // XXX 4.11.0 $responseMsg.append(btn);
}; };
//refreshResponse(); refreshResponse();
// Allow anonymous answers // Allow anonymous answers
var privacyContainer = h('div.cp-form-privacy-container'); var privacyContainer = h('div.cp-form-privacy-container');

@ -176,7 +176,7 @@ define([
validateKey: keys.secondaryValidateKey, validateKey: keys.secondaryValidateKey,
owners: [myKeys.edPublic], owners: [myKeys.edPublic],
crypto: crypto, crypto: crypto,
//Cache: Utils.Cache // XXX 4.11.0 //Cache: Utils.Cache // TODO enable cache for form responses when the cache stops evicting old answers
}; };
var results = {}; var results = {};
config.onError = function (info) { config.onError = function (info) {

Loading…
Cancel
Save