aboutsummaryrefslogtreecommitdiff
path: root/views/pages/list.html
blob: 6d4d1122a67fe4930133fb3d260e7c17b66c0d40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{{ define "list" }}
{{ $list := .list }}
{{ $user := .user }}
<html>
	<head>
		{{ template "materialize" }}
		{{ template "js" "like" }}
		<title>grilist</title>
		<link rel="stylesheet" href="/assets/css/list.css" />
		<link rel="stylesheet" href="/assets/css/search.css" />
		<script src="/assets/js/list.js"></script>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
	</head>
	<body>
		{{ template "navbar" . }}
		<div class="container">
			{{ if .isOwner }}<div class="row valign-wrapper">
				<div class="col s10">{{ end }}
					<h1>{{ $list.Name }} <small>von <a href="/user/{{ $list.Owner.ID }}/{{ $list.Owner.GetName}}">{{ $list.Owner.GetName }}</a></small></h1>
				{{ if .isOwner }}</div>
				<div class="col s2 right-align">
					<a class="waves-effect waves-light purple lighten-4 btn" style="margin-top: 8px; width: auto" href="/list/{{ $list.ID }}/settings">
						<i class="material-icons">settings</i> 
					</a>
					{{ if $user.HasExternalServices }}
					<a class="waves-effect waves-light green lighten-4 dropdown-button btn" data-constrainwidth="false" data-beloworigin="true" data-activates="import-dropdown" style="margin-top: 8px; width: auto">
						<i class="material-icons">file_download</i> 
					</a>
					<ul id="import-dropdown" class="dropdown-content">
						{{ if and $user.AnilistClient $user.AnilistClient.IsCoupled }}
						<li><a id="import-from-anilist">Von Anilist importieren</a></li>
						{{ end }}
					</ul>
					{{ end }}
				</div>
			</div>{{ end }}
			<blockquote>{{ $list.Description }}</blockquote><br />
			{{ if isSameUser $user $list.Owner }}
			{{ template "like" (map "ContentType" 0 "ContentID" $list.ID) }}
			{{ else }}
			{{ template "like" (map "ContentType" 0 "ContentID" $list.ID "User" $user) }}
			{{ end }}
			<div class="row">
				<div class="col s12 {{ if ($user) and eq $user.ID $list.Owner.ID }}l8{{ end }}">
					<ul id="gril-list" class="gril-list">
					{{ range $index, $lg := $list.Grils }}
						{{ if $user }}
							{{ template "list_gril" makeRangePair $index (makeObject "Gril" $lg "IsListOwner" (eq $user.ID $list.Owner.ID)) }}
						{{ else }}
							{{ template "list_gril" makeRangePair $index (makeObject "Gril" $lg "IsListOwner" false) }}
						{{ end }}
					{{ end }}
					</ul>
				</div>
				{{ if .isOwner }}
				<div class="col s12 l4">
					<div class="card-panel" style="margin-top: 14px">
						<span style="font-size: 130%">Gril hinzufügen</span><br />
						<form>
							<div class="input-field">
								<input id="gril-add-search" class="gril-search" type="search" required>
								<label for="gril-add-search"><i class="material-icons">search</i></label>
								<i class="material-icons">close</i>
							</div>
						</form>
					</div>
					<div class="col s10 offset-s1">
						<ul class="collection search-results" id="search-results">
						</ul>
					</div>
				</div>
				{{ end }}
			</div>
		</div>
		<div id="gril-merge-modal" class="modal">
			<div class="modal-content">
				<h4>Gril zuordnen</h4>
				<p>Bitte Ordne deinem Anilist Favoriten ein Gril auf Grilist zu.</p>
				<div class="row center-align">
					<img id="gril-merge-modal-image">
				</div>
				<h4 id="gril-merge-modal-name"></h4>
				<div id="gril-merge-modal-template">
					{{ template "card" .mergeTemplateCard }}
				</div>
				<div id="gril-merge-modal-targets" class="row">
				</div>
			</div>
			<div class="modal-footer">
				<a class=" modal-action modal-close waves-effect waves-green btn-flat">Abbrechen</a>
			</div>
		</div>
		{{ template "materialize_js" }}
	</body>
</html>
{{ end }}