mirror of
https://github.com/rystaf/mlmym.git
synced 2025-01-17 02:16:45 +00:00
spoiler fix, default search options
This commit is contained in:
parent
0f4242e61e
commit
8c7aabab72
|
@ -140,7 +140,7 @@ var funcMap = template.FuncMap{
|
||||||
body = buf.String()
|
body = buf.String()
|
||||||
body = strings.Replace(body, `<img `, `<img loading="lazy" `, -1)
|
body = strings.Replace(body, `<img `, `<img loading="lazy" `, -1)
|
||||||
body = LemmyLinkRewrite(body, host, os.Getenv("LEMMY_DOMAIN"))
|
body = LemmyLinkRewrite(body, host, os.Getenv("LEMMY_DOMAIN"))
|
||||||
body = RegReplace(body, `::: spoiler (.*?)\n([\S\s]*?):::`, "<details><summary>$1</summary>$2</details>")
|
body = RegReplace(body, `::: ?spoiler (.*?)\n([\S\s]*?):::`, "<details><summary>$1</summary>$2</details>")
|
||||||
return template.HTML(body)
|
return template.HTML(body)
|
||||||
},
|
},
|
||||||
"rmmarkdown": func(body string) string {
|
"rmmarkdown": func(body string) string {
|
||||||
|
|
2
state.go
2
state.go
|
@ -544,7 +544,7 @@ func (state *State) Search(searchtype string) {
|
||||||
search := types.Search{
|
search := types.Search{
|
||||||
Q: state.Query,
|
Q: state.Query,
|
||||||
Sort: types.NewOptional(types.SortType(state.Sort)),
|
Sort: types.NewOptional(types.SortType(state.Sort)),
|
||||||
ListingType: types.NewOptional(types.ListingType("All")),
|
ListingType: types.NewOptional(types.ListingType(state.Listing)),
|
||||||
Type: types.NewOptional(types.SearchType(searchtype)),
|
Type: types.NewOptional(types.SearchType(searchtype)),
|
||||||
Limit: types.NewOptional(int64(25)),
|
Limit: types.NewOptional(int64(25)),
|
||||||
Page: types.NewOptional(int64(state.Page)),
|
Page: types.NewOptional(int64(state.Page)),
|
||||||
|
|
|
@ -29,9 +29,7 @@
|
||||||
{{ template "nsfw.html" }}
|
{{ template "nsfw.html" }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<main>
|
<main>
|
||||||
{{ if or (contains .Sort "Top") (and (not .PostID) (not .User) (not .Community) (not .Activities) (eq .Op ""))}}
|
|
||||||
{{ template "menu.html" . }}
|
{{ template "menu.html" . }}
|
||||||
{{ end}}
|
|
||||||
|
|
||||||
{{ if .Error }}
|
{{ if .Error }}
|
||||||
<div class="error">
|
<div class="error">
|
||||||
|
|
|
@ -27,12 +27,13 @@
|
||||||
{{ template "nsfw.html" }}
|
{{ template "nsfw.html" }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<main>
|
<main>
|
||||||
{{ if or (contains .Sort "Top") (and (not .PostID) (not .User) (not .Community) (not .Activities) (eq .Op ""))}}
|
{{ if or (.Query) (.SearchType) (and (not .PostID) (not .User) (not .Activities) (eq .Op ""))}}
|
||||||
{{ template "menu.html" . }}
|
{{ template "menu.html" . }}
|
||||||
{{ end}}
|
{{ end}}
|
||||||
|
|
||||||
{{ if or (ne .Query "") .Communities }}
|
{{ if or (ne .Query "") .Communities }}
|
||||||
<form class="search" method="GET">
|
<form class="search" method="GET">
|
||||||
|
<input type="hidden" name="sort" value="{{.Sort}}">
|
||||||
<div>search</div>
|
<div>search</div>
|
||||||
<div class="query">
|
<div class="query">
|
||||||
<input type="text" name="q" value="{{.Query}}">
|
<input type="text" name="q" value="{{.Query}}">
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<a href="/{{$host}}/c/{{fullcname $c.Community}}">{{$c.Community.Name}}</a>
|
<a href="/{{$host}}/c/{{fullcname $c.Community}}">{{$c.Community.Name}}</a>
|
||||||
<span> - </span>
|
<span> - </span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<a href="/{{$host}}/search?searchtype=Communities" class="more">more »</a>
|
<a href="/{{$host}}/search?searchtype=Communities&sort=TopAll" class="more">more »</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
{{ if .Session }}
|
{{ if .Session }}
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
<span>: search</span>
|
<span>: search</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<ul>
|
<ul>
|
||||||
{{ if .User }}
|
{{ if and .User (not .Query)}}
|
||||||
<li {{if eq .Op "" }}class="selected"{{end}}><a href="?">overview</a></li>
|
<li {{if eq .Op "" }}class="selected"{{end}}><a href="?">overview</a></li>
|
||||||
{{ if and .Session (eq .User.PersonView.Person.ID .Session.UserID) }}
|
{{ if and .Session (eq .User.PersonView.Person.ID .Session.UserID) }}
|
||||||
<li {{if eq .Op "Saved"}}class="selected"{{end}}><a href="?view=Saved">saved</a></li>
|
<li {{if eq .Op "Saved"}}class="selected"{{end}}><a href="?view=Saved">saved</a></li>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
{{ else if .Community }}
|
{{ else if .Community }}
|
||||||
<input type="hidden" name="communityname" value="{{fullcname .Community.CommunityView.Community}}">
|
<input type="hidden" name="communityname" value="{{fullcname .Community.CommunityView.Community}}">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
<input type="hidden" name="sort" value="New">
|
||||||
</form>
|
</form>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue