From b201121e62a09518ab21ab7fd2733af8de85c75c Mon Sep 17 00:00:00 2001 From: GretaD Date: Fri, 28 Feb 2020 15:27:31 +0100 Subject: Fix default action for deleted shares Signed-off-by: GretaD Signed-off-by: npmbuildbot[bot] --- apps/files/js/filelist.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'apps/files/js/filelist.js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 2ca4185ec86..9973c92c8ec 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -130,6 +130,14 @@ */ dirInfo: null, + /** + * Whether to prevent or to execute the default file actions when the + * file name is clicked. + * + * @type boolean + */ + _defaultFileActionsDisabled: false, + /** * File actions handler, defaults to OCA.Files.FileActions * @type OCA.Files.FileActions @@ -292,6 +300,10 @@ this._detailsView.$el.addClass('disappear'); } + if (options && options.defaultFileActionsDisabled) { + this._defaultFileActionsDisabled = options.defaultFileActionsDisabled + } + this._initFileActions(options.fileActions); if (this._detailsView) { @@ -876,7 +888,9 @@ if (!this._detailsView || $(event.target).is('.nametext, .name, .thumbnail') || $(event.target).closest('.nametext').length) { var filename = $tr.attr('data-file'); var renaming = $tr.data('renaming'); - if (!renaming) { + if (this._defaultFileActionsDisabled) { + event.preventDefault(); + } else if (!renaming) { this.fileActions.currentFile = $tr.find('td'); var mime = this.fileActions.getCurrentMimeType(); var type = this.fileActions.getCurrentType(); @@ -1524,6 +1538,11 @@ "class": "name", "href": linkUrl }); + if (this._defaultFileActionsDisabled) { + linkElem = $('

').attr({ + "class": "name" + }) + } linkElem.append('
'); -- cgit v1.2.3