From dd7529da9853dff43b8e81685f3a1c7151bc9e24 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 10 Jul 2014 17:25:46 +0200 Subject: Added mountType attribute and adapted Delete action text Added mountType attribute for files/folder to indicated whether they are regular, external or shared. The client side then adapts the "Delete" action hint text based on this information. Only the mount roots must have the delete icon hint adapted. To make this detectable on the client side, the mountType can now be null, "shared", "shared-root", "external" or "external-root". This also gives room to icon customization on the client side. --- apps/files/js/fileactions.js | 16 +++++++++++----- apps/files/js/filelist.js | 4 ++++ 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index fd038765ea5..4aefd61a19a 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -291,14 +291,20 @@ if (actions['Delete']) { var img = self.icons['Delete']; var html; + var mountType = $tr.attr('data-mounttype'); + var deleteTitle = t('files', 'Delete'); + if (mountType === 'external-root') { + deleteTitle = t('files', 'Disconnect storage'); + } else if (mountType === 'shared-root') { + deleteTitle = t('files', 'Unshare'); + } else if (fileList.id === 'trashbin') { + deleteTitle = t('files', 'Delete permanently'); + } + if (img.call) { img = img(file); } - if (typeof trashBinApp !== 'undefined' && trashBinApp) { - html = ''; - } else { - html = ''; - } + html = ''; var element = $(html); element.data('action', actions['Delete']); element.on('click', {a: null, elem: parent, actionFunc: actions['Delete'].action}, actionHandler); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 96436d33a2c..61e73b7bebc 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -600,6 +600,10 @@ "data-permissions": fileData.permissions || this.getDirectoryPermissions() }); + if (fileData.mountType) { + tr.attr('data-mounttype', fileData.mountType); + } + if (!_.isUndefined(path)) { tr.attr('data-path', path); } -- cgit v1.2.3