summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-04-21 11:57:29 +0200
committerVincent Petry <pvince81@owncloud.com>2015-04-21 14:31:13 +0200
commit53a23364ef5184d049674e50447c2a0fbe8be72a (patch)
treede5e4674ba2d7c06dd060c951565b30347da4f13
parentb0fcf0fa0ee8846e2ba35ede5968ed0227c5675d (diff)
downloadnextcloud-server-53a23364ef5184d049674e50447c2a0fbe8be72a.tar.gz
nextcloud-server-53a23364ef5184d049674e50447c2a0fbe8be72a.zip
Added empty content message for empty read-only folders
-rw-r--r--apps/files/js/filelist.js3
-rw-r--r--apps/files/templates/list.php2
-rw-r--r--apps/files/tests/js/filelistSpec.js9
-rw-r--r--apps/files_sharing/js/public.js7
4 files changed, 16 insertions, 5 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 9d60e77b0ac..0181acab596 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 02137c7e446..32651b261da 100644
--- a/apps/files/templates/list.php
+++ b/apps/files/templates/list.php
@@ -54,7 +54,7 @@
<div id="emptycontent" class="hidden">
<div class="icon-folder"></div>
<h2><?php p($l->t('No files in here')); ?></h2>
- <p><?php p($l->t('Upload some content or sync with your devices!')); ?></p>
+ <p class="uploadmessage hidden"><?php p($l->t('Upload some content or sync with your devices!')); ?></p>
</div>
<div class="nofilterresults emptycontent hidden">
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index 153cbe52c10..aa44c92792d 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -87,7 +87,8 @@ describe('OCA.Files.FileList tests', function() {
'<tbody id="fileList"></tbody>' +
'<tfoot></tfoot>' +
'</table>' +
- '<div id="emptycontent">Empty content message</div>' +
+ // TODO: move to handlebars template
+ '<div id="emptycontent"><h2>Empty content message</h2><p class="uploadmessage">Upload message</p></div>' +
'<div class="nofilterresults hidden"></div>' +
'</div>'
);
@@ -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 bec43a4fb57..41bfeba031f 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 = '';