diff options
author | Christopher Ng <chrng8@gmail.com> | 2022-07-04 19:20:49 +0000 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2022-07-04 19:20:49 +0000 |
commit | f5236cde1a2b9ec87794768568155344fa3a4461 (patch) | |
tree | f44a68d86d87621d1c7ae30826e76ccf84706492 /apps/files/js | |
parent | ec465bf247ec2e9fd3df13f6a289ecc5fb6e4e2a (diff) | |
download | nextcloud-server-f5236cde1a2b9ec87794768568155344fa3a4461.tar.gz nextcloud-server-f5236cde1a2b9ec87794768568155344fa3a4461.zip |
Change tooltip title of files grid view toggle dynamically
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/filelist.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 714e66e53ed..19b746ec847 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -748,19 +748,23 @@ * @returns {undefined} */ _onGridviewChange: function() { - var show = this.$showGridView.is(':checked'); + const isGridView = this.$showGridView.is(':checked'); // only save state if user is logged in if (OC.currentUser) { $.post(OC.generateUrl('/apps/files/api/v1/showgridview'), { - show: show + show: isGridView, }); } this.$showGridView.next('#view-toggle') .removeClass('icon-toggle-filelist icon-toggle-pictures') - .addClass(show ? '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'), + ) - $('.list-container').toggleClass('view-grid', show); - if (show) { + $('.list-container').toggleClass('view-grid', isGridView); + if (isGridView) { // If switching into grid view from list view, too few files might be displayed // Try rendering the next page this._onScroll(); |