Fixed css-flashing

Signed-off-by: fnuesse <felix.nuesse@t-online.de>

Fixed menu if initially empty

Signed-off-by: fnuesse <felix.nuesse@t-online.de>
This commit is contained in:
fnuesse 2018-06-18 12:35:20 +02:00 committed by John Molakvoæ (skjnldsv)
parent 9cd4b53a51
commit 60e6ac3b6e
No known key found for this signature in database
GPG key ID: 60C25B8C072916CF
4 changed files with 33 additions and 7 deletions

View file

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

View file

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

View file

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

View file

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