added "next page" button
This commit is contained in:
parent
8da8999802
commit
6fe3685f92
5 changed files with 77 additions and 26 deletions
|
@ -8,7 +8,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<h1>TailsGo</h1>
|
||||
<h1>Ocásek</h1>
|
||||
<form action="/search" method="post" class="search-form" autocomplete="off">
|
||||
<div class="search-bar">
|
||||
<input type="text" name="q" value="{{ .Query }}" autofocus id="search-input" placeholder="Type to search..." />
|
||||
|
@ -40,7 +40,7 @@
|
|||
<!-- Images Grid -->
|
||||
{{ range .Results }}
|
||||
<div class="image">
|
||||
<a class="clickable" href="{{ .Source }}" target="_blank">
|
||||
<a class="clickable" href="{{ .ThumbProxy }}" target="_blank">
|
||||
<img src="{{ .ThumbProxy }}" alt="{{ .Title }}" data-media="{{ .Media }}">
|
||||
<div class="resolution">{{ .Width }} × {{ .Height }}</div>
|
||||
<div class="details">
|
||||
|
@ -53,12 +53,17 @@
|
|||
</div>
|
||||
<!-- Pagination -->
|
||||
<div class="prev-next prev-img">
|
||||
<!-- Update form action and method according to your app's routing and logic -->
|
||||
<form action="/search" method="get">
|
||||
<input type="hidden" name="q" value="{{ .Query }}">
|
||||
<!-- Pagination buttons, implement pagination logic in your Go handler -->
|
||||
<button type="submit" name="p" value="previous">Previous</button>
|
||||
<button type="submit" name="p" value="next">Next</button>
|
||||
<input type="hidden" name="t" value="image">
|
||||
{{ if .HasPrevPage }}
|
||||
<!-- Subtract 1 from the current page for the Previous button -->
|
||||
<button type="submit" name="p" value="{{ sub .Page 1 }}">Previous</button>
|
||||
{{ end }}
|
||||
{{ if .HasNextPage }}
|
||||
<!-- Add 1 to the current page for the Next button -->
|
||||
<button type="submit" name="p" value="{{ add .Page 1 }}">Next</button>
|
||||
{{ end }}
|
||||
</form>
|
||||
</div>
|
||||
{{ else }}
|
||||
|
@ -66,4 +71,4 @@
|
|||
{{ end }}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
|
@ -8,7 +8,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<h1>TailsGo</h1>
|
||||
<h1>Ocásek</h1>
|
||||
<form action="/search" method="post" class="search-form" autocomplete="off">
|
||||
<div class="search-bar">
|
||||
<input type="text" name="q" value="{{ .Query }}" autofocus id="search-input" placeholder="Type to search..." />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue