Fix grid toggle button on public page

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2019-01-11 13:37:30 +01:00
parent 10388eab34
commit ee2c45d60d
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
2 changed files with 11 additions and 7 deletions

View File

@ -361,6 +361,7 @@ class ShareController extends AuthPublicShareController {
$folder->assign('isPublic', true);
$folder->assign('hideFileList', $hideFileList);
$folder->assign('publicUploadEnabled', 'no');
// default to list view
$folder->assign('showgridview', false);
$folder->assign('uploadMaxFilesize', $maxUploadFilesize);
$folder->assign('uploadMaxHumanFilesize', \OCP\Util::humanFileSize($maxUploadFilesize));
@ -372,6 +373,7 @@ class ShareController extends AuthPublicShareController {
$shareIsFolder = false;
}
// default to list view
$shareTmpl['showgridview'] = false;
$shareTmpl['hideFileList'] = $hideFileList;

View File

@ -46,14 +46,16 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
</div>
<?php endif; ?>
<?php if ($_['showgridview'] && empty($_['dir']) === false) { ?>
<?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) { ?>
<!-- ONLY if this is a folder, we show the grid toggle button -->
<?php if (empty($_['dir']) === false) { ?>
<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>
<?php } ?>
<?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) { ?>
<!-- files listing -->
<div id="files-public-content">
<div id="preview">
<?php if (isset($_['folder'])): ?>