From f828b51ede75ef25db3859156691fb582b76fe39 Mon Sep 17 00:00:00 2001 From: kondou Date: Sat, 12 Oct 2013 17:28:20 +0200 Subject: [PATCH 1/6] Hide files list header, when theres no files to see --- apps/files/index.php | 6 +++++- apps/files/js/filelist.js | 3 +++ apps/files/templates/index.php | 8 ++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/files/index.php b/apps/files/index.php index 8d877be8ac..7db3fd9638 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -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(); } diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index a929799677..7a0cfa8325 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -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){ diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 32a59f1e1a..af9cdffa5a 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -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' )); ?> From 60b25a2e975c6824b3d5a5d4c14960a253aaa705 Mon Sep 17 00:00:00 2001 From: kondou Date: Sun, 20 Oct 2013 22:47:44 +0200 Subject: [PATCH 2/6] Create FileList.updateEmptyContent() and fix not showing emptycontent after deletion --- apps/files/js/filelist.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 7a0cfa8325..5d1b797ab5 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -7,12 +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); - $('#filestable th').toggleClass('hidden', !(!isCreatable || $fileList.find('tr').length > 0)); + FileList.updateEmptyContent(); $fileList.find('tr').each(function () { FileActions.display($(this).children('td.filename')); }); @@ -508,6 +505,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"); @@ -621,6 +619,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', !(!isCreatable || $fileList.find('tr').length > 0)); + }, showMask: function(){ // in case one was shown before var $mask = $('#content .mask'); From 40cc57ab3e34a99ec28485fd76a7b052b0da17aa Mon Sep 17 00:00:00 2001 From: kondou Date: Sun, 20 Oct 2013 22:55:49 +0200 Subject: [PATCH 3/6] Improve updateEmptyContent logic --- apps/files/js/filelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 5d1b797ab5..9b66a2e69a 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -624,7 +624,7 @@ var 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', !(!isCreatable || $fileList.find('tr').length > 0)); + $('#filestable th').toggleClass('hidden', isCreatable && $fileList.find('tr').length === 0); }, showMask: function(){ // in case one was shown before From 7864a3bf07fab1183bc003e771ee365fc1376c73 Mon Sep 17 00:00:00 2001 From: kondou Date: Mon, 21 Oct 2013 17:41:03 +0200 Subject: [PATCH 4/6] Fix shared folder still showing fileheader --- apps/files/index.php | 2 +- apps/files/js/filelist.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/files/index.php b/apps/files/index.php index 7db3fd9638..22240deadc 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -119,7 +119,7 @@ if ($needUpgrade) { } $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/'); - $emptyContent = (!isset($files) or !$isCreatable or count($files) > 0 or $ajaxLoad); + $emptyContent = (!isset($files) or count($files) > 0 or $ajaxLoad); OCP\Util::addscript('files', 'fileactions'); OCP\Util::addscript('files', 'files'); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 9b66a2e69a..20930b2dce 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -623,8 +623,8 @@ var FileList={ 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', isCreatable && $fileList.find('tr').length === 0); + $('#emptycontent').toggleClass('hidden', $fileList.find('tr').length > 0); + $('#filestable th').toggleClass('hidden', $fileList.find('tr').length === 0); }, showMask: function(){ // in case one was shown before From 732e7db31902e88e4ca6582c56af14b5e3d2bc39 Mon Sep 17 00:00:00 2001 From: kondou Date: Mon, 21 Oct 2013 19:49:09 +0200 Subject: [PATCH 5/6] Fix mind-boggling emptycontent logic --- apps/files/index.php | 4 +++- apps/files/js/filelist.js | 2 +- apps/files/templates/index.php | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/files/index.php b/apps/files/index.php index 22240deadc..c2c0ba02a9 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -119,7 +119,8 @@ if ($needUpgrade) { } $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/'); - $emptyContent = (!isset($files) or count($files) > 0 or $ajaxLoad); + $fileHeader = (!isset($files) or count($files) > 0); + $emptyContent = $isCreatable or $fileHeader or $ajaxLoad; OCP\Util::addscript('files', 'fileactions'); OCP\Util::addscript('files', 'files'); @@ -145,6 +146,7 @@ if ($needUpgrade) { $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 20930b2dce..17e7fb6440 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -623,7 +623,7 @@ var FileList={ var $fileList = $('#fileList'); var permissions = $('#permissions').val(); var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0; - $('#emptycontent').toggleClass('hidden', $fileList.find('tr').length > 0); + $('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0); $('#filestable th').toggleClass('hidden', $fileList.find('tr').length === 0); }, showMask: function(){ diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index af9cdffa5a..c1373c3e9d 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -42,14 +42,14 @@ -
class="hidden">t('Nothing in here. Upload something!'))?>
+
class="hidden">t('Nothing in here. Upload something!'))?>
- - - +
class="hidden" id='headerName'> + class="hidden" id='headerName'>
@@ -65,8 +65,8 @@
class="hidden" id="headerSize">t('Size')); ?>class="hidden" id="headerDate"> + class="hidden" id="headerSize">t('Size')); ?>class="hidden" id="headerDate"> t( 'Modified' )); ?> From d1c27e08e56562c7b522c43d1f1b485ee9f1cd77 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 21 Oct 2013 22:18:10 +0200 Subject: [PATCH 6/6] Fixed empty content logic - Remove obsolete code that used another approach for hiding emptycontent - Fixed logic for the showing of the empty content message --- apps/files/index.php | 2 +- apps/files/templates/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/index.php b/apps/files/index.php index c2c0ba02a9..0b56d9c19a 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -120,7 +120,7 @@ if ($needUpgrade) { $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/'); $fileHeader = (!isset($files) or count($files) > 0); - $emptyContent = $isCreatable or $fileHeader or $ajaxLoad; + $emptyContent = ($isCreatable and !$fileHeader) or $ajaxLoad; OCP\Util::addscript('files', 'fileactions'); OCP\Util::addscript('files', 'files'); diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index c1373c3e9d..5a686da43f 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -1,6 +1,6 @@