Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #14376 from nextcloud/backport/13514/stable15
[stable15] Fix grid toggle button on public page
  • Loading branch information
MorrisJobke committed Feb 28, 2019
2 parents aac2669 + 6d744ef commit 92d0c28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions apps/files_sharing/lib/Controller/ShareController.php
Expand Up @@ -360,6 +360,7 @@ public function showShare($path = ''): TemplateResponse {
$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));
Expand All @@ -371,6 +372,7 @@ public function showShare($path = ''): TemplateResponse {
$shareIsFolder = false;
}

// default to list view
$shareTmpl['showgridview'] = false;

$shareTmpl['hideFileList'] = $hideFileList;
Expand Down
16 changes: 9 additions & 7 deletions apps/files_sharing/templates/public.php
Expand Up @@ -46,14 +46,16 @@
</div>
<?php endif; ?>

<?php if ($_['showgridview'] && 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)) { ?>
<!-- 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 } ?>

<!-- files listing -->
<div id="files-public-content">
<div id="preview">
<?php if (isset($_['folder'])): ?>
Expand Down

0 comments on commit 92d0c28

Please sign in to comment.