Fix the 'new' button in drive which was broken in non root categories
This commit is contained in:
@@ -706,7 +706,6 @@ define([
|
|||||||
common.initialName = sessionStorage[newPadNameKey];
|
common.initialName = sessionStorage[newPadNameKey];
|
||||||
delete sessionStorage[newPadNameKey];
|
delete sessionStorage[newPadNameKey];
|
||||||
}
|
}
|
||||||
// Deprecated
|
|
||||||
if (sessionStorage[newPadPathKey]) {
|
if (sessionStorage[newPadPathKey]) {
|
||||||
common.initialPath = sessionStorage[newPadPathKey];
|
common.initialPath = sessionStorage[newPadPathKey];
|
||||||
delete sessionStorage[newPadPathKey];
|
delete sessionStorage[newPadPathKey];
|
||||||
|
|||||||
@@ -958,16 +958,11 @@ define([
|
|||||||
}
|
}
|
||||||
AppConfig.availablePadTypes.forEach(function (type) {
|
AppConfig.availablePadTypes.forEach(function (type) {
|
||||||
if (type === 'drive') { return; }
|
if (type === 'drive') { return; }
|
||||||
var path = filesOp.isPathInTrash(currentPath) ? '' : '/#?path=' + encodeURIComponent(currentPath);
|
|
||||||
var attributes = {
|
var attributes = {
|
||||||
'class': 'newdoc',
|
'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({
|
options.push({
|
||||||
tag: 'a',
|
tag: 'a',
|
||||||
attributes: attributes,
|
attributes: attributes,
|
||||||
@@ -997,6 +992,12 @@ define([
|
|||||||
var name = Cryptpad.getDefaultName({type: type});
|
var name = Cryptpad.getDefaultName({type: type});
|
||||||
filesOp.createNewFile(currentPath, name, type, onCreated);
|
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;
|
return $block;
|
||||||
|
|||||||
Reference in New Issue
Block a user