diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-09-27 19:03:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-27 19:03:26 +0200 |
commit | f875a81a07524b540e7607c270529d9f3e8f101b (patch) | |
tree | 43153aaf6b2ca104d34abd6e63cb05f51991859d /apps | |
parent | 657f2e87e471d68a352786dc83d1f7e823c7554e (diff) | |
parent | 848a8c8c592c651356339fdb1b252dc393587d95 (diff) | |
download | nextcloud-server-f875a81a07524b540e7607c270529d9f3e8f101b.tar.gz nextcloud-server-f875a81a07524b540e7607c270529d9f3e8f101b.zip |
Merge pull request #34292 from nextcloud/bugfix/33847/fix-gridview-publicpage
Fix grid view button in public page
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/js/public.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 6c68490aef5..9b0f4421360 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -62,6 +62,11 @@ OCA.Sharing.PublicApp = { // file list mode ? if ($el.find('.files-filestable').length) { + // Toggle for grid view + this.$showGridView = $('input#showgridview'); + this.$showGridView.on('change', _.bind(this._onGridviewChange, this)); + $('#view-toggle').tooltip({placement: 'bottom', trigger: 'hover'}); + var filesClient = new OC.Files.Client({ host: OC.getHost(), port: OC.getPort(), @@ -364,6 +369,26 @@ OCA.Sharing.PublicApp = { } }, + /** + * Toggle showing gridview by default or not + * + * @returns {undefined} + */ + _onGridviewChange: function() { + const isGridView = this.$showGridView.is(':checked'); + this.$showGridView.next('#view-toggle') + .removeClass('icon-toggle-filelist icon-toggle-pictures') + .addClass(isGridView ? 'icon-toggle-filelist' : 'icon-toggle-pictures') + this.$showGridView.next('#view-toggle').attr( + 'data-original-title', + isGridView ? t('files', 'Show list view') : t('files', 'Show grid view'), + ) + + if (this.fileList) { + this.fileList.setGridView(isGridView); + } + }, + _onDirectoryChanged: function (e) { OC.Util.History.pushState({ // arghhhh, why is this not called "dir" !? |