piwigo-bootstrap-darkroom icon indicating copy to clipboard operation
piwigo-bootstrap-darkroom copied to clipboard

How to force List/Grid views?

Open EdoFede opened this issue 5 years ago • 3 comments

Hi,

The view setting (List/Grid) seems to be used as global setting, so if I browse categories in List mode, also the thunbnail are browsed in List mode.

Is there a way to force List view in Categories/Index pages and Grid view in Thumbnails pages in the code?

I'm not practical in piwigo programming structure and I was unable to find a way to do it. (In my case, since I use description in albums but no texts in photos, I'll disable also the change view bottons)

Thanks in advance.

EdoFede avatar Apr 27 '19 09:04 EdoFede

Hi, any way to force List view in categories/index and Grid view in thumbnails?

Thanks in advance

EdoFede avatar Aug 26 '19 07:08 EdoFede

There is currently no way to set this separately.

tkuther avatar Sep 08 '19 16:09 tkuther

Ok thank you anyway.

In case others need to do the same, I describe the workaround I implemented (although not really beautiful) to have this functionality.

I've modified the footer.tpl file, adding at the bottom (just before the

statement) a simple javascript code that runs on page load and triggers (with a little delay) the grid/list view buttons, depending of the presence of the slideshow icon (which appears in Thumbnails page).

    <script type="text/javascript">
        $("document").ready(function() {
            setTimeout(function() {
                document.getElementById('btn-grid').click();
            },10);
        });
    </script>
{else}
    <script type="text/javascript">
        $("document").ready(function() {
            setTimeout(function() {
                document.getElementById('btn-list').click();
            },10);
        });
    </script>
{/if}```

With this workaround, all index and categories pages appears in list view and all thumbnails pages appear in grid view.

EdoFede avatar Sep 11 '19 20:09 EdoFede