Skip to content

Commit

Permalink
Search: Add sort by Title
Browse files Browse the repository at this point in the history
  • Loading branch information
wsyxbcl authored and lastzero committed May 18, 2024
1 parent 1dc2af4 commit 7e18a41
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions frontend/src/component/album/toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export default {
{ value: "added", text: this.$gettext("Recently Added") },
{ value: "edited", text: this.$gettext("Recently Edited") },
{ value: "name", text: this.$gettext("File Name") },
{ value: "title", text: this.$gettext("Title") },
{ value: "size", text: this.$gettext("File Size") },
{ value: "duration", text: this.$gettext("Video Duration") },
{ value: "relevance", text: this.$gettext("Most Relevant") },
Expand Down
1 change: 1 addition & 0 deletions frontend/src/component/photo/toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ export default {
{ value: "added", text: this.$gettext("Recently Added") },
{ value: "edited", text: this.$gettext("Recently Edited") },
{ value: "name", text: this.$gettext("File Name") },
{ value: "title", text: this.$gettext("Title") },
{ value: "size", text: this.$gettext("File Size") },
{ value: "duration", text: this.$gettext("Video Duration") },
{ value: "relevance", text: this.$gettext("Most Relevant") },
Expand Down
1 change: 1 addition & 0 deletions frontend/src/dialog/album/edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default {
{ value: "added", text: this.$gettext("Recently Added") },
{ value: "edited", text: this.$gettext("Recently Edited") },
{ value: "name", text: this.$gettext("File Name") },
{ value: "title", text: this.$gettext("Title") },
{ value: "size", text: this.$gettext("File Size") },
{ value: "duration", text: this.$gettext("Video Duration") },
{ value: "relevance", text: this.$gettext("Most Relevant") },
Expand Down
2 changes: 2 additions & 0 deletions internal/search/photos.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ func searchPhotos(f form.SearchPhotos, sess *entity.Session, resultCols string)
s = s.Order("photos.photo_color, photos.cell_id, files.file_diff, files.photo_id, files.time_index")
case sortby.Name:
s = s.Order("photos.photo_path, photos.photo_name, files.time_index")
case sortby.Title:
s = s.Order("photos.photo_title, photos.photo_name, files.time_index")
case sortby.Random:
s = s.Order(sortby.RandomExpr(s.Dialect()))
case sortby.Default, sortby.Imported, sortby.Added:
Expand Down
1 change: 1 addition & 0 deletions pkg/sortby/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const (
Favorites = "favorites"
Name = "name"
NameReverse = "name_reverse"
Title = "title"
Path = "path"
Slug = "slug"
Category = "category"
Expand Down

0 comments on commit 7e18a41

Please sign in to comment.