Fix the 'new' button in drive which was broken in non root categories

pull/1/head
yflory 8 years ago
parent d8cc2903cc
commit ba0b314f5e

@ -706,7 +706,6 @@ define([
common.initialName = sessionStorage[newPadNameKey];
delete sessionStorage[newPadNameKey];
}
// Deprecated
if (sessionStorage[newPadPathKey]) {
common.initialPath = sessionStorage[newPadPathKey];
delete sessionStorage[newPadPathKey];

@ -958,16 +958,11 @@ define([
}
AppConfig.availablePadTypes.forEach(function (type) {
if (type === 'drive') { return; }
var path = filesOp.isPathInTrash(currentPath) ? '' : '/#?path=' + encodeURIComponent(currentPath);
var attributes = {
'class': 'newdoc',
'data-type': type
'data-type': type,
'href': '#'
};
// 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({
tag: 'a',
attributes: attributes,
@ -997,6 +992,12 @@ define([
var name = Cryptpad.getDefaultName({type: type});
filesOp.createNewFile(currentPath, name, type, onCreated);
});
} else {
$block.find('a.newdoc').click(function (e) {
var type = $(this).attr('data-type') || 'pad';
sessionStorage[Cryptpad.newPadPathKey] = filesOp.isPathInTrash(currentPath) ? '' : currentPath;
window.open('/' + type + '/');
});
}
return $block;

Loading…
Cancel
Save