From 78891ac320c1b5613d71464a3211cd87ec393e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 27 Dec 2017 16:17:00 +0100 Subject: [PATCH 1/2] Fix selectors for file list elements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the checkbox was moved to where the favourite icon was shown before the layout of the file list was modified. The first column is no longer the file name, so neither the thumbnail nor the name link were found. Due to this the thumbnail was not set to the appropriate icon, and the dummy event handler was not removed from the name link, so clicks on the name were basically ignored. Now the selectors are based on the ".filename" CSS class instead of relying on the column position. Signed-off-by: Daniel Calviño Sánchez --- apps/files_external/js/statusmanager.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/files_external/js/statusmanager.js b/apps/files_external/js/statusmanager.js index 6c1a965c33dd5..3850351d21315 100644 --- a/apps/files_external/js/statusmanager.js +++ b/apps/files_external/js/statusmanager.js @@ -489,7 +489,7 @@ OCA.External.StatusManager.Utils = { } }); - var icon = trFolder.find('td:first-child div.thumbnail'); + var icon = trFolder.find('td.filename div.thumbnail'); icon.each(function () { var thisElement = $(this); if (thisElement.data('oldImage') === undefined) { @@ -510,7 +510,7 @@ OCA.External.StatusManager.Utils = { trFolder = $('#fileList tr[data-file=\"' + OCA.External.StatusManager.Utils.jqSelEscape(folder) + '\"]'); } trFolder.removeClass('externalErroredRow').removeClass('externalDisabledRow'); - var tdChilds = trFolder.find("td:first-child div.thumbnail"); + var tdChilds = trFolder.find("td.filename div.thumbnail"); tdChilds.each(function () { var thisElement = $(this); thisElement.css('background-image', thisElement.data('oldImage')); @@ -529,10 +529,10 @@ OCA.External.StatusManager.Utils = { $.each(filename, function (index) { route = OCA.External.StatusManager.Utils.getIconRoute($(this)); $(this).attr("data-icon", route); - $(this).find('td:first-child div.thumbnail').css('background-image', "url(" + route + ")").css('display', 'none').css('display', 'inline'); + $(this).find('td.filename div.thumbnail').css('background-image', "url(" + route + ")").css('display', 'none').css('display', 'inline'); }); } else { - file = $("#fileList tr[data-file=\"" + this.jqSelEscape(filename) + "\"] > td:first-child div.thumbnail"); + file = $("#fileList tr[data-file=\"" + this.jqSelEscape(filename) + "\"] > td.filename div.thumbnail"); var parentTr = file.parents('tr:first'); route = OCA.External.StatusManager.Utils.getIconRoute(parentTr); parentTr.attr("data-icon", route); @@ -573,7 +573,7 @@ OCA.External.StatusManager.Utils = { if (filename instanceof $) { link = filename; } else { - link = $("#fileList tr[data-file=\"" + this.jqSelEscape(filename) + "\"] > td:first-child a.name"); + link = $("#fileList tr[data-file=\"" + this.jqSelEscape(filename) + "\"] > td.filename a.name"); } if (active) { link.off('click.connectivity'); From 11125164bee4a2130f5adc4808b3f92c892a6138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 27 Dec 2017 16:31:22 +0100 Subject: [PATCH 2/2] Disable selection in "External storages" file list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the checkbox was moved to where the favourite icon was shown before the layout of the file list was modified. The checkbox is no longer a descendant of the ".filename" element, so it is no longer removed by the "External storages" file list. However, even before the checkbox was moved, explicitly removing it was not the best approach, as file list rows could still be selected using "Ctrl/Shift+click". This did not provide much value, as the selection header has no actions; it simply states the number of selected elements. The proper way to disable the selection is by setting "_allowSelection" to false in the file list instead. Signed-off-by: Daniel Calviño Sánchez --- apps/files_external/js/mountsfilelist.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/files_external/js/mountsfilelist.js b/apps/files_external/js/mountsfilelist.js index 3beee6f73b245..90b90e38745f4 100644 --- a/apps/files_external/js/mountsfilelist.js +++ b/apps/files_external/js/mountsfilelist.js @@ -30,6 +30,8 @@ /** @lends OCA.External.FileList.prototype */ { appName: 'External storages', + _allowSelection: false, + /** * @private */ @@ -56,7 +58,6 @@ $scopeColumn.find('span').text(scopeText); $backendColumn.text(fileData.backend); $tr.find('td.filename').after($scopeColumn).after($backendColumn); - $tr.find('td.filename input:checkbox').remove(); return $tr; },