diff --git a/src/filemanager.html b/src/filemanager.html index deb4b690a..584a91e7b 100644 --- a/src/filemanager.html +++ b/src/filemanager.html @@ -346,7 +346,7 @@ -
+
diff --git a/src/js/filemanager.js b/src/js/filemanager.js index 2bf6eb57a..a943f9352 100644 --- a/src/js/filemanager.js +++ b/src/js/filemanager.js @@ -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'); diff --git a/src/theme.scss b/src/theme.scss index fa167b70f..3631b7eb9 100644 --- a/src/theme.scss +++ b/src/theme.scss @@ -1792,6 +1792,7 @@ tag-input { overflow: auto; border: 2px solid transparent; position: relative; + height: 100%; &.busy { opacity: 0.5; diff --git a/src/translation/en.json b/src/translation/en.json index 43f7a09bf..84aca4ddc 100644 --- a/src/translation/en.json +++ b/src/translation/en.json @@ -904,7 +904,11 @@ "extract": "Extract Here", "download": "Download", "delete": "Delete", - "edit": "Edit" + "edit": "Edit", + "cut": "Cut", + "copy": "Copy", + "paste": "Paste", + "selectAll": "Select All" }, "mtime": "Modified" },