micrach/templates/index.html
2021-10-14 11:43:32 +03:00

62 lines
1.6 KiB
HTML

<html lang="en">
<head>
{{ template "static" }}
<link
href="/static/index.css"
rel="stylesheet"
>
{{ template "meta-tags-static" }}
</head>
<body>
<h1 class="display-1 text-center">Welcome to Micrach</h1>
<div class="container">
{{ template "post-form" .FormData }}
<div id="" class="row row-cols-auto gy-4 mb-4">
{{ range $Post := .Threads }}
<div class="col col-sm-6 col-md-4 col-lg-3">
<div class="card">
{{ $length := len $Post.Files }}
{{ if gt $length 0 }}
{{ $FirstFile := index $Post.Files 0 }}
<img
src="/uploads/{{$Post.ID}}/t/{{$FirstFile.ID}}.{{$FirstFile.Ext}}"
class="card-img-top"
alt="Uploaded picture"
>
{{ end }}
<div class="card-body">
{{ if ne $Post.Title "" }}
<h5 class="card-title">{{$Post.Title}}</h5>
{{ end }}
<p class="card-text">{{$Post.Text}}</p>
<a href="/{{$Post.ID}}" class="btn btn-outline-primary">Open</a>
</div>
</div>
</div>
{{ end }}
</div>
<div class="col col-12">
<nav aria-label="Page navigation">
<ul id="pagesList" class="pagination justify-content-center">
{{ $ActivePage := .Page }}
{{ range $i := Iterate .PagesCount }}
<li class="page-item {{ if (eq $i $ActivePage) }} active {{ end }}">
<a class="page-link" href="/?page={{ $i }}">{{ $i }}</a>
</li>
{{ end }}
</ul>
</nav>
</div>
</div>
{{ template "footer" }}
</body>
</html>