aboutsummaryrefslogtreecommitdiff
path: root/cmd/web/templates/users/partials/post-preview.tmpl
blob: 4e00357029a70588f6317ee012dde49c75ac900a (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
<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>