summaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-04-23 14:33:19 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-04-23 21:49:59 +0200
commitf4bc852db3376f5e602c1970fe76b8698e26f32e (patch)
tree1a8f4e3c8c7717752548b8f66f032bac325a6023 /apps/files/js
parentf8f354b351a349898bbb5cdf2d9bee1c798c0f73 (diff)
downloadnextcloud-server-f4bc852db3376f5e602c1970fe76b8698e26f32e.tar.gz
nextcloud-server-f4bc852db3376f5e602c1970fe76b8698e26f32e.zip
Show hint if there is no delete permission
* add class .no-permission which shows the default delete icon * fixes #15172 * add unit test for no permission and for delete permission
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/fileactions.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index b335f1f6432..1956fda0077 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -288,9 +288,15 @@
} else if (mountType === 'shared-root') {
deleteTitle = t('files', 'Unshare');
}
+ var cssClasses = 'action delete icon-delete';
+ if((context.$file.data('permissions') & OC.PERMISSION_DELETE) === 0) {
+ // add css class no-permission to delete icon
+ cssClasses += ' no-permission';
+ deleteTitle = t('files', 'No permission to delete');
+ }
var $actionLink = $('<a href="#" original-title="' +
escapeHTML(deleteTitle) +
- '" class="action delete icon-delete">' +
+ '" class="' +cssClasses + '">' +
'<span class="hidden-visually">' + escapeHTML(deleteTitle) + '</span>' +
'</a>'
);
@@ -426,12 +432,17 @@
name: 'Delete',
displayName: '',
mime: 'all',
- permissions: OC.PERMISSION_DELETE,
+ // permission is READ because we show a hint instead if there is no permission
+ permissions: OC.PERMISSION_READ,
icon: function() {
return OC.imagePath('core', 'actions/delete');
},
render: _.bind(this._renderDeleteAction, this),
actionHandler: function(fileName, context) {
+ // if there is no permission to delete do nothing
+ if((context.$file.data('permissions') & OC.PERMISSION_DELETE) === 0) {
+ return;
+ }
context.fileList.do_delete(fileName, context.dir);
$('.tipsy').remove();
}