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

custom sorting method for a single directory #177

Closed
kolydart opened this issue Sep 2, 2020 · 8 comments
Closed

custom sorting method for a single directory #177

kolydart opened this issue Sep 2, 2020 · 8 comments

Comments

@kolydart
Copy link

kolydart commented Sep 2, 2020

First of all, thanks for the great package. It is really helpful and has given to me and my family many happy moments.

Feature description
I'm trying to figure out a way to apply custom sorting method on root directory. For me, the most obvious way to browse a picture gallery is having the latest folders on top in the root directory and the files/folder inside each folder sorted by ascending date.

Proposed solution
A specific directory should have a way to override the general settings for sorting methods. I think the best (simplest) way would be by having a hidden file (ex. .order_descending_name).

More info on my solution
I have all my pictures in folders with prepending date, (ex. 2010.09.02 John's wedding). Sorting the root directory by descending name is the absolutely best approach for the gallery root; recent events are on top.
But, if I set that method to settings, photos inside each folder are in reverse order, having the latest on top, which is not helpful.

Thanks

@bpatrik
Copy link
Owner

bpatrik commented Sep 6, 2020

Hi,

I'm not sure if I fully understand your request.
Would you like to have:

  1. Sort subfolders descending and photos ascending in the same folder?
  2. Sort one folder descending and photos ascending in a separate folder?

For 1) I'm not sire if I would like to add this complexity to my app. You can convince me if an other photo does it in a elegant way.
For 2) That should be mostly possible now too. You can have a default sorting setting and override that in the individual folders.

@kolydart
Copy link
Author

kolydart commented Sep 6, 2020

Case 2 was what I was talking about. Sorting by "ascending date" as default (inside each folder under root) and "descending name" in a single folder as override (root only).
I was not aware it can be done.

So, how can I permanently override a specific folder's sorting?
If I change a folder's sorting method using the upper right dropdown button (button#button-alignment) and visit the same folder in another browser, the sorting order is back to the default.

thank you!

@bpatrik
Copy link
Owner

bpatrik commented Sep 6, 2020

yes, the sorting is stored in the browser's cache, so in a different browser is gets back to the default value.

Unfortunately there is no permanent way of doing this currently.

@kolydart
Copy link
Author

kolydart commented Sep 6, 2020

So, would there be any chance of implementing it?
Or using some js code to do it?

@bpatrik bpatrik closed this as completed in 73a8c42 Sep 6, 2020
@bpatrik
Copy link
Owner

bpatrik commented Sep 6, 2020

Alright. I had some time and added this functionality. :) Here you can see how it works:

'.order_descending_name.pg2conf': SortingMethods.descName,
'.order_ascending_name.pg2conf': SortingMethods.ascName,
'.order_descending_date.pg2conf': SortingMethods.descDate,
'.order_ascending_date.pg2conf': SortingMethods.ascDate,
'.order_random.pg2conf': SortingMethods.random

Basically, you add an empty file like .order_descending_name.pg2conf to a folder and that overrides the default sorting for that folder.

@kolydart
Copy link
Author

kolydart commented Sep 6, 2020

that was fantastic!
thanks!

ehusby pushed a commit to ehusby/pigallery2 that referenced this issue Nov 29, 2020
@Wdavery
Copy link
Contributor

Wdavery commented Apr 15, 2021

Is this recursive to subfolders if they don't have their own .order_*.pg2conf file?

@bpatrik
Copy link
Owner

bpatrik commented Apr 17, 2021

No, it only works in a given folder.

kagahd added a commit to kagahd/pigallery2 that referenced this issue Feb 24, 2023
bpatrik added a commit that referenced this issue Mar 13, 2023
document issue #177 about overriding default sort order
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

No branches or pull requests

3 participants