Added empty content message for empty read-only folders
This commit is contained in:
parent
b0fcf0fa0e
commit
53a23364ef
4 changed files with 16 additions and 5 deletions
|
@ -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);
|
||||
},
|
||||
/**
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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 = '';
|
||||
|
|
Loading…
Reference in a new issue