aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-06-08 16:42:43 +0200
committerLukas Reschke <lukas@statuscode.ch>2017-06-13 11:17:42 +0200
commit0554dba69eeb7caff308caf914331e80ed14380c (patch)
tree363ba815db5daea25fa396e204d798cafd8711f2 /apps
parentc46422b780621d5ac700e7ca2f6ddf7b1386482f (diff)
downloadnextcloud-server-0554dba69eeb7caff308caf914331e80ed14380c.tar.gz
nextcloud-server-0554dba69eeb7caff308caf914331e80ed14380c.zip
Add quota to the files view
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/css/files.scss13
-rw-r--r--apps/files/js/app.js4
-rw-r--r--apps/files/lib/Controller/ViewController.php11
-rw-r--r--apps/files/templates/appnavigation.php13
4 files changed, 41 insertions, 0 deletions
diff --git a/apps/files/css/files.scss b/apps/files/css/files.scss
index 579cf36e15b..9fcc10caf46 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 d46a0b8f9df..5f1bf1a7b1e 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 f7a4318e595..fc59622af89 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 9c79f806713..28019ba803d 100644
--- a/apps/files/templates/appnavigation.php
+++ b/apps/files/templates/appnavigation.php
@@ -1,4 +1,17 @@
<div id="app-navigation">
+ <div id="quota" class="section has-tooltip" title="<?php
+ if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
+ p($l->t('You are using %s of %s', [$_['usage'], $_['total_space']]));
+ } else {
+ p($l->t('You are using %s of %s (%s %%)', [$_['usage'], $_['total_space'], $_['usage_relative']]));
+ }
+ ?>">
+ <div style="width:<?php p($_['usage_relative']);?>%"
+ <?php if($_['usage_relative'] > 80): ?>class="quota-warning"<?php endif; ?>>
+ <p id="quotatext"><?php p($l->t('%s of %s in use', [$_['usage'], $_['total_space']])); ?></p>
+ </div>
+ </div>
+
<ul class="with-icon">
<?php foreach ($_['navigationItems'] as $item) { ?>
<li data-id="<?php p($item['id']) ?>" class="nav-<?php p($item['id']) ?>">