summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorfnuesse <felix.nuesse@t-online.de>2018-06-27 00:35:28 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-07-12 16:49:38 +0200
commit55ebdc9344dc8edb665491bf89595f406cfc4d62 (patch)
tree23bdc47aea07adf307dc70718d427acb17eb3e92 /apps/files
parent9b914bd68dc53d5fe5ac98e9bbeb3b8da436096e (diff)
downloadnextcloud-server-55ebdc9344dc8edb665491bf89595f406cfc4d62.tar.gz
nextcloud-server-55ebdc9344dc8edb665491bf89595f406cfc4d62.zip
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>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/js/navigation.js25
-rw-r--r--apps/files/js/tagsplugin.js10
-rw-r--r--apps/files/lib/Controller/ViewController.php6
-rw-r--r--apps/files/templates/appnavigation.php14
4 files changed, 34 insertions, 21 deletions
diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js
index b83cd82128c..799e265bdff 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 7729a540d32..853874f4e83 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 7a07df678b2..82f9ea000af 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 56a84edf3b6..1302225c919 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++ : '';
?>
<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>