1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Add ability to change entry sort order in the UI

This commit is contained in:
James Loh 2021-05-14 21:51:51 +10:00 committed by fguillot
parent 27d170cbec
commit 78f6bbe93d
28 changed files with 122 additions and 30 deletions

View file

@ -26,7 +26,7 @@ func (h *handler) showStarredPage(w http.ResponseWriter, r *http.Request) {
builder := h.store.NewEntryQueryBuilder(user.ID)
builder.WithoutStatus(model.EntryStatusRemoved)
builder.WithStarred()
builder.WithOrder(model.DefaultSortingOrder)
builder.WithOrder(user.EntryOrder)
builder.WithDirection(user.EntryDirection)
builder.WithOffset(offset)
builder.WithLimit(user.EntriesPerPage)

View file

@ -37,7 +37,7 @@ func (h *handler) showCategoryEntriesPage(w http.ResponseWriter, r *http.Request
offset := request.QueryIntParam(r, "offset", 0)
builder := h.store.NewEntryQueryBuilder(user.ID)
builder.WithCategoryID(category.ID)
builder.WithOrder(model.DefaultSortingOrder)
builder.WithOrder(user.EntryOrder)
builder.WithDirection(user.EntryDirection)
builder.WithStatus(model.EntryStatusUnread)
builder.WithOffset(offset)

View file

@ -37,7 +37,7 @@ func (h *handler) showCategoryEntriesAllPage(w http.ResponseWriter, r *http.Requ
offset := request.QueryIntParam(r, "offset", 0)
builder := h.store.NewEntryQueryBuilder(user.ID)
builder.WithCategoryID(category.ID)
builder.WithOrder(model.DefaultSortingOrder)
builder.WithOrder(user.EntryOrder)
builder.WithDirection(user.EntryDirection)
builder.WithoutStatus(model.EntryStatusRemoved)
builder.WithOffset(offset)

View file

@ -38,7 +38,7 @@ func (h *handler) showFeedEntriesPage(w http.ResponseWriter, r *http.Request) {
builder := h.store.NewEntryQueryBuilder(user.ID)
builder.WithFeedID(feed.ID)
builder.WithStatus(model.EntryStatusUnread)
builder.WithOrder(model.DefaultSortingOrder)
builder.WithOrder(user.EntryOrder)
builder.WithDirection(user.EntryDirection)
builder.WithOffset(offset)
builder.WithLimit(user.EntriesPerPage)

View file

@ -38,7 +38,7 @@ func (h *handler) showFeedEntriesAllPage(w http.ResponseWriter, r *http.Request)
builder := h.store.NewEntryQueryBuilder(user.ID)
builder.WithFeedID(feed.ID)
builder.WithoutStatus(model.EntryStatusRemoved)
builder.WithOrder(model.DefaultSortingOrder)
builder.WithOrder(user.EntryOrder)
builder.WithDirection(user.EntryDirection)
builder.WithOffset(offset)
builder.WithLimit(user.EntriesPerPage)

View file

@ -21,6 +21,7 @@ type SettingsForm struct {
Language string
Timezone string
EntryDirection string
EntryOrder string
EntriesPerPage int
KeyboardShortcuts bool
ShowReadingTime bool
@ -36,6 +37,7 @@ func (s *SettingsForm) Merge(user *model.User) *model.User {
user.Language = s.Language
user.Timezone = s.Timezone
user.EntryDirection = s.EntryDirection
user.EntryOrder = s.EntryOrder
user.EntriesPerPage = s.EntriesPerPage
user.KeyboardShortcuts = s.KeyboardShortcuts
user.ShowReadingTime = s.ShowReadingTime
@ -84,6 +86,7 @@ func NewSettingsForm(r *http.Request) *SettingsForm {
Language: r.FormValue("language"),
Timezone: r.FormValue("timezone"),
EntryDirection: r.FormValue("entry_direction"),
EntryOrder: r.FormValue("entry_order"),
EntriesPerPage: int(entriesPerPage),
KeyboardShortcuts: r.FormValue("keyboard_shortcuts") == "1",
ShowReadingTime: r.FormValue("show_reading_time") == "1",

View file

@ -32,6 +32,7 @@ func (h *handler) showSettingsPage(w http.ResponseWriter, r *http.Request) {
Language: user.Language,
Timezone: user.Timezone,
EntryDirection: user.EntryDirection,
EntryOrder: user.EntryOrder,
EntriesPerPage: user.EntriesPerPage,
KeyboardShortcuts: user.KeyboardShortcuts,
ShowReadingTime: user.ShowReadingTime,

View file

@ -9,7 +9,6 @@ import (
"miniflux.app/http/request"
"miniflux.app/http/response/html"
"miniflux.app/model"
"miniflux.app/ui/session"
"miniflux.app/ui/view"
)
@ -23,7 +22,7 @@ func (h *handler) sharedEntries(w http.ResponseWriter, r *http.Request) {
builder := h.store.NewEntryQueryBuilder(user.ID)
builder.WithShareCodeNotEmpty()
builder.WithOrder(model.DefaultSortingOrder)
builder.WithOrder(user.EntryOrder)
builder.WithDirection(user.EntryDirection)
entries, err := builder.GetEntries()

View file

@ -49,7 +49,7 @@ func (h *handler) showUnreadPage(w http.ResponseWriter, r *http.Request) {
m = timing.NewMetric("sql_fetch_unread_entries").Start()
builder = h.store.NewEntryQueryBuilder(user.ID)
builder.WithStatus(model.EntryStatusUnread)
builder.WithOrder(model.DefaultSortingOrder)
builder.WithOrder(user.EntryOrder)
builder.WithDirection(user.EntryDirection)
builder.WithOffset(offset)
builder.WithLimit(user.EntriesPerPage)