~aw/fishbb

bced0ac5e32ab7496cc95d4040cbae00eaf3b89a — alex wennerberg 2 months ago 87a2b9f
finish lock and pin
3 files changed, 10 insertions(+), 9 deletions(-)

M views/forum.html
M views/style.css
M web.go
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