diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-07-17 12:53:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-17 12:53:45 +0200 |
commit | a155f804859d4afc579986be6472dfd80ade267d (patch) | |
tree | 123031de8298ea99346c9f905155d37766955af0 /apps/files/js | |
parent | f78db1820138df0a097399f088057c1b0682ec98 (diff) | |
parent | cdb42432c3a58efc24f59d9a4bb453288f346eab (diff) | |
download | nextcloud-server-a155f804859d4afc579986be6472dfd80ade267d.tar.gz nextcloud-server-a155f804859d4afc579986be6472dfd80ade267d.zip |
Merge pull request #10230 from nextcloud/feature/shareoverview
Feature/shares overview
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/navigation.js | 26 | ||||
-rw-r--r-- | apps/files/js/tagsplugin.js | 33 |
2 files changed, 20 insertions, 39 deletions
diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js index d4fa06cb45e..8ce976a6f53 100644 --- a/apps/files/js/navigation.js +++ b/apps/files/js/navigation.js @@ -172,30 +172,18 @@ */ _onClickMenuButton: function (ev) { var $target = $(ev.target); + var $menu = $target.parent('li'); var itemId = $target.closest('button').attr('id'); var collapsibleToggles = []; var dotmenuToggles = []; - // The collapsibleToggles-Array consists of a list of Arrays. Every subarray must contain the Button to listen to at the 0th index, - // and the parent, which should be toggled at the first arrayindex. - collapsibleToggles.push(["#button-collapse-favorites", "#button-collapse-parent-favorites"]); - - // The dotmenuToggles-Array consists of a list of Arrays. Every subarray must contain the Button to listen to at the 0th index, - // and the parent, which should be toggled at the first arrayindex. - dotmenuToggles.push(["#dotmenu-button-favorites", "dotmenu-content-favorites"]); - - collapsibleToggles.forEach(function foundToggle (item) { - if (item[0] === ("#" + itemId)) { - $(item[1]).toggleClass('open'); - var show = 1; - if (!$(item[1]).hasClass('open')) { - show = 0; - } - $.get(OC.generateUrl("/apps/files/api/v1/quickaccess/set/showList"), {show: show}, function (data, status) { - }); - } - }); + if ($menu.hasClass('collapsible') && $menu.data('expandedstate')) { + $menu.toggleClass('open'); + var show = $menu.hasClass('open') ? 1 : 0; + var key = $menu.data('expandedstate'); + $.post(OC.generateUrl("/apps/files/api/v1/toggleShowFolder/" + key), {show: show}); + } dotmenuToggles.forEach(function foundToggle (item) { if (item[0] === ("#" + itemId)) { diff --git a/apps/files/js/tagsplugin.js b/apps/files/js/tagsplugin.js index bc1396b5104..4ce6604384d 100644 --- a/apps/files/js/tagsplugin.js +++ b/apps/files/js/tagsplugin.js @@ -68,29 +68,22 @@ * @param {String} appfolder folder to be removed */ function removeFavoriteFromList (appfolder) { - var quickAccessList = 'sublist-favorites'; - var collapsibleButtonId = 'button-collapse-favorites'; var listULElements = document.getElementById(quickAccessList); if (!listULElements) { return; } - var listLIElements = listULElements.getElementsByTagName('li'); var apppath=appfolder; if(appfolder.startsWith("//")){ apppath=appfolder.substring(1, appfolder.length); } - for (var i = 0; i <= listLIElements.length - 1; i++) { - if (listLIElements[i].getElementsByTagName('a')[0].href.endsWith("dir=" + apppath)) { - listLIElements[i].remove(); - } - } + $(listULElements).find('[data-dir="' + apppath + '"]').remove(); if (listULElements.childElementCount === 0) { - var collapsibleButton = document.getElementById("button-collapse-favorites"); - collapsibleButton.style.display = 'none'; + var collapsibleButton = $(listULElements).parent().find('button.collapse'); + collapsibleButton.hide(); $("#button-collapse-parent-favorites").removeClass('collapsible'); } } @@ -102,7 +95,6 @@ */ function addFavoriteToList (appfolder) { var quickAccessList = 'sublist-favorites'; - var collapsibleButtonId = 'button-collapse-favorites'; var listULElements = document.getElementById(quickAccessList); if (!listULElements) { return; @@ -110,13 +102,13 @@ var listLIElements = listULElements.getElementsByTagName('li'); var appName = appfolder.substring(appfolder.lastIndexOf("/") + 1, appfolder.length); - var apppath=appfolder; + var apppath = appfolder; if(appfolder.startsWith("//")){ - apppath=appfolder.substring(1, appfolder.length); + apppath = appfolder.substring(1, appfolder.length); } - var url=OC.generateUrl('/apps/files/?dir=')+apppath; - + var url = OC.generateUrl('/apps/files/?dir=' + apppath + '&view=files'); + var innerTagA = document.createElement('A'); innerTagA.setAttribute("href", url); @@ -125,7 +117,9 @@ var length = listLIElements.length + 1; var innerTagLI = document.createElement('li'); - innerTagLI.setAttribute("data-id", url); + innerTagLI.setAttribute("data-id", apppath.replace('/', '-')); + innerTagLI.setAttribute("data-dir", apppath); + innerTagLI.setAttribute("data-view", 'files'); innerTagLI.setAttribute("class", "nav-" + appName); innerTagLI.setAttribute("folderpos", length.toString()); innerTagLI.appendChild(innerTagA); @@ -134,10 +128,9 @@ if (data === "dir") { if (listULElements.childElementCount <= 0) { listULElements.appendChild(innerTagLI); - var collapsibleButton = document.getElementById(collapsibleButtonId); - collapsibleButton.style.display = ''; - - $("#button-collapse-parent-favorites").addClass('collapsible'); + var collapsibleButton = $(listULElements).parent().find('button.collapse'); + collapsibleButton.show(); + $(listULElements).parent().addClass('collapsible'); } else { listLIElements[listLIElements.length - 1].after(innerTagLI); } |