summaryrefslogtreecommitdiff
path: root/src/web/templates/views/posts.html
blob: e992564e3115edecfc7c6a523b12bb9d69a32e99 (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
{{ define "views/posts.html" }}
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width,initial-scale=1" />
  <meta name="description" content="BLOG DESCRIPTION GHERE" />
  <link type="text/css" rel="stylesheet" href="/css/styles.css">
  <link type="text/css" rel="stylesheet" href="/css/posts.css">
  <title>
    Index Page
  </title>
</head>
<body>
  {{ template "partials/navbar.html" .}}
  {{ template "partials/tags_menu.html" .}}
  <article>
    <div class="options" id="options-header">
      <span class="limit-options">
        Posts to show per page: 
        {{ range .LimitOptions }}
          <a href="?page={{ $.PageNumber }}&limit={{ . }}&first={{ $.FirstPost }}&sort_by={{ if $.SortByOldest }}oldest{{ else }}newest{{ end }}"
            class="{{ if eq . $.Limit }}active{{- end }}">
            {{ . }}
          </a> 
        {{ end }}
      </span>
      <span id="page-sort">
        Currently sorting by {{ if .SortByOldest }}oldest{{ else }}newest{{ end }} first.
        <!--a href="?page={{ .PageNumber }}&limit={{ .Limit }}&first={{ .FirstPost }}&sort_by={{ if .SortByOldest }}newest{{ else }}oldest{{ end }}"-->
        <a href="?limit={{ .Limit }}&sort_by={{ if .SortByOldest }}newest{{ else }}oldest{{ end }}">
          Sort by {{ if .SortByOldest }}newest{{ else }}oldest{{ end }} first?
        </a>
      </span>
    </div>
    <div class="posts">
      {{ range .Posts }}
        <div class="post">
          <span class="post-title-tags">
            <a class="post-title" href="{{ .ID }}">{{ .Title }}</a>
            <span class="post-tags">
              {{ range .Tags }}
                <a class="post-tag" href="/posts?tags={{ .ID }}">{{ .Name }}</a>
              {{ end }}
            </span>
          </span>
          <div class="post-info">
            <span class="post-createdat">{{ .CreatedAt }}</span>
          </div>
        </div>
      {{ end }}
    </div>
    <div class="options" id="options-footer">
      <span class="paging-options">
        {{ if .ShowPrev }}
          <a href="?page={{ .PrevPage }}&limit={{ .Limit }}&first={{ .PrevFirst }}&sort_by={{ if .SortByOldest }}oldest{{ else }}newest{{ end }}">Previous Page</a>
        {{- end }}

        {{ if .ShowNext }}
        <a href="?page={{ .NextPage }}&limit={{ .Limit }}&first={{ .NextFirst }}&sort_by={{ if .SortByOldest }}oldest{{ else }}newest{{ end }}">Next Page</a>
        {{- end }}
      </span>
    </div>
  </article>
</body>
</html>
{{ end }}