summaryrefslogtreecommitdiff
path: root/src/main/resources/templates/benki/posts/postList.html
blob: 7039d652b8a1e6f00b4adb1a9dc866d03a6bcc56 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
{@java.util.List<eu.mulk.mulkcms2.benki.posts.Post.PostPage<eu.mulk.mulkcms2.benki.posts.Post>.Day>  postDays}
{@java.lang.String pageTitle}
{@java.lang.Boolean showBookmarkForm}
{@java.lang.Boolean hasPreviousPage}
{@java.lang.Boolean hasNextPage}
{@java.lang.Integer previousCursor}
{@java.lang.Integer nextCursor}
{@java.lang.Integer pageSize}
{@java.lang.String searchQuery}

{#include base.html}

{#title}Benki {pageTitle}{/title}
{#siteSection}{pageTitle}{/siteSection}

{#nav}{#navbar siteSection=pageTitle /}

{#head}
  <link href="{feedUri}" rel="alternate" type="application/atom+xml" />

  {#if showBookmarkForm || showLazychatForm}
  <script type="module" src="/lib.js"></script>
  {/if}
{/head}

{#body}

{#if showBookmarkForm}
  <elix-expandable-section id="bookmark-submission-pane">
    <h2 slot="header" class="small-title expandable-section-title"><button class="pure-button">Create New Bookmark</button></h2>
    <section id="bookmark-submission">
      <mlk-bookmark-submission-form id="bookmark-submission-form"></mlk-bookmark-submission-form>
    </section>
  </elix-expandable-section>
{/if}

{#if showLazychatForm}
  <elix-expandable-section id="lazychat-submission-pane">
    <h2 slot="header" class="small-title expandable-section-title"><button class="pure-button">Post Message</button></h2>
    <section id="lazychat-submission">
      <mlk-lazychat-submission-form id="lazychat-submission-form"></mlk-lazychat-submission-form>
    </section>
  </elix-expandable-section>
{/if}

<div class="paging">
  <form id="post-search-bar" method="get" class="pure-form">
    <input placeholder="Search..." value="{searchQuery}" aria-label="Search" id="post-search-query" name="search-query" type="search"/>
    <input type="submit" aria-label="Submit search query" class="pure-button pure-button-primary" value="&#x1f50e;"/>
  </form>
  {#if hasPreviousPage}<a href="?i={previousCursor}&n={pageSize}&search-query={searchQuery}" class="pure-button">⇠ previous page</a>{/if}
  {#if hasNextPage}<a href="?i={nextCursor}&n={pageSize}&search-query={searchQuery}" class="pure-button">next page ⇢</a>{/if}
</div>

<section id="main-content">
  {#for day in postDays}
    <div class="post-day">
      <div class="post-day-info">
        <time datetime="{day.date.htmlDate}">{day.date.humanDate}</time>
      </div>

      {#for post in day.posts}
        {#with post}
          {#if post.isBookmark}
            <article class="bookmark {#if descriptionHtml != ""}post-with-nonempty-body{/if}">
              <section class="bookmark-editor post-editor">
                {#if showBookmarkForm}
                <elix-expandable-panel class="bookmark-editor-pane editor-pane">
                  <mlk-bookmark-submission-form edited-id="{post.id}"></mlk-bookmark-submission-form>
                </elix-expandable-panel>
                {/if}
              </section>

              <header>
                <div class="bookmark-info">
                  <span class="bookmark-owner post-owner">{owner.firstName}</span>
                  <a class="post-link" href="/posts/{post.id}">
                    <span class="post-self-link">#</span>
                  </a>

                  <a href="{uri}" class="bookmark-title">
                    <h1 class="bookmark-title"><span class="bookmark-symbol">🔖 </span> {title}</h1>.
                  </a>
                </div>
              </header>

              <div class="bookmark-controls">
                {#if showBookmarkForm}
                <button class="pure-button bookmark-edit-button">Edit</button>
                {/if}
              </div>

              <section class="bookmark-description post-content">
                {descriptionHtml.raw}
              </section>

              <section class="comment-box"></section>
            </article>
          {#else}
            <article class="lazychat-message">
              <section class="lazychat-editor post-editor">
                {#if showLazychatForm}
                <elix-expandable-panel class="lazychat-editor-pane editor-pane">
                  <mlk-lazychat-submission-form edited-id="{post.id}"></mlk-lazychat-submission-form>
                </elix-expandable-panel>
                {/if}
              </section>

              <header>
                <div class="lazychat-message-info">
                  <span class="lazychat-message-owner post-owner">{owner.firstName}</span>
                  <a class="post-link" href="/posts/{post.id}">
                    <span class="post-self-link">#</span>
                  </a>
                </div>
              </header>

              <div class="lazychat-message-controls">
                {#if showLazychatForm}
                <button class="pure-button lazychat-edit-button">Edit</button>
                {/if}
              </div>

              <section class="lazychat-message-content post-content">
                {contentHtml.raw}
              </section>
            </article>
          {/if}
        {/with}
      {/for}
    </div>
  {/for}
</section>

<div class="paging">
  {#if hasPreviousPage}<a href="?i={previousCursor}&n={pageSize}&search-query={searchQuery}" class="pure-button">⇠ previous page</a>{/if}
  <span class="filler"></span>
  {#if hasNextPage}<a href="?i={nextCursor}&n={pageSize}&search-query={searchQuery}" class="pure-button">next page ⇢</a>{/if}
</div>

{/body}

{/include}