tube/templates/index.html
2020-03-25 23:02:14 +10:00

34 lines
1.1 KiB
HTML

{{ define "content" }}
{{ $playing := .Playing }}
<div id="player">
{{ if $playing.ID }}
<video id="video" controls poster="/t/{{ $playing.ID}}" src="/v/{{ $playing.ID }}.mp4"></video>
<h1>{{ $playing.Title }}</h1>
<h2>{{ $playing.Views }} views • {{ $playing.Modified }}</h2>
<p>{{ $playing.Description }}</p>
{{ else }}
<video id="video" controls></video>
{{ end }}
</div>
<div id="playlist">
<div class="nav">
<ul>
<li><a {{ if eq $.Sort "views" }}class="active"{{ end }}href="?sort=views">Trending</a></li>
<li><a {{ if eq $.Sort "timestamp" }}class="active"{{ end }}href="?sort=timestamp">Recent</a></li>
</ul>
</div>
{{ range $m := .Playlist }}
{{ if eq $m.ID $playing.ID }}
<a href="/v/{{ $m.ID }}" class="playing">
{{ else }}
<a href="/v/{{ $m.ID }}">
{{ end }}
<img src="/t/{{ $m.ID }}">
<div>
<h1>{{ $m.Title }}</h1>
<h2>{{ $m.Views }} views • {{ $m.Modified }}</h2>
</div>
</a>
{{ end }}
</div>
{{end}}