mirror of
https://github.com/nextcloud/server.git
synced 2024-08-24 17:55:37 +02:00
Change tooltip title of files grid view toggle dynamically
Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
parent
ec465bf247
commit
f5236cde1a
@ -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();
|
||||
|
@ -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">
|
||||
|
@ -52,7 +52,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
|
||||
<input type="checkbox" class="hidden-visually" id="showgridview"
|
||||
<?php if ($_['showgridview']) { ?>checked="checked" <?php } ?>/>
|
||||
<label id="view-toggle" for="showgridview" 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 } ?>
|
||||
|
||||
<!-- files listing -->
|
||||
@ -83,8 +83,8 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
|
||||
<?php p($l->t('Download'))?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($_['previewURL'] === $_['downloadURL'] && !$_['hideDownload']): ?>
|
||||
<div class="directDownload">
|
||||
|
Loading…
Reference in New Issue
Block a user