diff --git a/apps/files/css/files.scss b/apps/files/css/files.scss index 579cf36e15b7b..5f32916650dea 100644 --- a/apps/files/css/files.scss +++ b/apps/files/css/files.scss @@ -108,6 +108,10 @@ .nav-icon-trashbin { background-image: url('../img/delete.svg?v=1'); } +/* no icon for the quota bar */ +.nav-icon-quota { + padding-left: 15px !important; +} #app-navigation .nav-files a.nav-icon-files { width: auto; @@ -747,3 +751,37 @@ table.dragshadow td.size { #filestable tbody tr.canDrop { background-color: rgba(255, 255, 140, 1); } + + +#quota { + margin: 0 !important; + border: none; + border-radius: 0; + position: fixed !important; + bottom: 44px; + width: inherit !important; + background-color: #fff; + border-right: 1px solid #eee; + z-index:1; + + .quota-container { + height: 5px; + border-radius: 3px; + + div { + height: 100%; + background-color: $color-primary; + } + } +} + +/* increase the padding of the last item to not hide below the quota item */ +.app-files #app-navigation > ul li:nth-last-child(1) { + margin-bottom: 44px; +} + +#quotatext { + padding: 0; + height: 30px; + line-height: 30px; +} diff --git a/apps/files/js/app.js b/apps/files/js/app.js index d46a0b8f9df6e..47011d23f4424 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: 'top' + }); + this._debouncedPersistShowHiddenFilesState = _.debounce(this._persistShowHiddenFilesState, 1200); }, diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js index 83cd556c89afd..d213d0467b625 100644 --- a/apps/files/js/navigation.js +++ b/apps/files/js/navigation.js @@ -123,7 +123,9 @@ _onClickItem: function(ev) { var $target = $(ev.target); var itemId = $target.closest('li').attr('data-id'); - this.setActiveItem(itemId); + if (!_.isUndefined(itemId)) { + this.setActiveItem(itemId); + } ev.preventDefault(); } }; diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index f7a4318e59549..bfeb2cafcf6d4 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -41,6 +41,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use OCP\Files\Folder; use OCP\App\IAppManager; +use Symfony\Component\EventDispatcher\GenericEvent; /** * Class ViewController @@ -174,6 +175,17 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal }); $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 @@ -188,7 +200,8 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal $contentItems[] = $contentItem; } - $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts'); + $event = new GenericEvent(null, ['hiddenFields' => []]); + $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts', $event); $params = []; $params['usedSpacePercent'] = (int)$storageInfo['relative']; @@ -204,6 +217,7 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal $params['fileNotFound'] = $fileNotFound ? 1 : 0; $params['appNavigation'] = $nav; $params['appContents'] = $contentItems; + $params['hiddenFields'] = $event->getArgument('hiddenFields'); $response = new TemplateResponse( $this->appName, diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index 9c79f8067131f..bbd78079d395d 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -1,5 +1,23 @@