diff options
Diffstat (limited to 'apps/files/js/recentfilelist.js')
-rw-r--r-- | apps/files/js/recentfilelist.js | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/apps/files/js/recentfilelist.js b/apps/files/js/recentfilelist.js deleted file mode 100644 index 248f1c11c62..00000000000 --- a/apps/files/js/recentfilelist.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc. - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -// HACK: this piece needs to be loaded AFTER the files app (for unit tests) -window.addEventListener('DOMContentLoaded', function () { - (function (OCA) { - /** - * @class OCA.Files.RecentFileList - * @augments OCA.Files.RecentFileList - * - * @classdesc Recent file list. - * Displays the list of recently modified files - * - * @param $el container element with existing markup for the .files-controls - * and a table - * @param [options] map of options, see other parameters - */ - var RecentFileList = function ($el, options) { - options.sorting = { - mode: 'mtime', - direction: 'desc' - }; - this.initialize($el, options); - this._allowSorting = false; - }; - RecentFileList.prototype = _.extend({}, OCA.Files.FileList.prototype, - /** @lends OCA.Files.RecentFileList.prototype */ { - id: 'recent', - appName: t('files', 'Recent'), - - _clientSideSort: true, - _allowSelection: false, - - /** - * @private - */ - initialize: function () { - OCA.Files.FileList.prototype.initialize.apply(this, arguments); - if (this.initialized) { - return; - } - OC.Plugins.attach('OCA.Files.RecentFileList', this); - }, - - updateEmptyContent: function () { - var dir = this.getCurrentDirectory(); - if (dir === '/') { - // root has special permissions - this.$el.find('.emptyfilelist.emptycontent').toggleClass('hidden', !this.isEmpty); - this.$el.find('.files-filestable thead th').toggleClass('hidden', this.isEmpty); - } - else { - OCA.Files.FileList.prototype.updateEmptyContent.apply(this, arguments); - } - }, - - getDirectoryPermissions: function () { - return OC.PERMISSION_READ | OC.PERMISSION_DELETE; - }, - - updateStorageStatistics: function () { - // no op because it doesn't have - // storage info like free space / used space - }, - - reload: function () { - this.showMask(); - if (this._reloadCall?.abort) { - this._reloadCall.abort(); - } - - // there is only root - this._setCurrentDir('/', false); - - this._reloadCall = $.ajax({ - url: OC.generateUrl('/apps/files/api/v1/recent'), - type: 'GET', - dataType: 'json' - }); - var callBack = this.reloadCallback.bind(this); - return this._reloadCall.then(callBack, callBack); - }, - - reloadCallback: function (result) { - delete this._reloadCall; - this.hideMask(); - - if (result.files) { - this.setFiles(result.files.sort(this._sortComparator)); - return true; - } - return false; - } - }); - - OCA.Files.RecentFileList = RecentFileList; - })(OCA); -}); - |