Merge pull request #5310 from owncloud/hide_filestable-header_when_empty
Hide files list header, when theres no files to see
This commit is contained in:
commit
70c0d7d6bc
|
@ -118,6 +118,10 @@ if ($needUpgrade) {
|
|||
$trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user);
|
||||
}
|
||||
|
||||
$isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/');
|
||||
$fileHeader = (!isset($files) or count($files) > 0);
|
||||
$emptyContent = ($isCreatable and !$fileHeader) or $ajaxLoad;
|
||||
|
||||
OCP\Util::addscript('files', 'fileactions');
|
||||
OCP\Util::addscript('files', 'files');
|
||||
OCP\Util::addscript('files', 'keyboardshortcuts');
|
||||
|
@ -125,7 +129,7 @@ if ($needUpgrade) {
|
|||
$tmpl->assign('fileList', $list->fetchPage());
|
||||
$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage());
|
||||
$tmpl->assign('dir', \OC\Files\Filesystem::normalizePath($dir));
|
||||
$tmpl->assign('isCreatable', \OC\Files\Filesystem::isCreatable($dir . '/'));
|
||||
$tmpl->assign('isCreatable', $isCreatable);
|
||||
$tmpl->assign('permissions', $permissions);
|
||||
$tmpl->assign('files', $files);
|
||||
$tmpl->assign('trash', $trashEnabled);
|
||||
|
@ -142,6 +146,8 @@ if ($needUpgrade) {
|
|||
$tmpl->assign("encryptionInitStatus", $encryptionInitStatus);
|
||||
$tmpl->assign('disableSharing', false);
|
||||
$tmpl->assign('ajaxLoad', $ajaxLoad);
|
||||
$tmpl->assign('emptyContent', $emptyContent);
|
||||
$tmpl->assign('fileHeader', $fileHeader);
|
||||
|
||||
$tmpl->printPage();
|
||||
}
|
||||
|
|
|
@ -7,11 +7,9 @@ var FileList={
|
|||
});
|
||||
},
|
||||
update:function(fileListHtml) {
|
||||
var $fileList = $('#fileList'),
|
||||
permissions = $('#permissions').val(),
|
||||
isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0;
|
||||
var $fileList = $('#fileList');
|
||||
$fileList.empty().html(fileListHtml);
|
||||
$('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0);
|
||||
FileList.updateEmptyContent();
|
||||
$fileList.find('tr').each(function () {
|
||||
FileActions.display($(this).children('td.filename'));
|
||||
});
|
||||
|
@ -282,6 +280,7 @@ var FileList={
|
|||
FileList.updateFileSummary();
|
||||
if($('tr[data-file]').length==0){
|
||||
$('#emptycontent').removeClass('hidden');
|
||||
$('#filescontent th').addClass('hidden');
|
||||
}
|
||||
},
|
||||
insertElement:function(name,type,element){
|
||||
|
@ -312,6 +311,7 @@ var FileList={
|
|||
$('#fileList').append(element);
|
||||
}
|
||||
$('#emptycontent').addClass('hidden');
|
||||
$('#filestable th').removeClass('hidden');
|
||||
FileList.updateFileSummary();
|
||||
},
|
||||
loadingDone:function(name, id){
|
||||
|
@ -530,6 +530,7 @@ var FileList={
|
|||
procesSelection();
|
||||
checkTrashStatus();
|
||||
FileList.updateFileSummary();
|
||||
FileList.updateEmptyContent();
|
||||
} else {
|
||||
$.each(files,function(index,file) {
|
||||
var deleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date").children(".action.delete");
|
||||
|
@ -643,6 +644,13 @@ var FileList={
|
|||
}
|
||||
}
|
||||
},
|
||||
updateEmptyContent: function(){
|
||||
var $fileList = $('#fileList');
|
||||
var permissions = $('#permissions').val();
|
||||
var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0;
|
||||
$('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0);
|
||||
$('#filestable th').toggleClass('hidden', $fileList.find('tr').length === 0);
|
||||
},
|
||||
showMask: function(){
|
||||
// in case one was shown before
|
||||
var $mask = $('#content .mask');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div id="controls">
|
||||
<?php print_unescaped($_['breadcrumb']); ?>
|
||||
<div class="actions creatable <?php if (!$_['isCreatable']):?>hidden<?php endif; ?> <?php if (isset($_['files']) and count($_['files'])==0):?>emptycontent<?php endif; ?>">
|
||||
<div class="actions creatable <?php if (!$_['isCreatable']):?>hidden<?php endif; ?>">
|
||||
<div id="new" class="button">
|
||||
<a><?php p($l->t('New'));?></a>
|
||||
<ul>
|
||||
|
@ -42,14 +42,14 @@
|
|||
<input type="hidden" name="permissions" value="<?php p($_['permissions']); ?>" id="permissions">
|
||||
</div>
|
||||
|
||||
<div id="emptycontent" <?php if (!isset($_['files']) or !$_['isCreatable'] or count($_['files']) > 0 or $_['ajaxLoad']):?>class="hidden"<?php endif; ?>><?php p($l->t('Nothing in here. Upload something!'))?></div>
|
||||
<div id="emptycontent" <?php if (!$_['emptyContent']):?>class="hidden"<?php endif; ?>><?php p($l->t('Nothing in here. Upload something!'))?></div>
|
||||
|
||||
<input type="hidden" id="disableSharing" data-status="<?php p($_['disableSharing']); ?>"></input>
|
||||
|
||||
<table id="filestable" data-allow-public-upload="<?php p($_['publicUploadEnabled'])?>" data-preview-x="36" data-preview-y="36">
|
||||
<thead>
|
||||
<tr>
|
||||
<th id='headerName'>
|
||||
<th <?php if (!$_['fileHeader']):?>class="hidden"<?php endif; ?> id='headerName'>
|
||||
<div id="headerName-container">
|
||||
<input type="checkbox" id="select_all" />
|
||||
<label for="select_all"></label>
|
||||
|
@ -65,8 +65,8 @@
|
|||
</span>
|
||||
</div>
|
||||
</th>
|
||||
<th id="headerSize"><?php p($l->t('Size')); ?></th>
|
||||
<th id="headerDate">
|
||||
<th <?php if (!$_['fileHeader']):?>class="hidden"<?php endif; ?> id="headerSize"><?php p($l->t('Size')); ?></th>
|
||||
<th <?php if (!$_['fileHeader']):?>class="hidden"<?php endif; ?> id="headerDate">
|
||||
<span id="modified"><?php p($l->t( 'Modified' )); ?></span>
|
||||
<?php if ($_['permissions'] & OCP\PERMISSION_DELETE): ?>
|
||||
<!-- NOTE: Temporary fix to allow unsharing of files in root of Shared folder -->
|
||||
|
|
Loading…
Reference in New Issue