diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js index b83cd82128..799e265bdf 100644 --- a/apps/files/js/navigation.js +++ b/apps/files/js/navigation.js @@ -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') { diff --git a/apps/files/js/tagsplugin.js b/apps/files/js/tagsplugin.js index 7729a540d3..853874f4e8 100644 --- a/apps/files/js/tagsplugin.js +++ b/apps/files/js/tagsplugin.js @@ -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); } diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 7a07df678b..82f9ea000a 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -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( diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index 56a84edf3b..1302225c91 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -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++ : ''; ?>
  • id="button-collapse-parent-" data-id=" " class="nav- open" - folderPos="" > + folderposition="" > @@ -80,11 +80,11 @@ function NavigationListElements($item, $pinned, $l) { if (isset($item['sublist'])) { ?> -