diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-11-02 12:47:57 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-11-02 12:47:57 +0100 |
commit | a9540fe99044fd26f5c876438ae83697dbd1fe8e (patch) | |
tree | c94493651d61b54e0477b304e9ae9885fae1ac28 /apps/files/js/filelist.js | |
parent | 8ee765a61743db31749b0bdb51ce09915458325f (diff) | |
download | nextcloud-server-a9540fe99044fd26f5c876438ae83697dbd1fe8e.tar.gz nextcloud-server-a9540fe99044fd26f5c876438ae83697dbd1fe8e.zip |
Hide summary file actions when a selected file does not match
When several files are selected and one of them can not be deleted the
"Delete" file action is not shown in the summary. This commit extends
that behaviour too to the other file actions in the summary ("Move or
copy" and "Download"), so now an action is shown in the summary only if
it can be executed on all the currently selected files.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 4790afcf4d0..f7bbb329532 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -2822,11 +2822,31 @@ this.$el.find('#headerName a.name>span:first').text(selection); this.$el.find('#modified a>span:first').text(''); this.$el.find('table').addClass('multiselect'); + this.$el.find('.selectedActions .copy-move').toggleClass('hidden', !this.isSelectedCopiableOrMovable()); + this.$el.find('.selectedActions .download').toggleClass('hidden', !this.isSelectedDownloadable()); this.$el.find('.delete-selected').toggleClass('hidden', !this.isSelectedDeletable()); } }, /** + * Check whether all selected files are copiable or movable + */ + isSelectedCopiableOrMovable: function() { + return _.reduce(this.getSelectedFiles(), function(copiableOrMovable, file) { + return copiableOrMovable && (file.permissions & OC.PERMISSION_UPDATE); + }, true); + }, + + /** + * Check whether all selected files are downloadable + */ + isSelectedDownloadable: function() { + return _.reduce(this.getSelectedFiles(), function(downloadable, file) { + return downloadable && (file.permissions & OC.PERMISSION_READ); + }, true); + }, + + /** * Check whether all selected files are deletable */ isSelectedDeletable: function() { |