Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to reverse image sort by default #43

Merged

Conversation

mschader
Copy link
Contributor

@mschader mschader commented Oct 1, 2022

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 called DEFAULT_REVERSE_SORT which when set to 1 will add the liquid reverse filter to the images array assignment inside the index.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.

Previously, the images where sorted based on when they were taken
from newest to oldest image. This is not alway the wished behaviour
as discussed in waschinski#42. Therefore this commit will add a new option in
the .env file which when set will reverse the images upon assignment
@JesseRiemens
Copy link

I tried this, works well for me! Thanks for thinking up a better solution, this indeed works better since no reversing is done after loading.

@waschinski
Copy link
Owner

Thank you for the PR, Markus!

A new release including it will probably have to wait until I am back from vacation though.

@waschinski waschinski merged commit b4a41dc into waschinski:master Oct 3, 2022
@waschinski waschinski mentioned this pull request Oct 3, 2022
pull bot pushed a commit to OrangeCatSleepless/photo-stream that referenced this pull request Mar 18, 2023
…default

Add option to reverse image sort by default

Former-commit-id: b4a41dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants