aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2022-07-04 19:20:49 +0000
committerChristopher Ng <chrng8@gmail.com>2022-07-04 19:20:49 +0000
commitf5236cde1a2b9ec87794768568155344fa3a4461 (patch)
treef44a68d86d87621d1c7ae30826e76ccf84706492 /apps/files
parentec465bf247ec2e9fd3df13f6a289ecc5fb6e4e2a (diff)
downloadnextcloud-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')
-rw-r--r--apps/files/js/filelist.js14
-rw-r--r--apps/files/templates/index.php2
2 files changed, 10 insertions, 6 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();
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php
index 0d95f2694d9..e12d9fafab3 100644
--- a/apps/files/templates/index.php
+++ b/apps/files/templates/index.php
@@ -6,7 +6,7 @@
aria-label="<?php p($l->t('Toggle grid view'))?>"
<?php if ($_['showgridview']) { ?>checked="checked" <?php } ?>/>
<label id="view-toggle" for="showgridview" tabindex="0" class="button <?php p($_['showgridview'] ? 'icon-toggle-filelist' : 'icon-toggle-pictures') ?>"
- title="<?php p($l->t('Toggle grid view'))?>"></label>
+ title="<?php p($_['showgridview'] ? $l->t('Show list view') : $l->t('Show grid view'))?>"></label>
<?php foreach ($_['appContents'] as $content) { ?>
<div id="app-content-<?php p($content['id']) ?>" class="hidden viewcontainer">