diff options
author | Vikas Kushwaha <dev@vikas.rocks> | 2025-02-11 16:31:08 +0530 |
---|---|---|
committer | Vikas Kushwaha <dev@vikas.rocks> | 2025-02-11 16:31:08 +0530 |
commit | 57eb8f6712361a3bf75983ce153fac4846dc0273 (patch) | |
tree | 269a168d59c917c4e313c819e2b4c3ff8175f912 /cmd/web/templates/home/partials/post-preview.tmpl |
Initial commit
Diffstat (limited to 'cmd/web/templates/home/partials/post-preview.tmpl')
-rw-r--r-- | cmd/web/templates/home/partials/post-preview.tmpl | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/cmd/web/templates/home/partials/post-preview.tmpl b/cmd/web/templates/home/partials/post-preview.tmpl new file mode 100644 index 0000000..7ef2111 --- /dev/null +++ b/cmd/web/templates/home/partials/post-preview.tmpl @@ -0,0 +1,60 @@ +<div id="feed-post-preview" hx-swap-oob="true"> + {{ if .HasArticles }} + {{ range $article := .Articles }} + + <div class="post-preview"> + <div class="post-meta"> + <a href="/users/{{ $article.User.Username }}" + hx-push-url="/users/{{ $article.User.Username }}" + hx-get="/htmx/users/{{ $article.User.Username }}" + hx-target="#app-body" + > + <img src="{{ $article.User.Image }}" /> + </a> + + <div class="info"> + <a href="/users/{{ $article.User.Username }}" + hx-push-url="/users/{{ $article.User.Username }}" + hx-get="/htmx/users/{{ $article.User.Username }}" + hx-target="#app-body" + class="author" + > + {{ $article.User.Name }} + </a> + <span class="date">{{ $article.GetFormattedCreatedAt }}</span> + </div> + + {{ template "home/partials/article-favorite-button" $article }} + + </div> + <a href="/articles/{{ $article.Slug }}" + hx-push-url="/articles/{{ $article.Slug }}" + hx-get="/htmx/articles/{{ $article.Slug }}" + hx-target="#app-body" + class="preview-link" + > + <h1>{{ $article.Title }}</h1> + <p>{{ $article.Description }}</p> + + <div class="m-t-1"> + <span>Read more...</span> + + <ul class="tag-list"> + {{ range $tag := $article.Tags }} + <li class="tag-default tag-pill tag-outline">{{ $tag.Name }}</li> + {{ end }} + </ul> + </div> + </a> + </div> + {{ end }} + {{ end }} + + {{ if not .HasArticles }} + <div class="post-preview"> + <div class="alert alert-warning" role="alert"> + No articles are here... yet. + </div> + </div> + {{ end }} +</div>
\ No newline at end of file |