]> source.dussan.org Git - nextcloud-server.git/commitdiff
Hide files list header, when theres no files to see
authorkondou <kondou@ts.unde.re>
Sat, 12 Oct 2013 15:28:20 +0000 (17:28 +0200)
committerkondou <kondou@ts.unde.re>
Sat, 12 Oct 2013 15:28:20 +0000 (17:28 +0200)
apps/files/index.php
apps/files/js/filelist.js
apps/files/templates/index.php

index 8d877be8ac981a9a2f0ffb6e4861dcf8ed6653d7..7db3fd96380c29aea0a307035426961a780df6d1 100644 (file)
@@ -118,6 +118,9 @@ if ($needUpgrade) {
                $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user);
        }
 
+       $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/');
+       $emptyContent = (!isset($files) or !$isCreatable or count($files) > 0 or $ajaxLoad);
+
        OCP\Util::addscript('files', 'fileactions');
        OCP\Util::addscript('files', 'files');
        OCP\Util::addscript('files', 'keyboardshortcuts');
@@ -125,7 +128,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);
@@ -141,6 +144,7 @@ if ($needUpgrade) {
        $tmpl->assign("encryptionInitStatus", $encryptionInitStatus);
        $tmpl->assign('disableSharing', false);
        $tmpl->assign('ajaxLoad', $ajaxLoad);
+       $tmpl->assign('emptyContent', $emptyContent);
 
        $tmpl->printPage();
 }
index a9297996778c867bc01e71572566436b8d10de30..7a0cfa83255c41a196c2f1b2d92d195b0ce5260a 100644 (file)
@@ -12,6 +12,7 @@ var FileList={
                        isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0;
                $fileList.empty().html(fileListHtml);
                $('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0);
+               $('#filestable th').toggleClass('hidden', !(!isCreatable || $fileList.find('tr').length > 0));
                $fileList.find('tr').each(function () {
                        FileActions.display($(this).children('td.filename'));
                });
@@ -257,6 +258,7 @@ var FileList={
                FileList.updateFileSummary();
                if($('tr[data-file]').length==0){
                        $('#emptycontent').removeClass('hidden');
+                       $('#filescontent th').addClass('hidden');
                }
        },
        insertElement:function(name,type,element){
@@ -287,6 +289,7 @@ var FileList={
                        $('#fileList').append(element);
                }
                $('#emptycontent').addClass('hidden');
+               $('#filestable th').removeClass('hidden');
                FileList.updateFileSummary();
        },
        loadingDone:function(name, id){
index 32a59f1e1a6a03e6b9687a6c73355ef18e6e05d8..af9cdffa5a3df689c10714556eb02f21e047e165 100644 (file)
        <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 (!$_['emptyContent']):?>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 (!$_['emptyContent']):?>class="hidden"<?php endif; ?> id="headerSize"><?php p($l->t('Size')); ?></th>
+                       <th <?php if (!$_['emptyContent']):?>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 -->