Files
gonic/assets/pages/home.tmpl

96 lines
3.5 KiB
Cheetah

{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<i class="mdi mdi-chart-arc"></i> stats
</div>
<div class="block-right">
<table id="stats" class="text-right">
<tr>
<td>artists:</td> <td>{{ .ArtistCount }}</td>
</tr>
<tr>
<td>albums:</td> <td>{{ .AlbumCount }}</td>
</tr>
<tr>
<td>tracks:</td> <td>{{ .TrackCount }}</td>
</tr>
</table>
</div>
</div>
<div class="padded box mono">
<div class="box-title">
<i class="mdi mdi-lastfm"></i> last.fm
</div>
<div class="text-right">
{{ if .User.IsAdmin }}
<a href="/admin/update_lastfm_api_key">update api key</a><br/>
{{ end }}
{{ if .CurrentLastFMAPIKey }}
<span class="light">current status</span>
{{ if .User.LastFMSession }}
linked
<span class="light">&#124;</span>
<a href="/admin/unlink_lastfm_do">unlink</a><br/>
{{ else }}
<span class="angry">unlinked</span>
<a href="https://www.last.fm/api/auth/?api_key={{ .CurrentLastFMAPIKey }}&cb={{ .RequestRoot }}/admin/link_lastfm_do">link</a><br/>
{{ end }}
{{ else if not .User.IsAdmin }}
<span class="light">api key not set. please ask your admin to set it</span>
{{ end }}
</div>
</div>
<div class="padded box mono">
{{ if .User.IsAdmin }}
{{/* admin panel to manage all users */}}
<div class="box-title">
<i class="mdi mdi-account-multiple"></i> users
</div>
<div class="text-right">
{{ range $user := .AllUsers }}
<i>{{ $user.Name }}</i>
<span class="light no-small">{{ $user.CreatedAt.Format "jan 02, 2006" }}</span>
<span class="light">&#124;</span>
<a href="/admin/change_password?user={{ $user.Name }}">change password</a>
<span class="light">&#124;</span>
<a href="/admin/delete_user?user={{ $user.Name }}">delete</a><br/>
{{ end }}
<a href="/admin/create_user" class="button">create new</a>
</div>
{{ else }}
{{/* user panel to manage themselves */}}
<div class="box-title">
<i class="mdi mdi-account"></i> your account
</div>
<div class="text-right">
<a href="/admin/change_own_password" class="button">change password</a>
</div>
{{ end }}
</div>
<div class="padded box mono">
<div class="box-title">
<i class="mdi mdi-folder-multiple"></i> recent folders
</div>
<div class="block-right text-right">
{{ if eq (len .RecentFolders) 0 }}
<span class="light">no folders yet</span>
{{ end }}
<table id="recent-folders">
{{ range $folder := .RecentFolders }}
<tr>
<td class="text-right">{{ $folder.RightPath }}</td>
<td class="no-small"><span class="light" title="{{ $folder.ModifiedAt }}">{{ $folder.ModifiedAt | humanDate }}</span></td>
</tr>
{{ end }}
</table>
{{- if not .IsScanning -}}
<a href="/admin/start_scan_do">start scan</a>
{{- if not .LastScanTime.IsZero -}}
<br>
<span class="light" title="{{ .LastScanTime }}">scanned {{ .LastScanTime | humanDate }}</span>
{{ end }}
{{ end }}
</div>
</div>
{{ end }}