filemanager: Add more UI actions
This commit is contained in:
@@ -96,7 +96,8 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
|
||||
f.match(/\.tar\.bz2$/);
|
||||
}
|
||||
|
||||
$scope.menuOptions = [];
|
||||
$scope.menuOptions = []; // shown for entries
|
||||
$scope.menuOptionsBlank = []; // shown for empty space in folder
|
||||
|
||||
var LANGUAGES = [];
|
||||
require(['vs/editor/editor.main'], function() {
|
||||
@@ -313,6 +314,13 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
|
||||
};
|
||||
|
||||
$scope.select = function ($event, entry) {
|
||||
// we don't stop propagation for context menu closing, but if targets don't match we got the whole list click event
|
||||
if ($event.currentTarget !== $event.target) return;
|
||||
|
||||
if (!entry) {
|
||||
$scope.selected = [];
|
||||
return;
|
||||
}
|
||||
|
||||
var i = $scope.selected.indexOf(entry);
|
||||
var multi = ($event.ctrlKey || $event.metaKey);
|
||||
@@ -356,7 +364,7 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
|
||||
if ($scope.clipboardCut) {
|
||||
// move files
|
||||
async.eachLimit($scope.clipboard, 5, function (entry, callback) {
|
||||
var newFilePath = sanitize($scope.cwd + '/' + (destinationEntry.isDirectory ? destinationEntry.fileName : '') + '/' + entry.fileName);
|
||||
var newFilePath = sanitize($scope.cwd + '/' + ((destinationEntry && destinationEntry.isDirectory) ? destinationEntry.fileName : '') + '/' + entry.fileName);
|
||||
|
||||
// TODO this will overwrite files in destination!
|
||||
Client.filesRename($scope.id, $scope.type, entry.fullFilePath, newFilePath, callback);
|
||||
@@ -373,6 +381,10 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
|
||||
}
|
||||
};
|
||||
|
||||
$scope.actionSelectAll = function () {
|
||||
$scope.selected = $scope.entries;
|
||||
};
|
||||
|
||||
$scope.goDirectoryUp = function () {
|
||||
$scope.changeDirectory($scope.cwd + '/..');
|
||||
};
|
||||
@@ -904,6 +916,27 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
|
||||
];
|
||||
});
|
||||
|
||||
$translate(['filemanager.toolbar.newFile', 'filemanager.toolbar.newFolder', 'filemanager.list.menu.paste', 'filemanager.list.menu.selectAll' ]).then(function (tr) {
|
||||
$scope.menuOptionsBlank = [
|
||||
{
|
||||
text: tr['filemanager.toolbar.newFile'],
|
||||
click: function ($itemScope, $event) { $scope.newFile.show(); }
|
||||
}, {
|
||||
text: tr['filemanager.toolbar.newFolder'],
|
||||
click: function ($itemScope, $event) { $scope.newDirectory.show(); }
|
||||
}, {
|
||||
text: tr['filemanager.list.menu.paste'],
|
||||
hasTopDivider: true,
|
||||
hasBottomDivider: true,
|
||||
enabled: function () { return $scope.clipboard.length; },
|
||||
click: function ($itemScope, $event) { $scope.actionPaste(); }
|
||||
}, {
|
||||
text: tr['filemanager.list.menu.selectAll'],
|
||||
click: function ($itemScope, $event) { $scope.actionSelectAll(); }
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
$('.file-list').on('scroll', function (event) {
|
||||
if (event.target.scrollTop > 10) event.target.classList.add('top-scroll-indicator');
|
||||
else event.target.classList.remove('top-scroll-indicator');
|
||||
|
||||
Reference in New Issue
Block a user