diff --git a/apps/files/index.php b/apps/files/index.php index 2f1e084560..f0f95b3bac 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -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(); } diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 39b27ec9f3..85bdd50971 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -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'); diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 001adb77ab..2e88bf2dbb 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -1,6 +1,6 @@
-
+
t('New'));?>
    @@ -42,14 +42,14 @@
-
0 or $_['ajaxLoad']):?>class="hidden">t('Nothing in here. Upload something!'))?>
+
class="hidden">t('Nothing in here. Upload something!'))?>
- - - +
+ class="hidden" id='headerName'>
@@ -65,8 +65,8 @@
t('Size')); ?> + class="hidden" id="headerSize">t('Size')); ?>class="hidden" id="headerDate"> t( 'Modified' )); ?>