thread.gohtml (4624B)
1 {{ define "extra-head" }} 2 <style> 3 .btn-xs { 4 margin: 0 !important; 5 padding: 0 4px !important; 6 font-size: 11px !important; 7 } 8 :target { 9 -webkit-animation: target-fade 3s 1; 10 -moz-animation: target-fade 3s 1; 11 } 12 13 @-webkit-keyframes target-fade { 14 0% { background-color: rgba(255,213,0,0.5); } 15 100% { background-color: rgba(0,0,0,0); } 16 } 17 18 @-moz-keyframes target-fade { 19 0% { background-color: rgba(255,213,0,0.5); } 20 100% { background-color: rgba(0,0,0,0); } 21 } 22 .btn-xs { 23 margin: 0 !important; 24 padding: 0 4px !important; 25 font-size: 11px !important; 26 } 27 </style> 28 {{ end }} 29 30 {{ define "title" }}dkf - {{ .Data.Thread.Name }}{{ end }} 31 32 {{ define "content" }} 33 <div class="container-fluid mb-5"> 34 <nav aria-label="breadcrumb"> 35 <ol class="breadcrumb"> 36 <li class="breadcrumb-item"><a href="/forum">Forum</a></li> 37 <li class="breadcrumb-item active">{{ .Data.Thread.Name }}</li> 38 </ol> 39 </nav> 40 41 {{ if .AuthUser }} 42 <div class="mb-3"> 43 {{ if .Data.IsSubscribed }} 44 <form method="post" style="display: inline-block" action="/api/v1/threads/{{ .Data.Thread.UUID }}/unsubscribe"> 45 <input type="hidden" name="csrf" value="{{ .CSRF }}" /> 46 <button type="submit" class="btn btn-sm btn-secondary">{{ t "Unsubscribe" . }}</button> 47 </form> 48 {{ else }} 49 <form method="post" style="display: inline-block" action="/api/v1/threads/{{ .Data.Thread.UUID }}/subscribe"> 50 <input type="hidden" name="csrf" value="{{ .CSRF }}" /> 51 <button type="submit" class="btn btn-sm btn-secondary">{{ t "Subscribe" . }}</button> 52 </form> 53 {{ end }} 54 {{ if .AuthUser.IsAdmin }} 55 <a href="/t/{{ $.Data.Thread.UUID }}/edit" class="btn btn-sm btn-secondary">Edit thread</a> 56 <a href="/t/{{ $.Data.Thread.UUID }}/delete" class="btn btn-sm btn-secondary">Delete thread</a> 57 {{ end }} 58 </div> 59 {{ end }} 60 61 <div style="border-bottom: 1px solid #444;"> 62 {{ range .Data.Messages }} 63 <div id="{{ .UUID }}" style="border-left: 1px solid #444; border-right: 1px solid #444;"> 64 <div style="display: flex; flex-direction: row; background-color: #292929; padding: 5px 0 5px 10px; border-top: 1px solid #444; border-bottom: 1px solid #333;"> 65 <div class="img-thumbnail" style="width: 80px; height: 80px; margin-right: 10px;"> 66 {{ if .User.Avatar }} 67 <img src="data:image;base64,{{ .User.Avatar | b64 }}" alt="avatar" width="70" height="70" /> 68 {{ else }} 69 <img src="/public/img/avatar-placeholder.png" width="70" height="70" alt="avatar" /> 70 {{ end }} 71 </div> 72 <div style="display: flex; flex-direction: column;"> 73 <div style="flex: 1;"> 74 <a {{ .User.GenerateChatStyle | attr }} href="/u/{{ .User.Username }}">{{ .User.Username }}</a> 75 {{- if .IsSigned -}} 76 <a href="/t/{{ $.Data.Thread.UUID }}/messages/{{ .UUID }}/raw" class="ml-2" title="PGP signed" rel="noopener noreferrer" target="_blank">✅</a> 77 {{- end -}} 78 </div> 79 <div style="flex: 1;"><a href="#{{ .UUID }}">{{ .CreatedAt.Format "Jan 02, 2006 15:04:05" }}</a></div> 80 <div> 81 {{ if $.AuthUser }} 82 {{ if or (and (eq $.AuthUser.ID .UserID) .CanEdit) $.AuthUser.IsAdmin }} 83 <a href="/t/{{ $.Data.Thread.UUID }}/messages/{{ .UUID }}/edit" class="btn btn-xs btn-secondary">Edit</a> 84 <a href="/t/{{ $.Data.Thread.UUID }}/messages/{{ .UUID }}/delete" class="btn btn-xs btn-secondary">Delete</a> 85 {{ end }} 86 {{ end }} 87 </div> 88 </div> 89 </div> 90 <div style="padding: 5px 5px 10px 10px;"> 91 {{ .Escape $.DB | safe }} 92 </div> 93 </div> 94 {{ end }} 95 </div> 96 97 {{ template "pagination" . }} 98 99 <a href="/t/{{ .Data.Thread.UUID }}/reply" class="btn btn-primary mt-3">Reply</a> 100 </div> 101 102 {{ end }}