-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
87 lines (85 loc) · 2.73 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cinerank</title>
<link rel="stylesheet" href="/assets/style.css" />
</head>
<body>
<main>
<header>
<a href="/" class="logo">Cinerank</a>
<form action="/search" method="GET">
<input
autofocus
class="search-input"
value="{{.Query}}"
placeholder="Enter a movie title"
type="search"
name="q"
/>
</form>
<a
href="https://github.com/nyae44/cinerank"
class="button github-button"
>View on Github</a
>
</header>
<section class="container">
<div class="results-count">
{{if .Results }} {{if (gt .Results.TotalResults 0)}}
<p>
About <strong>{{.Results.TotalResults}}</strong> results were found.
You are on page <strong>{{.CurrentPage}}</strong> of <strong>{{.TotalPages}}</strong>
</p>
{{else if and (ne .Query "") (eq .Results.TotalResults 0)}}
<p>No results found for your query: <strong>{{ .Query}}</strong>.</p>
{{end}} {{end}}
</div>
<ul class="search-results">
{{ range .Results.Results }}
<li class="movie-article">
<div>
<a
target="_blank"
rel="noreferrer noopener"
href="/movies/{{ .ID }}"
>
<h3 class="title">{{ .Title }}</h3>
</a>
<p class="description">{{ .Overview }}</p>
<div class="metadata">
<p class="release-date">{{ .ReleaseDate }}</p>
<p class="popularity">Popularity: {{ .Popularity }}</p>
<p class="vote-average">Rating: {{ .VoteAverage }}</p>
</div>
</div>
<img
class="movie-poster"
src="https://image.tmdb.org/t/p/w500{{ .PosterPath }}"
alt="Poster for {{ .Title }}"
/>
</li>
{{ end }}
</ul>
<div class="pagination">
{{ if . }} {{ if (gt .NextPage 2) }}
<a
href="/search?q={{ .Query }}&page={{ .PreviousPage }}"
class="button previous-page"
>Previous</a
>
{{ end }} {{ if (ne .IsLastPage true) }}
<a
href="/search?q={{ .Query }}&page={{ .NextPage }}"
class="button next-page"
>Next</a
>
{{ end }} {{ end }}
</div>
</section>
</main>
<script src="/assets/script.js"></script>
</body>
</html>