Hi!
I’m running into an issue with files sorting in a gallery section on the panel side. I spent a while reading threads around manual sorting and the attribution of the sort number, so far without luck.
The website in question is an artist’s portfolio with a single files-section as gallery (with list view), used to display images on the main page. The sorting is (hopefully) on its default manual mode and the client needs to freely arrange and rearrange her images through the panel. The files of the gallery are displayed in two places on the panel: on the main page and on the paintings page.
The bug was triggered when the number of files in the section exceeded 20 and a second page was created in the gallery view. Using “change position” on a single file then led to a reset of the sorting of all files, except the selected file. I noticed afterwards that the number of the position didn’t reflect the current value of the sort field.
So as a summary:
– The drag & drop correctly affects the sort number in the .txt file and on the page
– In the panel gallery view, the “change position” select field doesn’t seem to get updated
– Using it resets all previously done manual sorting, and sorts files by filename instead (except on the one selected file, which does reach the intended position)
In the meantime I’ve set the limit of the gallery to a random 300, so the drag & drop stays available and the client can go on building her page. I would advise her to write down her sort pattern somewhere and not use the “change position” function for the moment.
I would love to know where this comes from (maybe something missing in my blueprints? do I need an additional blueprint for the gallery as section?) and/or if there’s a cleaner way to fix it. Thanks for reading and sorry if the message’s a little messy!
In paintings.yml:
columns:
- width: 1/2
sections:
galerie:
type: files
headline: Images
layout: list
template: images
limit: 300
info: "{{ file.year.toDate('m.Y') }}"
In site.yml:
columns:
- width: 1/2
sections:
paintings:
type: files
headline: Peintures
parent: site.find("paintings")
layout: list
template: images
limit: 300
info: "{{ file.year.toDate('m.Y') }}"
In paintings.php:
<?php foreach($page->files()->sortBy('sort') as $file): ?>
“Change position” select menu displaying “7” for a file showing up in third position in the list and on the website, with a sort field “3” in its text file.