151 lines
5.5 KiB
Cheetah
151 lines
5.5 KiB
Cheetah
{{ define "title" }}{{i18n "AdminInvitesTitle"}}{{ end }}
|
|
|
|
{{ define "content" }}
|
|
<h1
|
|
class="text-3xl tracking-tight font-black text-black mt-2 mb-4"
|
|
>{{i18n "AdminInvitesTitle"}}</h1>
|
|
|
|
<p id="welcome" class="my-2">{{i18n "AdminInvitesWelcome"}}</p>
|
|
|
|
<table class="table-auto w-full self-stretch mt-4 mb-8">
|
|
<thead class="block sm:table-header-group">
|
|
<tr class="sm:table-row flex flex-col items-stretch">
|
|
<td class="sm:w-9/12 sm:table-cell block" colspan="2">
|
|
<div
|
|
id="invite-list-count"
|
|
class="inline ml-0 rounded-full px-3 py-1 tracking-tight font-black text-white bg-gradient-to-r from-pink-400 to-red-400"
|
|
>{{i18npl "AdminInvitesCount" .Count}}</div>
|
|
</td>
|
|
<td
|
|
colspan="2"
|
|
class="sm:w-3/12 sm:pl-2 pr-0 sm:table-cell sm:my-0 my-4 block"
|
|
>
|
|
<form
|
|
id="create-invite"
|
|
action="{{urlTo "admin:invites:create"}}"
|
|
method="POST"
|
|
class="flex flex-row justify-start sm:justify-end"
|
|
>
|
|
{{ .csrfField }}
|
|
<button
|
|
{{ if not member_can_invite }} disabled {{ end }}
|
|
type="submit"
|
|
class="shadow rounded px-3 py-1.5 ring-1 focus:outline-none focus:ring-2
|
|
{{ if member_can_invite }}
|
|
text-green-600 ring-green-400 bg-white hover:bg-green-500 hover:text-gray-100 focus:ring-green-400
|
|
{{ else }}
|
|
text-gray-500 ring-gray-200 bg-gray-300 cursor-not-allowed
|
|
{{ end }}
|
|
"
|
|
>{{i18n "AdminInvitesCreate"}}</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
<tr class="h-4"></tr>
|
|
<tr class="h-8 uppercase text-sm text-gray-400">
|
|
<th class="w-3/12 hidden sm:table-cell text-left pl-3 pr-6">{{i18n "AdminInvitesCreatedAtColumn"}}</th>
|
|
<th class="w-6/12 text-left sm:px-2">{{i18n "AdminInvitesCreatorColumn"}}</th>
|
|
<th class="w-3/12 hidden sm:table-cell text-right pr-3">{{i18n "AdminInvitesActionColumn"}}</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody id="the-table-rows" class="divide-y">
|
|
{{range .Entries}}
|
|
{{ $user := is_logged_in }}
|
|
{{$hasCreatedInvite := eq $user.PubKey.Ref .CreatedBy.PubKey.Ref }}
|
|
{{$creator := .CreatedBy.PubKey.Ref}}
|
|
{{$creatorIsAlias := false}}
|
|
{{range $index, $alias := .CreatedBy.Aliases}}
|
|
{{if eq $index 0}}
|
|
{{$creator = $alias.Name}}
|
|
{{$creatorIsAlias = true}}
|
|
{{end}}
|
|
{{end}}
|
|
<tr class="h-12 hidden sm:table-row">
|
|
<td class="w-3/12 pl-3 pr-6 text-gray-400 text-left">
|
|
<div class="has-tooltip inline">
|
|
{{human_time .CreatedAt}}
|
|
<span class="tooltip">{{.CreatedAt.Format "2006-01-02T15:04:05.00"}}</span>
|
|
</div>
|
|
</td>
|
|
<td class="w-6/12 px-2">
|
|
{{if eq $creatorIsAlias true}}
|
|
{{$creator}}
|
|
{{else}}
|
|
<span class="font-mono text-sm w-32 truncate block">{{$creator}}</span>
|
|
{{end}}
|
|
</td>
|
|
<td class="w-3/12 pl-2 pr-3 text-right">
|
|
{{ if or member_is_elevated $hasCreatedInvite }}
|
|
<a
|
|
href="{{urlTo "admin:invites:revoke:confirm" "id" .ID}}"
|
|
class="pl-2 w-20 py-2 text-center text-gray-400 hover:text-red-600 font-bold cursor-pointer"
|
|
>{{i18n "AdminInviteRevoke"}}</a>
|
|
{{ end }}
|
|
</td>
|
|
</tr>
|
|
<tr class="h-12 table-row sm:hidden">
|
|
<td class="flex flex-row items-center mt-0.5" colspan="3">
|
|
<span class="flex-1 flex flex-row items-center">
|
|
{{if eq $creatorIsAlias true}}
|
|
{{$creator}}, {{human_time .CreatedAt}}
|
|
{{else}}
|
|
<span
|
|
class="font-mono w-32 truncate inline-block"
|
|
>{{$creator}}</span>, {{human_time .CreatedAt}}
|
|
{{end}}
|
|
</span>
|
|
{{ if or member_is_elevated $hasCreatedInvite }}
|
|
<a
|
|
href="{{urlTo "admin:invites:revoke:confirm" "id" .ID}}"
|
|
class="pl-4 w-20 py-2 text-center text-gray-400 hover:text-red-600 font-bold cursor-pointer"
|
|
>{{i18n "AdminInviteRevoke"}}</a>
|
|
{{ end }}
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
|
|
{{$pageNums := .Paginator.PageNums}}
|
|
{{$view := .View}}
|
|
{{if gt $pageNums 1}}
|
|
<div class="flex flex-row justify-center">
|
|
{{if not .FirstInView}}
|
|
<a
|
|
href="{{urlTo "admin:invites:overview"}}?page=1"
|
|
class="rounded px-3 py-2 text-pink-600 border-transparent hover:border-pink-400 border-2"
|
|
>1</a>
|
|
<span
|
|
class="px-3 py-2 text-gray-400 border-2 border-transparent"
|
|
>..</span>
|
|
{{end}}
|
|
|
|
{{range $view.Pages}}
|
|
{{if le . $pageNums}}
|
|
{{if eq . $view.Current}}
|
|
<span
|
|
class="px-3 py-2 cursor-default text-gray-500 border-2 border-transparent"
|
|
>{{.}}</span>
|
|
{{else}}
|
|
<a
|
|
href="{{urlTo "admin:invites:overview"}}?page={{.}}"
|
|
class="rounded px-3 py-2 mx-1 text-pink-600 border-transparent hover:border-pink-400 border-2"
|
|
>{{.}}</a>
|
|
{{end}}
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{if not .LastInView}}
|
|
<span
|
|
class="px-3 py-2 text-gray-400 border-2 border-transparent"
|
|
>..</span>
|
|
<a
|
|
href="{{urlTo "admin:invites:overview"}}?page={{$view.Last}}"
|
|
class="rounded px-3 py-2 text-pink-600 border-transparent hover:border-pink-400 border-2"
|
|
>{{$view.Last}}</a>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|