diff options
-rw-r--r-- | apps/files/js/navigation.js | 18 | ||||
-rw-r--r-- | apps/files/js/tagsplugin.js | 10 | ||||
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 7 | ||||
-rw-r--r-- | apps/files/templates/appnavigation.php | 5 |
4 files changed, 33 insertions, 7 deletions
diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js index 04c9143581c..f7757751b8f 100644 --- a/apps/files/js/navigation.js +++ b/apps/files/js/navigation.js @@ -146,11 +146,17 @@ var qaSelector= '#quickaccess-list'; if(itemId==='button-collapseQuickAccess'){ + + document.getElementById('enableQuickAccess').checked=!document.getElementById('enableQuickAccess').checked; $.get(OC.generateUrl("/apps/files/api/v1/showquickaccess"), {show: document.getElementById('enableQuickAccess').checked}, function(data, status){ }); - $("#quickaccess-list" ).toggle('open'); - var dotmenu = document.getElementById("quickaccess-list"); - dotmenu.style.display=''; + + if(!$("#favorites-toggle" ).hasClass('open')){ + $("#favorites-toggle" ).addClass('open'); + }else{ + $("#favorites-toggle" ).removeClass('open'); + } + } if(itemId==='button-favorites'){ @@ -173,7 +179,11 @@ if(itemId==='enableQuickAccess' ){ $.get(OC.generateUrl("/apps/files/api/v1/showquickaccess"), {show: document.getElementById('enableQuickAccess').checked}, function(data, status){ }); - $(qaSelector).toggle('open'); + if(!$("#favorites-toggle" ).hasClass('open')){ + $("#favorites-toggle" ).addClass('open'); + }else{ + $("#favorites-toggle" ).removeClass('open'); + } document.getElementById('menu-favorites').classList.toggle('open'); } diff --git a/apps/files/js/tagsplugin.js b/apps/files/js/tagsplugin.js index 8cdc26ab3bb..ce35f8bcdfd 100644 --- a/apps/files/js/tagsplugin.js +++ b/apps/files/js/tagsplugin.js @@ -83,6 +83,11 @@ if(listUL.childElementCount==0){ var dotmenu = document.getElementById("quickaccessbutton"); dotmenu.style.display='none'; + + var collapsibleButton = document.getElementById("button-collapseQuickAccess"); + collapsibleButton.style.display='none'; + + $("#favorites-toggle" ).removeClass('collapsible'); } } @@ -115,6 +120,11 @@ listUL.appendChild(li); var dotmenu = document.getElementById("quickaccessbutton"); dotmenu.style.display=''; + + var collapsibleButton = document.getElementById("button-collapseQuickAccess"); + collapsibleButton.style.display=''; + + $("#favorites-toggle" ).addClass('collapsible'); }else{ list[list.length-1].after(li); } diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index c218063f979..b427178ec57 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -184,12 +184,17 @@ class ViewController extends Controller { $FavoritesFolderCount=sizeof($favElements['folders']); + $collapsClasses=''; + if($FavoritesFolderCount>0){ + $collapsClasses='collapsible'; + } + \OCA\Files\App::getNavigationManager()->add( [ 'id' => 'favorites', 'appname' => 'files', 'script' => 'simplelist.php', - 'classes' => 'collapsible', + 'classes' => $collapsClasses, 'enableQuickaccess' => $expanded, 'quickaccessSortingStrategy' => $sorting, 'quickaccessSortingReverse' => $reverseListSetting, diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index 5f1baafaf8a..f88bf7866f4 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -8,10 +8,11 @@ <li data-id="<?php p(isset($item['href']) ? $item['href'] : $item['id']) ?>" class="nav-<?php p($item['id']) ?> <?php p($item['classes']) ?> <?php p($pinned===1?'first-pinned':'') ?> <?php if($item['enableQuickaccess']=='true'){ ?> open<?php } ?>" - <?php if(isset($item['folderPosition'])){ ?> folderPos="<?php p($item['folderPosition']);?>"<?php } ?>> + <?php if(isset($item['folderPosition'])){ ?> folderPos="<?php p($item['folderPosition']);?>"<?php } ?> + <?php if($item['id']=='favorites'){?>id="favorites-toggle"<?php } ?>> <?php if($item['id']=='favorites'){?> - <button id="button-collapseQuickAccess" class="collapse"></button><?php } ?> + <button id="button-collapseQuickAccess" class="collapse" <?php if($item['favoritescount']==0){ ?> style="display: none"<?php } ?>></button><?php } ?> <a href="<?php p(isset($item['href']) ? $item['href'] : '#') ?>" class="nav-icon-<?php p($item['icon'] !== '' ? $item['icon'] : $item['id']) ?> svg"><?php p($item['name']);?></a> |