diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-28 12:53:11 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-28 12:53:11 +0200 |
commit | 716ff81b27658580dcbe306e6cbe2c0cad8b1411 (patch) | |
tree | 9c93cb28b008cea2b90d8e3f9ab3da178b8121ae /apps/files/js | |
parent | 0bf2bb07517a6fbe17a8a1fd62225181ec39798c (diff) | |
parent | f35b6833ff2f702db75999bfd9343e7bc2fc7f2c (diff) | |
download | nextcloud-server-716ff81b27658580dcbe306e6cbe2c0cad8b1411.tar.gz nextcloud-server-716ff81b27658580dcbe306e6cbe2c0cad8b1411.zip |
Merge pull request #19401 from owncloud/files-actionsorder
Fix order of actions in the files actions menu
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/fileactions.js | 4 | ||||
-rw-r--r-- | apps/files/js/fileactionsmenu.js | 8 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index d3904f2f6d3..bde0b094b87 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -141,6 +141,7 @@ name: name, displayName: action.displayName, mime: mime, + order: action.order || 0, icon: action.icon, permissions: action.permissions, type: action.type || FileActions.TYPE_DROPDOWN @@ -565,6 +566,7 @@ this.registerAction({ name: 'Download', displayName: t('files', 'Download'), + order: -20, mime: 'all', permissions: OC.PERMISSION_READ, icon: function () { @@ -596,6 +598,7 @@ name: 'Rename', displayName: t('files', 'Rename'), mime: 'all', + order: -30, permissions: OC.PERMISSION_UPDATE, icon: function() { return OC.imagePath('core', 'actions/rename'); @@ -617,6 +620,7 @@ name: 'Delete', displayName: t('files', 'Delete'), mime: 'all', + order: 1000, // permission is READ because we show a hint instead if there is no permission permissions: OC.PERMISSION_DELETE, icon: function() { diff --git a/apps/files/js/fileactionsmenu.js b/apps/files/js/fileactionsmenu.js index 5ab0e42f93e..67cbb48c965 100644 --- a/apps/files/js/fileactionsmenu.js +++ b/apps/files/js/fileactionsmenu.js @@ -100,6 +100,14 @@ (!defaultAction || actionSpec.name !== defaultAction.name) ); }); + items = items.sort(function(actionA, actionB) { + var orderA = actionA.order || 0; + var orderB = actionB.order || 0; + if (orderB === orderA) { + return OC.Util.naturalSortCompare(actionA.displayName, actionB.displayName); + } + return orderA - orderB; + }); items = _.map(items, function(item) { item.nameLowerCase = item.name.toLowerCase(); return item; diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 8eaae74d3c3..e4a7aadd600 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -302,6 +302,7 @@ name: 'Details', displayName: t('files', 'Details'), mime: 'all', + order: -50, icon: OC.imagePath('core', 'actions/details'), permissions: OC.PERMISSION_READ, actionHandler: function(fileName, context) { |