summaryrefslogtreecommitdiff
path: root/src/main/resources
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2020-03-16 11:13:54 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2020-03-16 11:13:54 +0100
commit3f8a26c6fb88757cd3f5646838c177e711fcab76 (patch)
tree2ed647f18054aa5ce013c25aa8af01621b434417 /src/main/resources
parent84db379e6806b7c4603a9f86452ee3d8a1fd7e0b (diff)
Bookmarks: Add paging.
Change-Id: Icd53dd04a74b94e1fa80f23703348070d598c413
Diffstat (limited to 'src/main/resources')
-rw-r--r--src/main/resources/META-INF/resources/cms2/base.css34
-rw-r--r--src/main/resources/application.properties1
-rw-r--r--src/main/resources/templates/benki/bookmarks/bookmarkList.html63
3 files changed, 75 insertions, 23 deletions
diff --git a/src/main/resources/META-INF/resources/cms2/base.css b/src/main/resources/META-INF/resources/cms2/base.css
index ec84ca9..61f447c 100644
--- a/src/main/resources/META-INF/resources/cms2/base.css
+++ b/src/main/resources/META-INF/resources/cms2/base.css
@@ -124,7 +124,18 @@ body > main {
background-color: var(--main-bg-color);
padding: 10px;
border-left: 1px solid lightgray;
- overflow: scroll;
+ overflow: auto;
+
+ display: flex;
+ flex-direction: column;
+}
+
+main > * {
+ margin-top: 0.5rem;
+}
+
+main > *:first-child {
+ margin-top: 0;
}
body > footer {
@@ -175,3 +186,24 @@ article.lazychat-message {
#bookmark-submission textarea {
min-width: calc(100% - 12em);
}
+
+.paging {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap-reverse;
+}
+
+.paging > .filler {
+ flex: 1;
+}
+
+.paging > a {
+ flex-grow: 0;
+ flex-shrink: 1;
+ flex-basis: content;
+}
+
+elix-expandable-section .expandable-section-title {
+ margin-top: 0;
+ margin-bottom: 0;
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 50423c0..b90cc9e 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -8,6 +8,7 @@ quarkus.log.level = INFO
#quarkus.log.category."io.vertx.ext.jwt".level = FINEST
mulkcms.tag-base = hub.benkard.de
+mulkcms.bookmarks.default-max-results = 25
quarkus.datasource.driver = org.postgresql.Driver
quarkus.datasource.max-size = 8
diff --git a/src/main/resources/templates/benki/bookmarks/bookmarkList.html b/src/main/resources/templates/benki/bookmarks/bookmarkList.html
index 9b5025c..290cb26 100644
--- a/src/main/resources/templates/benki/bookmarks/bookmarkList.html
+++ b/src/main/resources/templates/benki/bookmarks/bookmarkList.html
@@ -1,5 +1,10 @@
{@java.util.List<eu.mulk.mulkcms2.benki.bookmarks.Bookmark> bookmarks}
{@java.lang.Boolean authenticated}
+{@java.lang.Boolean hasPreviousPage}
+{@java.lang.Boolean hasNextPage}
+{@java.lang.Integer previousCursor}
+{@java.lang.Integer nextCursor}
+{@java.lang.Integer pageSize}
{#include base.html}
@@ -9,40 +14,54 @@
{#head}
<link href="{feedUri}" rel="alternate" type="application/atom+xml" />
-{/head}
-
-{#body}
-{! #if authenticated !}
<script type="module" src="/web_modules/elix/define/ExpandableSection.js"></script>
<script type="module" src="/bookmarks/MlkBookmarkSubmissionForm.js"></script>
<script type="module" src="/bookmarks/bookmarkList.js" defer></script>
+{/head}
+{#body}
+
+{! #if authenticated !}
<elix-expandable-section id="bookmark-submission-pane">
- <h2 slot="header" class="small-title"><button class="pure-button">Create New Bookmark</button></h2>
+ <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 !}
-{#for bookmark in bookmarks}
- {#with bookmark}
- <article class="bookmark">
- <header>
- <a href="{uri}"><h1 class="bookmark-title">{title}</h1></a>
- <div class="bookmark-info">
- <time datetime="{date.htmlDateTime}">{date.humanDateTime}</time>
- <span class="bookmark-owner">{owner.firstName} {owner.lastName}</span>
- </div>
- </header>
-
- <section class="bookmark-description">
- {descriptionHtml.raw}
- </section>
- </article>
- {/with}
-{/for}
+<div class="paging">
+ {#if hasPreviousPage}<a href="?i={previousCursor}&n={pageSize}" class="pure-button">⇠ previous page</a>{/if}
+ <span class="filler"></span>
+ {#if hasNextPage}<a href="?i={nextCursor}&n={pageSize}" class="pure-button">next page ⇢</a>{/if}
+</div>
+
+<section id="main-content">
+ {#for bookmark in bookmarks}
+ {#with bookmark}
+ <article class="bookmark">
+ <header>
+ <a href="{uri}"><h1 class="bookmark-title">{title}</h1></a>
+ <div class="bookmark-info">
+ <time datetime="{date.htmlDateTime}">{date.humanDateTime}</time>
+ <span class="bookmark-owner">{owner.firstName} {owner.lastName}</span>
+ </div>
+ </header>
+
+ <section class="bookmark-description">
+ {descriptionHtml.raw}
+ </section>
+ </article>
+ {/with}
+ {/for}
+</section>
+
+<div class="paging">
+ {#if hasPreviousPage}<a href="?i={previousCursor}&n={pageSize}" class="pure-button">⇠ previous page</a>{/if}
+ <span class="filler"></span>
+ {#if hasNextPage}<a href="?i={nextCursor}&n={pageSize}" class="pure-button">next page ⇢</a>{/if}
+</div>
{/body}