mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-21 21:27:15 +00:00
user overview sort
This commit is contained in:
parent
80ca58a55f
commit
944afd7d59
|
@ -638,6 +638,11 @@ func GetComment(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|||
}
|
||||
func GetUser(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||
state, err := Initialize(ps.ByName("host"), r)
|
||||
state.Sort = "New"
|
||||
m, _ := url.ParseQuery(r.URL.RawQuery)
|
||||
if len(m["sort"]) > 0 {
|
||||
state.Sort = m["sort"][0]
|
||||
}
|
||||
if err != nil {
|
||||
Render(w, "index.html", state)
|
||||
return
|
||||
|
|
1
state.go
1
state.go
|
@ -491,6 +491,7 @@ func (state *State) GetUser(username string) {
|
|||
Page: lemmy.NewOptional(int64(state.Page)),
|
||||
Limit: lemmy.NewOptional(int64(limit)),
|
||||
SavedOnly: lemmy.NewOptional(state.Op == "Saved"),
|
||||
Sort: lemmy.NewOptional(lemmy.SortType(state.Sort)),
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
|
|
|
@ -99,6 +99,17 @@
|
|||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end}}
|
||||
{{ if and .User .Activities }}
|
||||
<div id="comments" class="commentmenu">
|
||||
<div>
|
||||
sorted by:
|
||||
<a {{ if eq .Sort "New"}}class="selected"{{end}} href="{{ .SortBy "New"}}">new</a>
|
||||
<a {{ if eq .Sort "TopAll"}}class="selected"{{end}} href="{{ .SortBy "TopAll"}}">top</a>
|
||||
<a {{ if eq .Sort "Controversial"}}class="selected"{{end}} href="{{ .SortBy "Controversial"}}">controversial</a>
|
||||
<a {{ if eq .Sort "Old"}}class="selected"{{end}} href="{{ .SortBy "Old"}}">old</a>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{ range $i, $comment := .Comments }}
|
||||
|
|
Loading…
Reference in a new issue