Fix collapsible-Button when list was emptied (or got first element)
Signed-off-by: fnuesse <felix.nuesse@t-online.de> Fixed Bad url-generation in javascript for new quickaccessitems Signed-off-by: fnuesse <felix.nuesse@t-online.de> Fixed vertical scrolling in sortable-list which leads to "hidden" navbar Signed-off-by: fnuesse <felix.nuesse@t-online.de> Removed unnessessary console logs Signed-off-by: fnuesse <felix.nuesse@t-online.de> Fixed Bounds in custom sorting Signed-off-by: fnuesse <felix.nuesse@t-online.de> Reformatted code Signed-off-by: fnuesse <felix.nuesse@t-online.de> Fixed horizontalscroll on sortable-list Fixed "stuck element" where you could not switch back to the original ordering in the sortable-list Signed-off-by: fnuesse <felix.nuesse@t-online.de>
This commit is contained in:
parent
9b914bd68d
commit
55ebdc9344
|
@ -163,9 +163,25 @@
|
|||
*/
|
||||
_setOnDrag: function () {
|
||||
var scope=this;
|
||||
var element = $("#sublist-favorites");
|
||||
$(function () {
|
||||
if (document.getElementById(scope.$quickAccessListKey.toString()).hasAttribute("draggable")) {
|
||||
$("#sublist-favorites").sortable({
|
||||
element.sortable({
|
||||
axis: "y",
|
||||
containment: "parent",
|
||||
scroll: false,
|
||||
zIndex: 0,
|
||||
opacity: 0.5,
|
||||
delay: 150,
|
||||
tolerance: "pointer",
|
||||
start:function(event, ui){
|
||||
//Fix for offset
|
||||
ui.helper[0].style.left ='0px';
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
//Clean up offset
|
||||
ui.item.removeAttr("style");
|
||||
},
|
||||
update: function (event, ui) {
|
||||
var list = document.getElementById(scope.$quickAccessListKey.toString()).getElementsByTagName('li');
|
||||
var string=[];
|
||||
|
@ -174,7 +190,6 @@
|
|||
string.push(Object);
|
||||
}
|
||||
var resultorder=JSON.stringify(string);
|
||||
console.log(resultorder);
|
||||
$.get(OC.generateUrl("/apps/files/api/v1/quickaccess/set/CustomSortingOrder"),{
|
||||
order: resultorder}, function (data, status) {});
|
||||
}
|
||||
|
@ -262,9 +277,7 @@
|
|||
} else if (this.$sortingStrategy === 'customorder') {
|
||||
var scope = this;
|
||||
$.get(OC.generateUrl("/apps/files/api/v1/quickaccess/get/CustomSortingOrder"), function (data, status) {
|
||||
console.log("load order:");
|
||||
var ordering=JSON.parse(data)
|
||||
console.log(ordering);
|
||||
var ordering=JSON.parse(data);
|
||||
for (var i = 0; i < ordering.length; i++) {
|
||||
for (var j = 0; j < list.length; j++) {
|
||||
if (scope.getCompareValue(list, j, 'alphabet').toLowerCase() === ordering[i].name.toLowerCase()) {
|
||||
|
@ -341,7 +354,7 @@
|
|||
if (strategy === 'alphabet') {
|
||||
return nodes[int].getElementsByTagName('a')[0].innerHTML.toLowerCase();
|
||||
} else if (strategy === 'date') {
|
||||
return nodes[int].getAttribute('folderPos').toLowerCase();
|
||||
return nodes[int].getAttribute('folderPosition').toLowerCase();
|
||||
} else if (strategy === 'datemodified') {
|
||||
return nodes[int].getAttribute('mtime');
|
||||
}else if (strategy === 'customorder') {
|
||||
|
|
|
@ -82,9 +82,9 @@
|
|||
}
|
||||
|
||||
if (listULElements.childElementCount === 0) {
|
||||
var collapsibleButton = document.getElementById(collapsibleButtonId);
|
||||
var collapsibleButton = document.getElementById("button-collapse-favorites");
|
||||
collapsibleButton.style.display = 'none';
|
||||
$("#favorites-toggle").removeClass('collapsible');
|
||||
$("#button-collapse-parent-favorites").removeClass('collapsible');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,13 +102,13 @@
|
|||
var appName = appfolder.substring(appfolder.lastIndexOf("/") + 1, appfolder.length);
|
||||
|
||||
var innerTagA = document.createElement('A');
|
||||
innerTagA.setAttribute("href", "/cloud/index.php/apps/files/?dir=" + appfolder);
|
||||
innerTagA.setAttribute("href", OC.generateUrl('/apps/files/?dir=') + appfolder);
|
||||
innerTagA.setAttribute("class", "nav-icon-files svg");
|
||||
innerTagA.innerHTML = appName;
|
||||
|
||||
var length = listLIElements.length + 1;
|
||||
var innerTagLI = document.createElement('li');
|
||||
innerTagLI.setAttribute("data-id", "/cloud/index.php/apps/files/?dir=" + appfolder);
|
||||
innerTagLI.setAttribute("data-id", OC.generateUrl('/apps/files/?dir=') + appfolder);
|
||||
innerTagLI.setAttribute("class", "nav-" + appName);
|
||||
innerTagLI.setAttribute("folderpos", length.toString());
|
||||
innerTagLI.appendChild(innerTagA);
|
||||
|
@ -119,7 +119,7 @@
|
|||
var collapsibleButton = document.getElementById(collapsibleButtonId);
|
||||
collapsibleButton.style.display = '';
|
||||
|
||||
$("#favorites-toggle").addClass('collapsible');
|
||||
$("#button-collapse-parent-favorites").addClass('collapsible');
|
||||
} else {
|
||||
listLIElements[listLIElements.length - 1].after(innerTagLI);
|
||||
}
|
||||
|
|
|
@ -202,9 +202,9 @@ class ViewController extends Controller {
|
|||
}
|
||||
|
||||
|
||||
$defaultExpandedState='true';
|
||||
if(!$this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', 1)){
|
||||
$defaultExpandedState='false';
|
||||
$defaultExpandedState = 'true';
|
||||
if (!$this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', 1)) {
|
||||
$defaultExpandedState = 'false';
|
||||
}
|
||||
|
||||
\OCA\Files\App::getNavigationManager()->add(
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
$pinned = 0;
|
||||
foreach ($_['navigationItems'] as $item) {
|
||||
$pinned = NavigationListElements($item, $pinned, $l);
|
||||
$pinned = NavigationListElements($item, $l, $pinned);
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -58,18 +58,18 @@
|
|||
* Prints the HTML for a single Entry.
|
||||
*
|
||||
* @param $item The item to be added
|
||||
* @param $pinned IntegerValue to count the pinned entries at the bottom
|
||||
* @param $l Translator
|
||||
* @param $pinned IntegerValue to count the pinned entries at the bottom
|
||||
*
|
||||
* @return int Returns the pinned value
|
||||
*/
|
||||
function NavigationListElements($item, $pinned, $l) {
|
||||
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(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['defaultExpandedState'] === 'true') { ?> open<?php } ?>"
|
||||
<?php if (isset($item['folderPosition'])) { ?> folderPos="<?php p($item['folderPosition']); ?>" <?php } ?>>
|
||||
<?php if (isset($item['folderPosition'])) { ?> folderposition="<?php p($item['folderPosition']); ?>" <?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>
|
||||
|
@ -80,11 +80,11 @@ function NavigationListElements($item, $pinned, $l) {
|
|||
if (isset($item['sublist'])) {
|
||||
?>
|
||||
<button id="button-collapse-<?php p($item['id']); ?>"
|
||||
class="collapse"></button>
|
||||
<ul id="sublist-<?php p($item['id']); ?>" <?php if ($item['draggableSublist'] === 'true') { ?> draggable="true"<?php } ?>>
|
||||
class="collapse" <?php if (sizeof($item['sublist']) == 0) { ?> style="display: none" <?php } ?>></button>
|
||||
<ul id="sublist-<?php p($item['id']); ?>" <?php if ($item['draggableSublist'] === 'true') { ?> draggable="true" style="resize: none;"<?php } ?>>
|
||||
<?php
|
||||
foreach ($item['sublist'] as $item) {
|
||||
$pinned = NavigationListElements($item, $pinned, $l);
|
||||
$pinned = NavigationListElements($item, $l, $pinned);
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue