Fixed favorite folder view display

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2018-07-12 09:56:46 +02:00
parent 5bac969351
commit ae86845062
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
5 changed files with 23 additions and 14 deletions

View File

@ -239,8 +239,8 @@
var params; var params;
if (e && e.itemId) { if (e && e.itemId) {
params = { params = {
view: e.itemId, view: e.view !== '' ? e.view : e.itemId,
dir: '/' dir: e.dir ? e.dir : '/'
}; };
this._changeUrl(params.view, params.dir); this._changeUrl(params.view, params.dir);
OC.Apps.hideAppSidebar($('.detailsView')); OC.Apps.hideAppSidebar($('.detailsView'));

View File

@ -111,33 +111,40 @@
* @param array options "silent" to not trigger event * @param array options "silent" to not trigger event
*/ */
setActiveItem: function (itemId, options) { 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; var oldItemId = this._activeItem;
if (itemId === this._activeItem) { if (itemId === this._activeItem) {
if (!options || !options.silent) { if (!options || !options.silent) {
this.$el.trigger( this.$el.trigger(
new $.Event('itemChanged', { new $.Event('itemChanged', {
itemId: itemId, itemId: itemId,
previousItemId: oldItemId previousItemId: oldItemId,
dir: itemDir,
view: itemView
}) })
); );
} }
return; return;
} }
this.$el.find('li').removeClass('active'); this.$el.find('li a').removeClass('active');
if (this.$currentContent) { if (this.$currentContent) {
this.$currentContent.addClass('hidden'); this.$currentContent.addClass('hidden');
this.$currentContent.trigger(jQuery.Event('hide')); this.$currentContent.trigger(jQuery.Event('hide'));
} }
this._activeItem = itemId; this._activeItem = itemId;
this.$el.find('li[data-id=' + itemId + ']').addClass('active'); currentItem.children('a').addClass('active');
this.$currentContent = $('#app-content-' + itemId); this.$currentContent = $('#app-content-' + (itemView !== '' ? itemView : itemId));
this.$currentContent.removeClass('hidden'); this.$currentContent.removeClass('hidden');
if (!options || !options.silent) { if (!options || !options.silent) {
this.$currentContent.trigger(jQuery.Event('show')); this.$currentContent.trigger(jQuery.Event('show'));
this.$el.trigger( this.$el.trigger(
new $.Event('itemChanged', { new $.Event('itemChanged', {
itemId: itemId, itemId: itemId,
previousItemId: oldItemId previousItemId: oldItemId,
dir: itemDir,
view: itemView
}) })
); );
} }

View File

@ -181,15 +181,16 @@ class ViewController extends Controller {
$navBarPositionPosition = 6; $navBarPositionPosition = 6;
$currentCount = 0; $currentCount = 0;
foreach ($favElements['folders'] as $elem) { foreach ($favElements['folders'] as $dir) {
$id = substr($elem, strrpos($elem, '/') + 1, strlen($elem)); $id = substr($dir, strrpos($dir, '/') + 1, strlen($dir));
$link = $this->urlGenerator->linkToRoute('files.view.index', ['dir' => $elem, 'view' => 'files']); $link = $this->urlGenerator->linkToRoute('files.view.index', ['dir' => $dir, 'view' => 'files']);
$sortingValue = ++$currentCount; $sortingValue = ++$currentCount;
$element = [ $element = [
'id' => $id, 'id' => str_replace('/', '-', $dir),
'view' => 'files',
'href' => $link, 'href' => $link,
'dir' => $dir,
'order' => $navBarPositionPosition, 'order' => $navBarPositionPosition,
'folderPosition' => $sortingValue, 'folderPosition' => $sortingValue,
'name' => $id, 'name' => $id,

View File

@ -67,7 +67,7 @@ function NavigationListElements($item, $l, $pinned) {
strpos($item['classes'], 'pinned') !== false ? $pinned++ : ''; strpos($item['classes'], 'pinned') !== false ? $pinned++ : '';
?> ?>
<li <?php if (isset($item['sublist'])){ ?>id="button-collapse-parent-<?php p($item['id']); ?>"<?php } ?> <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 } ?>" 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 } ?>> <?php if (isset($item['folderPosition'])) { ?> folderposition="<?php p($item['folderPosition']); ?>" <?php } ?>>

View File

@ -148,7 +148,8 @@ kbd {
a:hover, a:hover,
a:focus, a:focus,
a:active, a:active,
a.selected { a.selected ,
a.active {
&, &,
> a { > a {
opacity: 1; opacity: 1;