From 53a23364ef5184d049674e50447c2a0fbe8be72a Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 21 Apr 2015 11:57:29 +0200 Subject: [PATCH] Added empty content message for empty read-only folders --- apps/files/js/filelist.js | 3 ++- apps/files/templates/list.php | 2 +- apps/files/tests/js/filelistSpec.js | 9 ++++++--- apps/files_sharing/js/public.js | 7 +++++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 9d60e77b0a..0181acab59 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1623,7 +1623,8 @@ updateEmptyContent: function() { var permissions = this.getDirectoryPermissions(); var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0; - this.$el.find('#emptycontent').toggleClass('hidden', !isCreatable || !this.isEmpty); + this.$el.find('#emptycontent').toggleClass('hidden', !this.isEmpty); + this.$el.find('#emptycontent .uploadmessage').toggleClass('hidden', !isCreatable || !this.isEmpty); this.$el.find('#filestable thead th').toggleClass('hidden', this.isEmpty); }, /** diff --git a/apps/files/templates/list.php b/apps/files/templates/list.php index 02137c7e44..32651b261d 100644 --- a/apps/files/templates/list.php +++ b/apps/files/templates/list.php @@ -54,7 +54,7 @@ ' ); @@ -845,13 +846,15 @@ describe('OCA.Files.FileList tests', function() { fileList.setFiles([]); expect($('#filestable thead th').hasClass('hidden')).toEqual(true); expect($('#emptycontent').hasClass('hidden')).toEqual(false); + expect($('#emptycontent .uploadmessage').hasClass('hidden')).toEqual(false); expect(fileList.$el.find('.summary').hasClass('hidden')).toEqual(true); }); - it('hides headers, empty content message, and summary when list is empty and user has no creation permission', function(){ + it('hides headers, upload message, and summary when list is empty and user has no creation permission', function(){ $('#permissions').val(0); fileList.setFiles([]); expect($('#filestable thead th').hasClass('hidden')).toEqual(true); - expect($('#emptycontent').hasClass('hidden')).toEqual(true); + expect($('#emptycontent').hasClass('hidden')).toEqual(false); + expect($('#emptycontent .uploadmessage').hasClass('hidden')).toEqual(true); expect(fileList.$el.find('.summary').hasClass('hidden')).toEqual(true); }); it('calling findFileEl() can find existing file element', function() { diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index bec43a4fb5..41bfeba031 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -150,6 +150,13 @@ OCA.Sharing.PublicApp = { return OC.generateUrl('/apps/files_sharing/ajax/publicpreview.php?') + $.param(urlSpec); }; + this.fileList.updateEmptyContent = function() { + this.$el.find('#emptycontent .uploadmessage').text( + t('files_sharing', 'You can upload into this folder') + ); + OCA.Files.FileList.prototype.updateEmptyContent.apply(this, arguments); + }; + var file_upload_start = $('#file_upload_start'); file_upload_start.on('fileuploadadd', function (e, data) { var fileDirectory = '';