Browse Source

Add quota to the files view

Signed-off-by: Joas Schilling <coding@schilljs.com>
tags/v13.0.0beta1
Joas Schilling 7 years ago
parent
commit
0554dba69e
No account linked to committer's email address

+ 13
- 0
apps/files/css/files.scss View File

@@ -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;
}

+ 4
- 0
apps/files/js/app.js View File

@@ -108,6 +108,10 @@
// trigger URL change event handlers
this._onPopState(urlParams);

$('#quota.has-tooltip').tooltip({
placement: 'bottom'
});

this._debouncedPersistShowHiddenFilesState = _.debounce(this._persistShowHiddenFilesState, 1200);
},


+ 11
- 0
apps/files/lib/Controller/ViewController.php View File

@@ -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

+ 13
- 0
apps/files/templates/appnavigation.php View File

@@ -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']) ?>">

Loading…
Cancel
Save