From f1da30cc1e39318261fff39ed05b3a571e0a5699 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 8 Jun 2017 16:42:43 +0200 Subject: [PATCH 01/11] Add quota to the files view Signed-off-by: Joas Schilling --- apps/files/css/files.scss | 13 +++++++++++++ apps/files/js/app.js | 4 ++++ apps/files/lib/Controller/ViewController.php | 11 +++++++++++ apps/files/templates/appnavigation.php | 13 +++++++++++++ 4 files changed, 41 insertions(+) diff --git a/apps/files/css/files.scss b/apps/files/css/files.scss index 579cf36e15..9fcc10caf4 100644 --- a/apps/files/css/files.scss +++ b/apps/files/css/files.scss @@ -747,3 +747,16 @@ table.dragshadow td.size { #filestable tbody tr.canDrop { background-color: rgba(255, 255, 140, 1); } + + +#quota { + margin: 0 !important; + border: none; + div { + border-radius: 0; + } +} + +#quotatext { + padding: 3px; +} diff --git a/apps/files/js/app.js b/apps/files/js/app.js index d46a0b8f9d..5f1bf1a7b1 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -108,6 +108,10 @@ // trigger URL change event handlers this._onPopState(urlParams); + $('#quota.has-tooltip').tooltip({ + placement: 'bottom' + }); + this._debouncedPersistShowHiddenFilesState = _.debounce(this._persistShowHiddenFilesState, 1200); }, diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index f7a4318e59..fc59622af8 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -174,6 +174,17 @@ class ViewController extends Controller { }); $nav->assign('navigationItems', $navItems); + + $nav->assign('usage', \OC_Helper::humanFileSize($storageInfo['used'])); + if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) { + $totalSpace = $this->l10n->t('Unlimited'); + } else { + $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']); + } + $nav->assign('total_space', $totalSpace); + $nav->assign('quota', $storageInfo['quota']); + $nav->assign('usage_relative', $storageInfo['relative']); + $contentItems = []; // render the container content for every navigation item diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index 9c79f80671..28019ba803 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -1,4 +1,17 @@
+
+
80): ?>class="quota-warning"> +

t('%s of %s in use', [$_['usage'], $_['total_space']])); ?>

+
+
+