M views/forum.html => views/forum.html +5 -7
@@ 13,18 13,16 @@
<td>
{{ if .Locked }} {{ template "lock.svg" }} {{ end }}
{{ if .Pinned }} {{ template "pin.svg" }} {{ end }}
+ <a class="title-link" href="/f/{{$.ForumSlug}}/{{.ID}}">{{.Title}}</a><br>
<div class="flex-between">
<div>
- <a class="title-link" href="/f/{{$.ForumSlug}}/{{.ID}}">{{.Title}}</a><br>
by <a href="/user/{{.Author.ID}}">{{.Author.Username}}</a> <span class="text-alt">{{ timeago .Created }}</span>
</div>
{{ if $.User.Role.ModLevel }}
- <div>
- <form method="POST" action="/f/{{$.ForumSlug}}/{{.ID}}/lock"><button class="link-button" id="submit">Lock</button></form>
- {{ if not .Pinned }}
- <form method="POST" action="/f/{{$.ForumSlug}}/{{.ID}}/pin"><button class="link-button" id="submit">Pin</button></form>
- {{ end }}
- </div>
+ <span>
+ <form style="display:inline;" method="POST" action="/f/{{$.ForumSlug}}/{{.ID}}/lock?s={{not .Locked}}"><button class="link-button" id="submit">{{ if .Locked}}Unl{{else}}L{{end}}ock</button></form>
+ <form style="display:inline;" method="POST" action="/f/{{$.ForumSlug}}/{{.ID}}/pin?s={{ not .Pinned}}"><button class="link-button" id="submit">{{ if .Pinned}}Unp{{else}}P{{end}}in</button></form>
+ </span>
</div>
{{ end }}
</td>
M views/style.css => views/style.css +1 -0
@@ 214,6 214,7 @@ h1, h2, h3, h4, h5, h6 {
text-decoration: underline;
font-size: inherit;
color:inherit;
+ display: inline;
}
.link-button:hover {
M web.go => web.go +4 -2
@@ 537,7 537,8 @@ func doLockThread(w http.ResponseWriter, r *http.Request) {
serverError(w, r, err)
return
}
- err = setThreadLock(threadID, true)
+ state, _ := strconv.ParseBool(r.URL.Query().Get("s"))
+ err = setThreadLock(threadID, state)
if err != nil {
serverError(w, r, err)
return
@@ 552,7 553,8 @@ func doPinThread(w http.ResponseWriter, r *http.Request) {
serverError(w, r, err)
return
}
- err = setThreadPin(threadID, true)
+ state, _ := strconv.ParseBool(r.URL.Query().Get("s"))
+ err = setThreadPin(threadID, state)
if err != nil {
serverError(w, r, err)
return