diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-10-04 15:14:15 +0200 |
---|---|---|
committer | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2018-10-18 13:44:07 +0200 |
commit | c4cce1413487f5a0e870dd2139a4c624a97981fd (patch) | |
tree | 29fbd6c36d3ca8de130f37d9ce8b6ca376347eb0 /apps/files/js/filelist.js | |
parent | 49fda8ba56860918d2e424ca07c94c08237846d4 (diff) | |
download | nextcloud-server-c4cce1413487f5a0e870dd2139a4c624a97981fd.tar.gz nextcloud-server-c4cce1413487f5a0e870dd2139a4c624a97981fd.zip |
Remember toggle and events handler
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 441b8f0a12f..357b1b06016 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -328,7 +328,8 @@ this.$el.find('thead th .columntitle').click(_.bind(this._onClickHeader, this)); // Toggle for grid view - $('#view-toggle').on('click', this._onGridToggle); + this.$showGridView = $('input#showgridview'); + this.$showGridView.on('change', _.bind(this._onGridviewChange, this)); this._onResize = _.debounce(_.bind(this._onResize, this), 250); $('#app-content').on('appresized', this._onResize); @@ -591,10 +592,20 @@ }, /** - * Event handler for grid view toggle + * Toggle showing gridview by default or not + * + * @returns {undefined} */ - _onGridToggle: function() { - $('.list-container').toggleClass('view-grid'); + _onGridviewChange: function() { + var show = this.$showGridView.is(':checked'); + $.post(OC.generateUrl('/apps/files/api/v1/showgridview'), { + show: show + }); + this.$showGridView.next('#view-toggle') + .removeClass('icon-toggle-filelist icon-toggle-pictures') + .addClass(show ? 'icon-toggle-filelist' : 'icon-toggle-pictures') + + $('.list-container').toggleClass('view-grid', show); }, /** |