diff options
Diffstat (limited to 'cmd/web/templates/users/partials/post-preview.tmpl')
-rw-r--r-- | cmd/web/templates/users/partials/post-preview.tmpl | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/cmd/web/templates/users/partials/post-preview.tmpl b/cmd/web/templates/users/partials/post-preview.tmpl new file mode 100644 index 0000000..4e00357 --- /dev/null +++ b/cmd/web/templates/users/partials/post-preview.tmpl @@ -0,0 +1,61 @@ +<div id="user-post-preview"> + {{ if .HasArticles }} + {{ $isSelf := .IsSelf }} + {{ 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 "users/partials/article-favorite-button" Dict "Article" $article "IsSelf" $isSelf }} + + </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 |