indiescrobble/templates/scrobble.tmpl

87 lines
2.0 KiB
Cheetah
Raw Permalink Normal View History

{{ define "scrobble.tmpl" }}
<!DOCTYPE html>
<html lang="en">
{{ template "head.tmpl" . }}
<body>
{{ template "header.tmpl" . }}
<main>
{{ $scrobbleType := .scrobbleType }}
{{ if .user.Me }}
Logged in as {{.user.Me}} <a href="/logout"><button>Log Out</button></a>
{{end}}
{{if .searchResults}}
<p><a href="/">Add A Post</a> &gt; <a href="/scrobble?type=movie">Add {{ .scrobbleTypeName }}</a> &gt; {{.searchEngine}} Results</p>
<ul>
{{ $scrobbleType := .scrobbleType }}
{{range $result := .searchResults}}
<li>
<a href="/scrobble?type={{$scrobbleType}}&item={{$result.GetID}}">{{$result.GetDisplayName}}</a>
<a href="{{$result.GetCanonicalURL}}" target="_blank">(🔍more info)</a>
</li>
{{end}}
</ul>
{{ else if .item}}
<form method="POST" action="/scrobble/preview">
<p><a href="/">Add A Post</a> &gt; <a href="/scrobble?type=movie">Add {{ .scrobbleTypeName }}</a> &gt; {{.item.GetDisplayName}}</p>
<h3>{{.item.GetDisplayName}}</h3>
<div class="float-left">
{{if .item.GetThumbnailURL}}
<img class="thumbnail" src="{{.item.GetThumbnailURL}}"/>
{{end}}
</div>
<div>
2022-02-19 15:47:25 +00:00
<label>When: </label> <input type="datetime-local" name='when' value="{{.now}}"/><br/>
<label>Rating: (out of 5)</label> <input type="number" name='rating'/><br/>
<label>Note/Content: </label> <br>
<textarea rows="6" name='content'></textarea>
<br/>
<button type="submit">Preview &gt; &gt;</button>
</div>
<input type="hidden" name="item" value="{{.item.GetID}}"/>
<input type="hidden" name="type" value="{{.scrobbleType}}"/>
</form>
{{ else }}
<form method="GET" action="/scrobble">
<h2><a href="/">Add A Post</a> Add {{ .scrobbleTypeName }}</h2>
<p>Search <b>{{.searchEngine}}</b> for items to scrobble<p>
<input type="text" name="q" placeholder="{{.scrobblePlaceholder}}">
<button type="submit">Next &gt;&gt;</button>
<input type="hidden" name="type" value="{{.scrobbleType}}"/>
</form>
{{end}}
</main>
2022-02-13 15:49:22 +00:00
{{ template "footer.tmpl" . }}
</body>
</html>
{{end}}