Add option to reverse image sort by default #43
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
first of all thank you for this project, I really like the minimal approach of the gallery which take away the need for a bloated backend, user management or database. I just started using the project and stumbled upon the exact issue mentioned in Issue #42. The proposed JS "hack" worked kinda wonky for me and at least in Safari I had some quick sort-changes during loading the page and it did not always end up in the correct sort order I intended. Therefore I would like to propose the change in this MR.
This MR will add a new variable in the
.env
file calledDEFAULT_REVERSE_SORT
which when set to 1 will add the liquid reverse filter to the images array assignment inside theindex.html
. This allows the templates to stay clean of any filters, keeping the logic in the index file without the need to change the JavaScript which might behave different for each browser.This change was tested with both variable values set using the docker-compose file building locally and it worked at least on my machine as intended.
Let me know if you see any improvements which can be done to that approach or if you want any other variable naming.