Replace action buttons with context menu
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
require.config({ paths: { 'vs': '3rdparty/vs' }});
|
||||
|
||||
// create main application module
|
||||
var app = angular.module('Application', ['angular-md5', 'ui-notification', 'ngDrag', 'ui.bootstrap']);
|
||||
var app = angular.module('Application', ['angular-md5', 'ui-notification', 'ngDrag', 'ui.bootstrap', 'ui.bootstrap.contextMenu']);
|
||||
|
||||
angular.module('Application').filter('prettyOwner', function () {
|
||||
return function (uid) {
|
||||
@@ -63,6 +63,7 @@ app.controller('FileManagerController', ['$scope', '$timeout', 'Client', functio
|
||||
$scope.appId = search.appId;
|
||||
$scope.app = null;
|
||||
$scope.entries = [];
|
||||
$scope.dropToBody = false;
|
||||
|
||||
$scope.owners = [
|
||||
{ name: 'cloudron', value: 1000 },
|
||||
@@ -71,6 +72,24 @@ app.controller('FileManagerController', ['$scope', '$timeout', 'Client', functio
|
||||
{ name: 'root', value: 0 }
|
||||
];
|
||||
|
||||
$scope.menuOptions = [
|
||||
{
|
||||
text: 'Download',
|
||||
enabled: function ($itemScope, $event, entry) { return !entry.isDirectory },
|
||||
click: function ($itemScope, $event, entry) { download(entry); }
|
||||
}, {
|
||||
text: 'Rename',
|
||||
click: function ($itemScope, $event, entry) { $scope.renameEntry.show(entry); }
|
||||
}, {
|
||||
text: 'Change Ownership',
|
||||
click: function ($itemScope, $event, entry) { $scope.chownEntry.show(entry); }
|
||||
}, {
|
||||
text: 'Delete',
|
||||
hasTopDivider: true,
|
||||
click: function ($itemScope, $event, entry) { $scope.entryRemove.show(entry); }
|
||||
}
|
||||
];
|
||||
|
||||
var LANGUAGES = [];
|
||||
require(['vs/editor/editor.main'], function() {
|
||||
LANGUAGES = monaco.languages.getLanguages();
|
||||
@@ -93,8 +112,6 @@ app.controller('FileManagerController', ['$scope', '$timeout', 'Client', functio
|
||||
return '/' + filePath;
|
||||
}
|
||||
|
||||
$scope.dropToBody = false;
|
||||
|
||||
$scope.dragEnter = function ($event, entry) {
|
||||
$event.originalEvent.stopPropagation();
|
||||
$event.originalEvent.preventDefault();
|
||||
@@ -187,7 +204,7 @@ app.controller('FileManagerController', ['$scope', '$timeout', 'Client', functio
|
||||
} else {}
|
||||
};
|
||||
|
||||
$scope.download = function (entry) {
|
||||
function download(entry) {
|
||||
var filePath = sanitize($scope.cwd + '/' + entry.fileName);
|
||||
|
||||
if (entry.isDirectory) return;
|
||||
|
||||
Reference in New Issue
Block a user