2022-08-13 22:39:31 +00:00
{{define "title"}}Admin - Certification Photos{{end}}
{{define "content"}}
2022-08-14 23:27:57 +00:00
{{$Root := .}}
2022-08-13 22:39:31 +00:00
< div class = "container" >
< section class = "hero is-danger is-bold" >
< div class = "hero-body" >
< div class = "container" >
< h1 class = "title" >
Admin / Certification Photos
< / h1 >
< / div >
< / div >
< / section >
< div class = "block p-4" >
2022-08-14 23:27:57 +00:00
< div class = "columns" >
< div class = "column" >
{{if .Pager}}
There {{Pluralize64 .Pager.Total "is" "are"}} < strong > {{.Pager.Total}}< / strong > Certification Photo{{Pluralize64 .Pager.Total}}
{{if eq .View "pending"}}
needing approval.
{{else}}
at status "{{.View}}."
{{end}}
{{else if .FoundUser}}
Found user < strong > < a href = "/u/{{.FoundUser.Username}}" class = "has-text-dark" > {{.FoundUser.Username}}< / a > < / strong >
(< a href = "mailto:{{.FoundUser.Email}}" > {{.FoundUser.Email}}< / a > )
{{end}}
< / div >
< div class = "column is-narrow" >
< div class = "tabs is-toggle" >
< ul >
< li { { if eq . View " pending " } } class = "is-active" { { end } } >
< a href = "{{.Request.URL.Path}}?view=pending" > Needing Approval< / a >
< / li >
< li { { if eq . View " approved " } } class = "is-active" { { end } } >
< a href = "{{.Request.URL.Path}}?view=approved" > Approved< / a >
< / li >
< li { { if eq . View " rejected " } } class = "is-active" { { end } } >
< a href = "{{.Request.URL.Path}}?view=rejected" > Rejected< / a >
< / li >
< / ul >
< / div >
< / div >
< / div >
2022-08-13 22:39:31 +00:00
< div class = "block" >
2022-08-14 23:27:57 +00:00
< form method = "GET" action = "{{.Request.URL.Path}}" >
< div class = "field block" >
< div class = "label" for = "username" > Search username or email:< / div >
< input type = "text" class = "input"
name="username"
id="username"
placeholder="Press Enter to search">
< / div >
< / form >
2022-08-13 22:39:31 +00:00
< / div >
2022-08-14 23:27:57 +00:00
{{if .Pager}}
2023-06-22 03:46:27 +00:00
{{SimplePager .Pager}}
2022-08-14 23:27:57 +00:00
{{end}}
2022-08-13 22:39:31 +00:00
< div class = "columns is-multiline" >
{{range .Photos}}
< div class = "column is-one-third" >
{{$User := $Root.UserMap.Get .UserID}}
< form action = "{{$Root.Request.URL.Path}}" method = "POST" >
{{InputCSRF}}
< input type = "hidden" name = "user_id" value = "{{$User.ID}}" >
< div class = "card" style = "max-width: 512px" >
< header class = "card-header has-background-link" >
< p class = "card-header-title has-text-light" >
< span class = "icon" > < i class = "fa fa-user" > < / i > < / span >
< span > {{or $User.Username "[deleted]"}}< / span >
< / p >
< / header >
2023-08-01 03:03:21 +00:00
{{if .Filename}}
2022-08-13 22:39:31 +00:00
< div class = "card-image" >
< figure class = "image" >
< img src = "{{PhotoURL .Filename}}" >
< / figure >
< / div >
2023-08-01 03:03:21 +00:00
{{end}}
2022-08-13 22:39:31 +00:00
< div class = "card-content" >
< div class = "media block" >
< div class = "media-left" >
< figure class = "image is-48x48" >
{{if $User.ProfilePhoto.ID}}
< img src = "{{PhotoURL $User.ProfilePhoto.CroppedFilename}}" >
{{else}}
< img src = "/static/img/shy.png" >
{{end}}
< / figure >
< / div >
< div class = "media-content" >
2022-08-21 22:40:24 +00:00
< p class = "title is-4" > {{$User.NameOrUsername}}< / p >
2022-08-13 22:39:31 +00:00
< p class = "subtitle is-6" >
< span class = "icon" > < i class = "fa fa-user" > < / i > < / span >
< a href = "/u/{{$User.Username}}" target = "_blank" > {{$User.Username}}< / a >
< / p >
< / div >
< / div >
2022-08-14 23:27:57 +00:00
< div class = "block" >
< div class = "columns" >
< div class = "column is-narrow" >
2022-08-15 00:45:55 +00:00
< strong > Status:< / strong >
2022-08-14 23:27:57 +00:00
< / div >
< div class = "column" >
{{if eq .Status "pending"}}
< strong class = "has-text-warning" > Pending Approval< / strong >
{{else if eq .Status "approved"}}
< strong class = "has-text-success" > Approved< / strong >
{{else if eq .Status "rejected"}}
< strong class = "has-text-danger" > Rejected< / strong >
{{else}}
< strong > {{.Status}}< / strong >
{{end}}
< / div >
< / div >
< / div >
2022-08-13 22:39:31 +00:00
< div class = "field" >
< textarea class = "textarea" name = "comment"
cols="60" rows="2"
2022-08-14 23:27:57 +00:00
placeholder="Admin comment (for rejection)">{{.AdminComment}}< / textarea >
2023-08-01 03:03:21 +00:00
< div class = "select is-fullwidth" >
< select class = "common-reasons" >
< option value = "" > (Common Rejection Reasons)< / option >
< option value = "Your certification pic should depict you holding onto a sheet of paper with your username, site name, and current date written on it." >
Didn't follow directions
< / option >
< option value = "The sheet of paper must also include the website name: nonshy" > Website name not visible< / option >
< option value = "Please take a clearer picture that shows your arm and hand holding onto the sheet of paper" > Unclear picture (hand not visible enough)< / option >
< option value = "This is not an acceptable certification photo." > Not acceptable< / option >
< / select >
< / div >
2022-08-13 22:39:31 +00:00
< / div >
< / div >
< footer class = "card-footer" >
2022-08-14 23:27:57 +00:00
{{if not (eq .Status "rejected")}}
2022-08-13 22:39:31 +00:00
< button type = "submit" name = "verdict" value = "reject" class = "card-footer-item button is-danger" >
< span class = "icon" > < i class = "fa fa-xmark" > < / i > < / span >
< span > Reject< / span >
< / button >
2022-08-14 23:27:57 +00:00
{{end}}
{{if not (eq .Status "approved")}}
2022-08-13 22:39:31 +00:00
< button type = "submit" name = "verdict" value = "approve" class = "card-footer-item button is-success" >
< span class = "icon" > < i class = "fa fa-check" > < / i > < / span >
< span > Approve< / span >
< / button >
2022-08-14 23:27:57 +00:00
{{end}}
2022-08-13 22:39:31 +00:00
< / footer >
< / div >
< / form >
< / div >
{{end}}
< / div >
< / div >
< / div >
2023-06-22 03:46:27 +00:00
{{end}}
2023-08-01 03:03:21 +00:00
{{define "scripts"}}
< script >
window.addEventListener("DOMContentLoaded", (event) => {
document.querySelectorAll("select.common-reasons").forEach(elem => {
let textarea = elem.parentNode.parentNode.getElementsByTagName("textarea")[0];
elem.addEventListener("change", (e) => {
textarea.value = elem.value;
})
})
});
< / script >
{{end}}