Merge branch 'staging' into soon
commit
87d4231725
756
CHANGELOG.md
756
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
|
@ -2450,6 +2450,7 @@ define([
|
|||
'title': name,
|
||||
}).appendTo($container);
|
||||
$span.data('id', obj.id);
|
||||
if (obj.content) { $span.data('content', obj.content); }
|
||||
if (idx === selected) { $span.addClass('cp-creation-template-selected'); }
|
||||
if (!obj.thumbnail) {
|
||||
$span.append(obj.icon || h('span.cptools.cptools-template'));
|
||||
|
@ -2605,6 +2606,7 @@ define([
|
|||
|
||||
var $template = $creation.find('.cp-creation-template-selected');
|
||||
var templateId = $template.data('id') || undefined;
|
||||
var templateContent = $template.data('content') || undefined;
|
||||
// Team
|
||||
var team;
|
||||
if (teamValue) {
|
||||
|
@ -2617,6 +2619,7 @@ define([
|
|||
password: passwordVal,
|
||||
expire: expireVal,
|
||||
templateId: templateId,
|
||||
templateContent: templateContent,
|
||||
team: team
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1478,28 +1478,45 @@ define([
|
|||
return 'thumbnail-' + parsed.type + '-' + channel;
|
||||
};
|
||||
sframeChan.on('Q_CREATE_TEMPLATES', function (type, cb) {
|
||||
Cryptpad.getSecureFilesList({
|
||||
types: [type],
|
||||
where: ['template']
|
||||
}, function (err, data) {
|
||||
// NOTE: Never return data directly!
|
||||
if (err) { return void cb({error: err}); }
|
||||
|
||||
var res = [];
|
||||
nThen(function (waitFor) {
|
||||
Object.keys(data).map(function (el) {
|
||||
var k = getKey(data[el].href, data[el].channel);
|
||||
Utils.LocalStore.getThumbnail(k, waitFor(function (e, thumb) {
|
||||
res.push({
|
||||
id: el,
|
||||
name: data[el].filename || data[el].title || '?',
|
||||
thumbnail: thumb,
|
||||
used: data[el].used || 0
|
||||
var templates;
|
||||
nThen(function (waitFor) {
|
||||
var next = waitFor();
|
||||
require([
|
||||
'/'+type+'/templates.js'
|
||||
], function (Templates) {
|
||||
templates = Templates;
|
||||
next();
|
||||
}, function () {
|
||||
next();
|
||||
});
|
||||
}).nThen(function () {
|
||||
Cryptpad.getSecureFilesList({
|
||||
types: [type],
|
||||
where: ['template']
|
||||
}, function (err, data) {
|
||||
// NOTE: Never return data directly!
|
||||
if (err) { return void cb({error: err}); }
|
||||
var res = [];
|
||||
nThen(function (waitFor) {
|
||||
Object.keys(data).map(function (el) {
|
||||
var k = getKey(data[el].href, data[el].channel);
|
||||
Utils.LocalStore.getThumbnail(k, waitFor(function (e, thumb) {
|
||||
res.push({
|
||||
id: el,
|
||||
name: data[el].filename || data[el].title || '?',
|
||||
thumbnail: thumb,
|
||||
used: data[el].used || 0
|
||||
});
|
||||
}));
|
||||
});
|
||||
}).nThen(function () {
|
||||
if (Array.isArray(templates)) {
|
||||
templates.forEach(function (obj) {
|
||||
res.push(obj);
|
||||
});
|
||||
}));
|
||||
}
|
||||
cb({data: res});
|
||||
});
|
||||
}).nThen(function () {
|
||||
cb({data: res});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1892,6 +1909,7 @@ define([
|
|||
Utils.rtConfig = rtConfig;
|
||||
var templatePw;
|
||||
nThen(function(waitFor) {
|
||||
if (data.templateContent) { return; }
|
||||
if (data.templateId) {
|
||||
if (data.templateId === -1) {
|
||||
isTemplate = true;
|
||||
|
@ -1905,6 +1923,14 @@ define([
|
|||
}
|
||||
}).nThen(function () {
|
||||
var cryptputCfg = $.extend(true, {}, rtConfig, {password: password});
|
||||
if (data.templateContent) {
|
||||
Cryptget.put(currentPad.hash, JSON.stringify(data.templateContent), function () {
|
||||
console.error(arguments);
|
||||
startRealtime();
|
||||
cb();
|
||||
}, cryptputCfg);
|
||||
return;
|
||||
}
|
||||
if (data.template) {
|
||||
// Start OO with a template...
|
||||
// Cryptget and give href, password and content to inner
|
||||
|
|
|
@ -458,7 +458,8 @@ define([
|
|||
password: cfg.password,
|
||||
team: cfg.team,
|
||||
template: cfg.template,
|
||||
templateId: cfg.templateId
|
||||
templateId: cfg.templateId,
|
||||
templateContent: cfg.templateContent
|
||||
}, cb);
|
||||
};
|
||||
|
||||
|
|
|
@ -428,6 +428,7 @@
|
|||
|
||||
button.btn-secondary {
|
||||
margin-left: 30px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.cp-form-handle {
|
||||
display: flex;
|
||||
|
|
|
@ -927,8 +927,8 @@ define([
|
|||
return {
|
||||
tag: tag,
|
||||
getValue: function () {
|
||||
var invalid = $tag.is(':invalid');
|
||||
if (invalid) { return; } // XXX invalid answers are ignored?
|
||||
//var invalid = $tag.is(':invalid');
|
||||
//if (invalid) { return; }
|
||||
return $tag.val();
|
||||
},
|
||||
setValue: function (val) { $tag.val(val); },
|
||||
|
@ -2282,7 +2282,7 @@ define([
|
|||
filter: "input, button, .CodeMirror, .cp-form-type-sort",
|
||||
preventOnFilter: false,
|
||||
draggable: ".cp-form-block",
|
||||
forceFallback: true,
|
||||
//forceFallback: true,
|
||||
fallbackTolerance: 5,
|
||||
onStart: function () {
|
||||
$container.find('.cp-form-creator-add-inline').remove();
|
||||
|
@ -2333,17 +2333,17 @@ define([
|
|||
$toolbarContainer.after(helpMenu.menu);
|
||||
|
||||
var offlineEl = h('div.alert.alert-danger.cp-burn-after-reading', Messages.disconnected);
|
||||
var oldFilter;
|
||||
framework.onEditableChange(function (editable) {
|
||||
if (editable) {
|
||||
if (APP.mainSortable) { APP.mainSortable.options.filter = oldFilter; }
|
||||
if (APP.mainSortable) {
|
||||
APP.mainSortable.options.disabled = false;
|
||||
}
|
||||
if (!APP.isEditor) { $(offlineEl).remove(); }
|
||||
$body.removeClass('cp-form-readonly');
|
||||
$('.cp-form-creator-settings').find('input, button').removeAttr('disabled');
|
||||
} else {
|
||||
if (APP.mainSortable) {
|
||||
oldFilter = APP.mainSortable.options.filter;
|
||||
APP.mainSortable.options.filter = function () { return true; };
|
||||
APP.mainSortable.options.disabled = true;
|
||||
}
|
||||
if (!APP.isEditor) { $('.cp-help-container').before(offlineEl); }
|
||||
$body.addClass('cp-form-readonly');
|
||||
|
@ -2578,11 +2578,14 @@ define([
|
|||
|
||||
if (APP.isEditor) {
|
||||
if (!content.form) {
|
||||
content.form = {};
|
||||
content.form = {
|
||||
"1": { type: 'md' },
|
||||
"2": { type: 'radio' }
|
||||
};
|
||||
framework.localChange();
|
||||
}
|
||||
if (!content.order) {
|
||||
content.order = [];
|
||||
content.order = ["1", "2"];
|
||||
framework.localChange();
|
||||
}
|
||||
if (!content.answers || !content.answers.channel || !content.answers.publicKey || !content.answers.validateKey) {
|
||||
|
@ -2593,6 +2596,7 @@ define([
|
|||
};
|
||||
framework.localChange();
|
||||
}
|
||||
checkIntegrity();
|
||||
}
|
||||
|
||||
sframeChan.event('EV_FORM_PIN', {channel: content.answers.channel});
|
||||
|
|
Loading…
Reference in New Issue