|
|
@ -871,14 +871,18 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
AppConfig.availablePadTypes.forEach(function (type) {
|
|
|
|
AppConfig.availablePadTypes.forEach(function (type) {
|
|
|
|
var path = filesOp.isPathInTrash(currentPath) ? '' : '/#?path=' + encodeURIComponent(currentPath);
|
|
|
|
var path = filesOp.isPathInTrash(currentPath) ? '' : '/#?path=' + encodeURIComponent(currentPath);
|
|
|
|
|
|
|
|
var attributes = {
|
|
|
|
|
|
|
|
'class': 'newdoc',
|
|
|
|
|
|
|
|
'data-type': type
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// In root, do not redirect instantly, but ask for a name first. Cf handlers below
|
|
|
|
|
|
|
|
if (!isInRoot) {
|
|
|
|
|
|
|
|
attributes.href = '/' + type + path;
|
|
|
|
|
|
|
|
attributes.target = '_blank';
|
|
|
|
|
|
|
|
}
|
|
|
|
options.push({
|
|
|
|
options.push({
|
|
|
|
tag: 'a',
|
|
|
|
tag: 'a',
|
|
|
|
attributes: {
|
|
|
|
attributes: attributes,
|
|
|
|
'class': 'newdoc',
|
|
|
|
|
|
|
|
'data-type': type,
|
|
|
|
|
|
|
|
'href': '/' + type + path,
|
|
|
|
|
|
|
|
'target': '_blank'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
content: Messages.type[type]
|
|
|
|
content: Messages.type[type]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -892,6 +896,7 @@ define([
|
|
|
|
$block.find('button').addClass('new').addClass('element');
|
|
|
|
$block.find('button').addClass('new').addClass('element');
|
|
|
|
|
|
|
|
|
|
|
|
// Handlers
|
|
|
|
// Handlers
|
|
|
|
|
|
|
|
if (isInRoot) {
|
|
|
|
$block.find('a.newFolder').click(function () {
|
|
|
|
$block.find('a.newFolder').click(function () {
|
|
|
|
var onCreated = function (info) {
|
|
|
|
var onCreated = function (info) {
|
|
|
|
module.newFolder = info.newPath;
|
|
|
|
module.newFolder = info.newPath;
|
|
|
@ -899,6 +904,19 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
filesOp.createNewFolder(currentPath, null, onCreated);
|
|
|
|
filesOp.createNewFolder(currentPath, null, onCreated);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$block.find('a.newdoc').click(function () {
|
|
|
|
|
|
|
|
var type = $(this).data('type');
|
|
|
|
|
|
|
|
if (!type) {
|
|
|
|
|
|
|
|
throw new Error("Unable to get the pad type...");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var onNamed = function (name) {
|
|
|
|
|
|
|
|
var path = '/#?name=' + encodeURIComponent(name) + '&path=' + encodeURIComponent(currentPath);
|
|
|
|
|
|
|
|
console.log(path);
|
|
|
|
|
|
|
|
window.open('/' + type + path);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
Cryptpad.prompt("How would you like to name your file?", Cryptpad.getDefaultName({type: type}), onNamed);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $block;
|
|
|
|
return $block;
|
|
|
|
};
|
|
|
|
};
|
|
|
|