diff options
Diffstat (limited to 'web/templates/admin/show.tmpl')
-rw-r--r-- | web/templates/admin/show.tmpl | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/web/templates/admin/show.tmpl b/web/templates/admin/show.tmpl new file mode 100644 index 0000000..2dbbb78 --- /dev/null +++ b/web/templates/admin/show.tmpl @@ -0,0 +1,121 @@ +<!DOCTYPE html> +<html lang="en"> +{{template "head" .}} +<body> +{{template "header" .}} + +<div class="container mb-5"> + <div class="row"> + <div class="col-12"> + + <h2 class="mt-4"><span style="font-family: monospace;">/</span></h2> + + {{$empty := true}} + + <table class="table"> + <colgroup> + <col span="1" style="width: 20%;"> + <col span="1" style="width: 60%;"> + <col span="1" style="width: 10%;"> + <col span="1" style="width: 5%;"> + <col span="1" style="width: 5%;"> + </colgroup> + <thead> + <tr> + <th scope="col">Short URL</th> + <th scope="col">Target</th> + <th scope="col">Creator</th> + <th scope="col">Hits</th> + <th scope="col">Action</th> + </tr> + </thead> + <tbody> + {{$empty = true}} + {{range .UserLinks}} + {{if eq .Prefix ""}} + {{$empty = false}} + <tr> + <th scope="row"><a class="text-dark" href="{{.ShortLink}}">go.gentoo.org{{.ShortLink}}</a></th> + <td><a class="text-dark" href="{{.TargetLink}}">{{.TargetLink}}</a></td> + <td>{{replaceAll .UserEmail "@gentoo.org" ""}}</td> + <td>{{.Hits}}</td> + <td> + <form action="/links/delete" method="post"> + <input hidden name="prefix" value="{{.Prefix}}"> + <input hidden name="token" value="{{.URLToken}}"> + <input hidden name="from" value="/admin/"> + <button type="submit" class="btn btn-link py-0 text-dark"> + <i class="fa fa-trash-o" aria-hidden="true"></i> + </button> + </form> + </td> + </tr> + {{end}} + {{end}} + {{if $empty}} + <tr> + <td colspan="4" class="text-center"><i>No shortened URLs yet</i></td> + </tr> + {{end}} + </tbody> + </table> + + + {{range $index, $project := getPrefixList .UserLinks}} + <h2 class="mt-5"><span style="font-family: monospace;">/{{$project}}/</span></h2> + + <table class="table"> + <colgroup> + <col span="1" style="width: 20%;"> + <col span="1" style="width: 65%;"> + <col span="1" style="width: 10%;"> + <col span="1" style="width: 5%;"> + </colgroup> + <thead> + <tr> + <th scope="col">Short URL</th> + <th scope="col">Target</th> + <th scope="col">Creator</th> + <th scope="col">Action</th> + </tr> + </thead> + <tbody> + {{$empty = true}} + {{range $.UserLinks}} + {{if eq .Prefix $project}} + {{$empty = false}} + <tr> + <th scope="row"><a class="text-dark" href="{{.ShortLink}}">go.gentoo.org{{.ShortLink}}</a></th> + <td><a class="text-dark" href="{{.TargetLink}}">{{.TargetLink}}</a></td> + <td>{{replaceAll .UserEmail "@gentoo.org" ""}}</td> + <td> + <form action="/links/delete" method="post"> + <input hidden name="prefix" value="{{.Prefix}}"> + <input hidden name="token" value="{{.URLToken}}"> + <input hidden name="from" value="/admin/"> + <button type="submit" class="btn btn-link py-0 text-dark"> + <i class="fa fa-trash-o" aria-hidden="true"></i> + </button> + </form> + </td> + </tr> + {{end}} + {{end}} + {{if $empty}} + <tr> + <td colspan="4" class="text-center"><i>No shortened URLs yet</i></td> + </tr> + {{end}} + </tbody> + </table> + {{end}} + </div> + </div> +</div> + + +{{template "footer" .}} + + +</body> +</html> |