Skip to content

Commit

Permalink
display sort mode in sort summary element
Browse files Browse the repository at this point in the history
  • Loading branch information
cblgh committed Dec 17, 2024
1 parent 1890a5a commit d005fb0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion html/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
{{ if eq .Title $threads }}
<li>
<details>
<summary>{{ "Sort" | translate }}</summary>
<summary>{{ "Sort" | translate }}: {{ if .SortByPosts }}posts{{ else }}threads{{ end }}</summary>
<ul>
<li>
<form type="GET" action="/"/>
Expand Down
3 changes: 2 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (

type TemplateData struct {
Data interface{}
SortByPosts bool
QuickNav bool
LoggedIn bool
IsAdmin bool
Expand Down Expand Up @@ -451,7 +452,7 @@ func (h RequestHandler) IndexRoute(res http.ResponseWriter, req *http.Request) {
}
sort.Strings(categories)

view := TemplateData{Data: IndexData{Threads: threads, Categories: categories, VisibleCategoriesMap: categoriesMap }, IsAdmin: isAdmin, HasRSS: h.config.RSS.URL != "", LoggedIn: loggedIn, Title: h.translator.Translate("Threads")}
view := TemplateData{Data: IndexData{Threads: threads, Categories: categories, VisibleCategoriesMap: categoriesMap }, SortByPosts: mostRecentPost, IsAdmin: isAdmin, HasRSS: h.config.RSS.URL != "", LoggedIn: loggedIn, Title: h.translator.Translate("Threads")}
h.renderView(res, "index", view)
}

Expand Down

0 comments on commit d005fb0

Please sign in to comment.