tube/templates/index.html

36 lines
1.2 KiB
HTML

{{ define "content" }}
{{ $playing := .Playing }}
<div id="player">
{{ if $playing.ID }}
<video id="video" controls preload="metadata" poster="/t/{{ $playing.ID}}">
<source src="/v/{{ $playing.ID }}.mp4?quality={{ $.Quality }}" type="video/mp4" />
</video>
<h1>{{ $playing.Title }}</h1>
<h2>{{ $playing.Views }} views • {{ $playing.Modified }}<br />{{ $playing.Size | bytes }}</h2>
<p>{{ $playing.Description }}</p>
{{ else }}
<video id="video" controls></video>
{{ end }}
</div>
<div id="playlist">
<div class="nav">
<ul>
<li><a {{ if or (eq $.Sort "timestamp") (eq $.Sort "") }}class="active"{{ end }} href="?sort=timestamp">Recent</a></li>
<li><a {{ if eq $.Sort "views" }}class="active"{{ end }} href="?sort=views">Views</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 }}<br />{{ $m.Size | bytes }}</h2>
</div>
</a>
{{ end }}
</div>
{{end}}