diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-07-12 09:56:46 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-07-12 16:49:39 +0200 |
commit | ae86845062e6bf303799c8ff52fd997db6cd22ab (patch) | |
tree | 5ac103df2b7eb4e5087886790c3a75469c58f627 /apps | |
parent | 5bac9693511ca0e9e5f0553ecc8791cccf05c935 (diff) | |
download | nextcloud-server-ae86845062e6bf303799c8ff52fd997db6cd22ab.tar.gz nextcloud-server-ae86845062e6bf303799c8ff52fd997db6cd22ab.zip |
Fixed favorite folder view display
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/js/app.js | 4 | ||||
-rw-r--r-- | apps/files/js/navigation.js | 17 | ||||
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 11 | ||||
-rw-r--r-- | apps/files/templates/appnavigation.php | 2 |
4 files changed, 21 insertions, 13 deletions
diff --git a/apps/files/js/app.js b/apps/files/js/app.js index ec223e418b7..d407c49ea51 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -239,8 +239,8 @@ var params; if (e && e.itemId) { params = { - view: e.itemId, - dir: '/' + view: e.view !== '' ? e.view : e.itemId, + dir: e.dir ? e.dir : '/' }; this._changeUrl(params.view, params.dir); OC.Apps.hideAppSidebar($('.detailsView')); diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js index 207f9b1c206..d783fcc2156 100644 --- a/apps/files/js/navigation.js +++ b/apps/files/js/navigation.js @@ -111,33 +111,40 @@ * @param array options "silent" to not trigger event */ setActiveItem: function (itemId, options) { + var currentItem = this.$el.find('li[data-id=' + itemId + ']'); + var itemDir = currentItem.data('dir'); + var itemView = currentItem.data('view'); var oldItemId = this._activeItem; if (itemId === this._activeItem) { if (!options || !options.silent) { this.$el.trigger( new $.Event('itemChanged', { itemId: itemId, - previousItemId: oldItemId + previousItemId: oldItemId, + dir: itemDir, + view: itemView }) ); } return; } - this.$el.find('li').removeClass('active'); + this.$el.find('li a').removeClass('active'); if (this.$currentContent) { this.$currentContent.addClass('hidden'); this.$currentContent.trigger(jQuery.Event('hide')); } this._activeItem = itemId; - this.$el.find('li[data-id=' + itemId + ']').addClass('active'); - this.$currentContent = $('#app-content-' + itemId); + currentItem.children('a').addClass('active'); + this.$currentContent = $('#app-content-' + (itemView !== '' ? itemView : itemId)); this.$currentContent.removeClass('hidden'); if (!options || !options.silent) { this.$currentContent.trigger(jQuery.Event('show')); this.$el.trigger( new $.Event('itemChanged', { itemId: itemId, - previousItemId: oldItemId + previousItemId: oldItemId, + dir: itemDir, + view: itemView }) ); } diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 4035837459a..2e91c83ee83 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -181,15 +181,16 @@ class ViewController extends Controller { $navBarPositionPosition = 6; $currentCount = 0; - foreach ($favElements['folders'] as $elem) { + foreach ($favElements['folders'] as $dir) { - $id = substr($elem, strrpos($elem, '/') + 1, strlen($elem)); - $link = $this->urlGenerator->linkToRoute('files.view.index', ['dir' => $elem, 'view' => 'files']); + $id = substr($dir, strrpos($dir, '/') + 1, strlen($dir)); + $link = $this->urlGenerator->linkToRoute('files.view.index', ['dir' => $dir, 'view' => 'files']); $sortingValue = ++$currentCount; - $element = [ - 'id' => $id, + 'id' => str_replace('/', '-', $dir), + 'view' => 'files', 'href' => $link, + 'dir' => $dir, 'order' => $navBarPositionPosition, 'folderPosition' => $sortingValue, 'name' => $id, diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index a3267ab8c1a..176af0d4c25 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -67,7 +67,7 @@ function NavigationListElements($item, $l, $pinned) { strpos($item['classes'], 'pinned') !== false ? $pinned++ : ''; ?> <li <?php if (isset($item['sublist'])){ ?>id="button-collapse-parent-<?php p($item['id']); ?>"<?php } ?> - data-id="<?php p($item['id']) ?> " + data-id="<?php p($item['id']) ?>" data-dir="<?php p($item['dir']) ?>" data-view="<?php p($item['view']) ?>" class="nav-<?php p($item['id']) ?> <?php p($item['classes']) ?> <?php p($pinned === 1 ? 'first-pinned' : '') ?> <?php if ($item['defaultExpandedState']) { ?> open<?php } ?>" <?php if (isset($item['folderPosition'])) { ?> folderposition="<?php p($item['folderPosition']); ?>" <?php } ?>> |