summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2021-07-05 06:45:54 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2021-07-05 07:46:10 +0200
commit49b01519bbfcd4219ce77ff9ef7497d4ab1458e0 (patch)
tree0be6ff32ffab41e5a20503b0aa68ec72fd943644 /src/main
parent2f931dece84c0f3f974cbf0d8863046b9268277d (diff)
KB66 Use type-safe templates everywhere.
Change-Id: I879e76e5bbaf91349f6df4637d9dc15291a3ada1
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java15
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/lazychat/LazychatMessage.java8
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java2
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java2
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterUnsubscriber.java2
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java46
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java92
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java19
-rw-r--r--src/main/java/eu/mulk/mulkcms2/cms/about/AboutResource.java11
-rw-r--r--src/main/java/eu/mulk/mulkcms2/cms/privacy/about/PrivacyPolicyResource.java11
-rw-r--r--src/main/resources/templates/benki/bookmarks/newBookmark.html5
-rw-r--r--src/main/resources/templates/benki/posts/postList.html138
-rw-r--r--src/main/resources/templates/benki/wiki/wikiPage.html4
-rw-r--r--src/main/resources/templates/benki/wiki/wikiPageRevisionList.html21
14 files changed, 182 insertions, 194 deletions
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java b/src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java
index bb39be9..a2d8831 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java
@@ -9,9 +9,8 @@ import static javax.ws.rs.core.MediaType.WILDCARD;
import eu.mulk.mulkcms2.benki.posts.Post;
import eu.mulk.mulkcms2.benki.posts.PostFilter;
import eu.mulk.mulkcms2.benki.posts.PostResource;
-import io.quarkus.qute.Template;
+import io.quarkus.qute.CheckedTemplate;
import io.quarkus.qute.TemplateInstance;
-import io.quarkus.qute.api.ResourcePath;
import io.quarkus.security.Authenticated;
import java.io.IOException;
import java.net.URI;
@@ -21,7 +20,6 @@ import java.time.OffsetDateTime;
import java.util.Objects;
import java.util.Set;
import javax.annotation.CheckForNull;
-import javax.inject.Inject;
import javax.json.JsonObject;
import javax.transaction.Transactional;
import javax.validation.constraints.NotEmpty;
@@ -42,9 +40,12 @@ import org.jsoup.Jsoup;
@Path("/bookmarks")
public class BookmarkResource extends PostResource {
- @ResourcePath("benki/bookmarks/newBookmark.html")
- @Inject
- Template newBookmark;
+ @CheckedTemplate(basePath = "benki/bookmarks")
+ static class Templates {
+
+ public static native TemplateInstance newBookmark(
+ @CheckForNull String uri, @CheckForNull String title, @CheckForNull String description);
+ }
public BookmarkResource() throws NoSuchAlgorithmException {
super(PostFilter.BOOKMARKS_ONLY, "Bookmarks");
@@ -124,7 +125,7 @@ public class BookmarkResource extends PostResource {
@QueryParam("uri") @CheckForNull String uri,
@QueryParam("title") @CheckForNull String title,
@QueryParam("description") @CheckForNull String description) {
- return newBookmark.data("uri", uri).data("title", title).data("description", description);
+ return Templates.newBookmark(uri, title, description);
}
@GET
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/lazychat/LazychatMessage.java b/src/main/java/eu/mulk/mulkcms2/benki/lazychat/LazychatMessage.java
index aa5b6eb..f52e05a 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/lazychat/LazychatMessage.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/lazychat/LazychatMessage.java
@@ -8,7 +8,6 @@ import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
-import javax.persistence.Transient;
@Entity
@Table(name = "lazychat_messages", schema = "benki")
@@ -18,13 +17,6 @@ public class LazychatMessage extends Post<LazychatMessageText> {
@JsonbTransient
public Collection<LazychatReference> references;
- @Transient
- @JsonbTransient
- @CheckForNull
- public String getContentHtml() {
- return getDescriptionHtml();
- }
-
@CheckForNull
@Override
public String getUri() {
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java
index 948ef4b..3ad24af 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java
@@ -3,8 +3,8 @@ package eu.mulk.mulkcms2.benki.newsletter;
import static javax.ws.rs.core.MediaType.TEXT_HTML;
import io.quarkus.mailer.MailTemplate.MailTemplateInstance;
+import io.quarkus.qute.CheckedTemplate;
import io.quarkus.qute.TemplateInstance;
-import io.quarkus.qute.api.CheckedTemplate;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import javax.transaction.Transactional;
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java
index 1dacccc..c6999fb 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java
@@ -8,8 +8,8 @@ import eu.mulk.mulkcms2.benki.lazychat.LazychatMessage;
import eu.mulk.mulkcms2.benki.posts.Post;
import io.quarkus.mailer.MailTemplate.MailTemplateInstance;
import io.quarkus.panache.common.Sort;
+import io.quarkus.qute.CheckedTemplate;
import io.quarkus.qute.TemplateExtension;
-import io.quarkus.qute.api.CheckedTemplate;
import io.quarkus.scheduler.Scheduled;
import java.time.LocalDate;
import java.time.OffsetDateTime;
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterUnsubscriber.java b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterUnsubscriber.java
index d157a87..89e292e 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterUnsubscriber.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterUnsubscriber.java
@@ -1,7 +1,7 @@
package eu.mulk.mulkcms2.benki.newsletter;
import io.quarkus.mailer.MailTemplate.MailTemplateInstance;
-import io.quarkus.qute.api.CheckedTemplate;
+import io.quarkus.qute.CheckedTemplate;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java b/src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java
index f783ba0..6c87096 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java
@@ -245,7 +245,23 @@ public abstract class Post<Text extends PostText<?>> extends PanacheEntityBase {
return scope == Scope.top_level;
}
- public static class PostPage<T extends Post<? extends PostText>> {
+ public static class Day<T extends Post<? extends PostText<?>>> {
+ public final @CheckForNull LocalDate date;
+ public final List<T> posts;
+
+ private Day(LocalDate date, List<T> posts) {
+ this.date = date;
+ this.posts = posts;
+ }
+
+ public void cacheDescriptions() {
+ for (var post : posts) {
+ post.getTexts().values().forEach(PostText::getDescriptionHtml);
+ }
+ }
+ }
+
+ public static class PostPage<T extends Post<? extends PostText<?>>> {
public @CheckForNull final Integer prevCursor;
public @CheckForNull final Integer cursor;
public @CheckForNull final Integer nextCursor;
@@ -268,39 +284,23 @@ public abstract class Post<Text extends PostText<?>> extends PanacheEntityBase {
days().forEach(Day::cacheDescriptions);
}
- public class Day {
- public final @CheckForNull LocalDate date;
- public final List<T> posts;
-
- private Day(LocalDate date, List<T> posts) {
- this.date = date;
- this.posts = posts;
- }
-
- public void cacheDescriptions() {
- for (var post : posts) {
- post.getTexts().values().forEach(PostText::getDescriptionHtml);
- }
- }
- }
-
- public List<Day> days() {
+ public List<Day<T>> days() {
return posts.stream()
.collect(Collectors.groupingBy(post -> post.date.toLocalDate()))
.entrySet()
.stream()
- .map(x -> new Day(x.getKey(), x.getValue()))
- .sorted(Comparator.comparing((Day day) -> day.date).reversed())
+ .map(x -> new Day<T>(x.getKey(), x.getValue()))
+ .sorted(Comparator.comparing((Day<T> day) -> day.date).reversed())
.collect(Collectors.toUnmodifiableList());
}
}
- public static PostPage<Post<? extends PostText>> findViewable(
+ public static PostPage<Post<? extends PostText<?>>> findViewable(
PostFilter postFilter, Session session, @CheckForNull User viewer, @CheckForNull User owner) {
return findViewable(postFilter, session, viewer, owner, null, null, null);
}
- public static PostPage<Post<? extends PostText>> findViewable(
+ public static PostPage<Post<? extends PostText<?>>> findViewable(
PostFilter postFilter,
Session session,
@CheckForNull User viewer,
@@ -322,7 +322,7 @@ public abstract class Post<Text extends PostText<?>> extends PanacheEntityBase {
return findViewable(entityClass, session, viewer, owner, cursor, count, searchQuery);
}
- protected static <T extends Post<? extends PostText>> PostPage<T> findViewable(
+ protected static <T extends Post<? extends PostText<?>>> PostPage<T> findViewable(
Class<? extends T> entityClass,
Session session,
@CheckForNull User viewer,
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java
index 495c780..e1ba1aa 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java
@@ -15,13 +15,11 @@ import com.rometools.rome.io.WireFeedOutput;
import eu.mulk.mulkcms2.benki.accesscontrol.PageKey;
import eu.mulk.mulkcms2.benki.accesscontrol.Role;
import eu.mulk.mulkcms2.benki.login.LoginRoles;
-import eu.mulk.mulkcms2.benki.login.LoginStatus;
import eu.mulk.mulkcms2.benki.posts.Post.PostPage;
import eu.mulk.mulkcms2.benki.users.User;
-import io.quarkus.qute.Template;
+import io.quarkus.qute.CheckedTemplate;
import io.quarkus.qute.TemplateExtension;
import io.quarkus.qute.TemplateInstance;
-import io.quarkus.qute.api.ResourcePath;
import io.quarkus.security.identity.SecurityIdentity;
import java.math.BigInteger;
import java.net.URI;
@@ -88,9 +86,22 @@ public abstract class PostResource {
@ConfigProperty(name = "mulkcms.posts.default-max-results")
int defaultMaxResults;
- @ResourcePath("benki/posts/postList.html")
- @Inject
- Template postList;
+ @CheckedTemplate(basePath = "benki/posts")
+ static class Templates {
+
+ public static native TemplateInstance postList(
+ List<Post.Day<Post<? extends PostText<?>>>> postDays,
+ @CheckForNull String feedUri,
+ String pageTitle,
+ Boolean showBookmarkForm,
+ Boolean showLazychatForm,
+ Boolean hasPreviousPage,
+ Boolean hasNextPage,
+ @CheckForNull Integer previousCursor,
+ @CheckForNull Integer nextCursor,
+ @CheckForNull Integer pageSize,
+ @CheckForNull String searchQuery);
+ }
@Inject protected SecurityIdentity identity;
@@ -135,18 +146,18 @@ public abstract class PostResource {
feedUri += "?page-key=" + pageKey.key.toString(36);
}
- return postList
- .data("postDays", q.days())
- .data("feedUri", feedUri)
- .data("pageTitle", pageTitle)
- .data("showBookmarkForm", showBookmarkForm())
- .data("showLazychatForm", showLazychatForm())
- .data("hasPreviousPage", q.prevCursor != null)
- .data("hasNextPage", q.nextCursor != null)
- .data("previousCursor", q.prevCursor)
- .data("nextCursor", q.nextCursor)
- .data("pageSize", maxResults)
- .data("searchQuery", searchQuery);
+ return Templates.postList(
+ q.days(),
+ feedUri,
+ pageTitle,
+ showBookmarkForm(),
+ showLazychatForm(),
+ q.prevCursor != null,
+ q.nextCursor != null,
+ q.prevCursor,
+ q.nextCursor,
+ maxResults,
+ searchQuery);
}
@GET
@@ -173,17 +184,18 @@ public abstract class PostResource {
feedUri += "?page-key=" + pageKey.key.toString(36);
}
- return postList
- .data("postDays", q.days())
- .data("feedUri", feedUri)
- .data("pageTitle", pageTitle)
- .data("showBookmarkForm", showBookmarkForm())
- .data("showLazychatForm", showLazychatForm())
- .data("hasPreviousPage", q.prevCursor != null)
- .data("hasNextPage", q.nextCursor != null)
- .data("previousCursor", q.prevCursor)
- .data("nextCursor", q.nextCursor)
- .data("pageSize", maxResults);
+ return Templates.postList(
+ q.days(),
+ feedUri,
+ pageTitle,
+ showBookmarkForm(),
+ showLazychatForm(),
+ q.prevCursor != null,
+ q.nextCursor != null,
+ q.prevCursor,
+ q.nextCursor,
+ maxResults,
+ null);
}
@Transactional
@@ -214,16 +226,18 @@ public abstract class PostResource {
public TemplateInstance getPostHtml(@PathParam("id") int id) {
var post = getPostIfVisible(id);
- return postList
- .data("postDays", new PostPage<>(null, null, null, List.of(post)).days())
- .data("pageTitle", String.format("Post #%d", id))
- .data("showBookmarkForm", false)
- .data("showLazychatForm", false)
- .data("hasPreviousPage", false)
- .data("hasNextPage", false)
- .data("previousCursor", null)
- .data("nextCursor", null)
- .data("pageSize", null);
+ return Templates.postList(
+ new PostPage<Post<? extends PostText<?>>>(null, null, null, List.of(post)).days(),
+ null,
+ String.format("Post #%d", id),
+ false,
+ false,
+ false,
+ false,
+ null,
+ null,
+ null,
+ null);
}
@GET
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java
index 7b2395d..d50cdc5 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java
@@ -5,10 +5,9 @@ import static javax.ws.rs.core.MediaType.TEXT_HTML;
import eu.mulk.mulkcms2.benki.users.User;
import io.quarkus.panache.common.Sort;
-import io.quarkus.qute.Template;
+import io.quarkus.qute.CheckedTemplate;
import io.quarkus.qute.TemplateExtension;
import io.quarkus.qute.TemplateInstance;
-import io.quarkus.qute.api.ResourcePath;
import io.quarkus.security.Authenticated;
import io.quarkus.security.identity.SecurityIdentity;
import java.net.URI;
@@ -48,13 +47,13 @@ public class WikiResource {
private static final JsonProvider jsonProvider = JsonProvider.provider();
- @ResourcePath("benki/wiki/wikiPage.html")
- @Inject
- Template wikiPage;
+ @CheckedTemplate(basePath = "benki/wiki")
+ static class Templates {
- @ResourcePath("benki/wiki/wikiPageRevisionList.html")
- @Inject
- Template wikiPageRevisionList;
+ public static native TemplateInstance wikiPage(WikiPageRevision page);
+
+ public static native TemplateInstance wikiPageRevisionList(WikiPage page, String title);
+ }
@Inject SecurityIdentity identity;
@@ -78,7 +77,7 @@ public class WikiResource {
throw new NotFoundException();
}
var page = maybePage.get();
- return wikiPage.data("page", page);
+ return Templates.wikiPage(page);
}
@POST
@@ -160,7 +159,7 @@ public class WikiResource {
primaryRevision.page.id)
.singleResult();
- return wikiPageRevisionList.data("page", page).data("title", pageName);
+ return Templates.wikiPageRevisionList(page, pageName);
}
@TemplateExtension
diff --git a/src/main/java/eu/mulk/mulkcms2/cms/about/AboutResource.java b/src/main/java/eu/mulk/mulkcms2/cms/about/AboutResource.java
index a1da033..c112773 100644
--- a/src/main/java/eu/mulk/mulkcms2/cms/about/AboutResource.java
+++ b/src/main/java/eu/mulk/mulkcms2/cms/about/AboutResource.java
@@ -1,8 +1,7 @@
package eu.mulk.mulkcms2.cms.about;
-import io.quarkus.qute.Template;
+import io.quarkus.qute.CheckedTemplate;
import io.quarkus.qute.TemplateInstance;
-import io.quarkus.qute.api.ResourcePath;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -11,12 +10,14 @@ import javax.ws.rs.core.MediaType;
@Path("/about")
public class AboutResource {
- @ResourcePath("benki/about/index.html")
- Template index;
+ @CheckedTemplate(basePath = "benki/about")
+ static class Templates {
+ public static native TemplateInstance index();
+ }
@GET
@Produces(MediaType.TEXT_HTML)
public TemplateInstance getIndex() {
- return index.instance();
+ return Templates.index();
}
}
diff --git a/src/main/java/eu/mulk/mulkcms2/cms/privacy/about/PrivacyPolicyResource.java b/src/main/java/eu/mulk/mulkcms2/cms/privacy/about/PrivacyPolicyResource.java
index 05c155c..5255ee2 100644
--- a/src/main/java/eu/mulk/mulkcms2/cms/privacy/about/PrivacyPolicyResource.java
+++ b/src/main/java/eu/mulk/mulkcms2/cms/privacy/about/PrivacyPolicyResource.java
@@ -1,8 +1,7 @@
package eu.mulk.mulkcms2.cms.privacy.about;
-import io.quarkus.qute.Template;
+import io.quarkus.qute.CheckedTemplate;
import io.quarkus.qute.TemplateInstance;
-import io.quarkus.qute.api.ResourcePath;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -11,12 +10,14 @@ import javax.ws.rs.core.MediaType;
@Path("/privacy")
public class PrivacyPolicyResource {
- @ResourcePath("benki/privacy/index.html")
- Template index;
+ @CheckedTemplate(basePath = "benki/privacy")
+ static class Templates {
+ public static native TemplateInstance index();
+ }
@GET
@Produces(MediaType.TEXT_HTML)
public TemplateInstance getIndex() {
- return index.instance();
+ return Templates.index();
}
}
diff --git a/src/main/resources/templates/benki/bookmarks/newBookmark.html b/src/main/resources/templates/benki/bookmarks/newBookmark.html
index d6a868c..bc469f5 100644
--- a/src/main/resources/templates/benki/bookmarks/newBookmark.html
+++ b/src/main/resources/templates/benki/bookmarks/newBookmark.html
@@ -1,5 +1,6 @@
-{@java.util.List<eu.mulk.mulkcms2.benki.bookmarks.Bookmark> bookmarks}
-{@java.lang.Boolean authenticated}
+{@java.lang.String uri}
+{@java.lang.String title}
+{@java.lang.String description}
{#include base.html}
diff --git a/src/main/resources/templates/benki/posts/postList.html b/src/main/resources/templates/benki/posts/postList.html
index 7039d65..7198af1 100644
--- a/src/main/resources/templates/benki/posts/postList.html
+++ b/src/main/resources/templates/benki/posts/postList.html
@@ -1,13 +1,3 @@
-{@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}
@@ -60,73 +50,71 @@
</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}
+ {#if post.isBookmark}
+ <article class="bookmark {#if post.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">{post.owner.firstName}</span>
+ <a class="post-link" href="/posts/{post.id}">
+ <span class="post-self-link">#</span>
+ </a>
+
+ <a href="{post.uri}" class="bookmark-title">
+ <h1 class="bookmark-title"><span class="bookmark-symbol">🔖 </span> {post.title}</h1>.
+ </a>
</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}
+ </header>
+
+ <div class="bookmark-controls">
+ {#if showBookmarkForm}
+ <button class="pure-button bookmark-edit-button">Edit</button>
+ {/if}
+ </div>
+
+ <section class="bookmark-description post-content">
+ {post.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">{post.owner.firstName}</span>
+ <a class="post-link" href="/posts/{post.id}">
+ <span class="post-self-link">#</span>
+ </a>
</div>
-
- <section class="lazychat-message-content post-content">
- {contentHtml.raw}
- </section>
- </article>
- {/if}
- {/with}
+ </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">
+ {post.descriptionHtml.raw}
+ </section>
+ </article>
+ {/if}
{/for}
</div>
{/for}
diff --git a/src/main/resources/templates/benki/wiki/wikiPage.html b/src/main/resources/templates/benki/wiki/wikiPage.html
index 048c9b3..63d9950 100644
--- a/src/main/resources/templates/benki/wiki/wikiPage.html
+++ b/src/main/resources/templates/benki/wiki/wikiPage.html
@@ -1,5 +1,3 @@
-{@eu.mulk.mulkcms2.benki.wiki.WikiPageRevision page}
-
{#include base.html}
{#title}{page.title} &#8212; Benki Wiki{/title}
@@ -84,7 +82,7 @@
<section id="wiki-page-content">
<div data-editable data-name="wiki-content" id="wiki-content">
- {#with page}{enrichedContent.raw}{/}
+ {page.enrichedContent.raw}
</div>
</section>
diff --git a/src/main/resources/templates/benki/wiki/wikiPageRevisionList.html b/src/main/resources/templates/benki/wiki/wikiPageRevisionList.html
index eacad4b..ca84fcb 100644
--- a/src/main/resources/templates/benki/wiki/wikiPageRevisionList.html
+++ b/src/main/resources/templates/benki/wiki/wikiPageRevisionList.html
@@ -1,6 +1,3 @@
-{@eu.mulk.mulkcms2.benki.wiki.WikiPage page}
-{@java.lang.String title}
-
{#include base.html}
{#title}Revisions &#8212; {title} &#8212; Benki Wiki{/title}
@@ -25,17 +22,13 @@
</thead>
<tbody>
- {#with page}
- {#for revision in revisions}
- <tr>
- {#with revision}
- <td>{date.humanDateTime}</td>
- <td>{title}</td>
- <td>{author.firstName}</td>
- {/with}
- </tr>
- {/for}
- {/with}
+ {#for revision in page.revisions}
+ <tr>
+ <td>{revision.date.humanDateTime}</td>
+ <td>{revision.title}</td>
+ <td>{revision.author.firstName}</td>
+ </tr>
+ {/for}
</tbody>
</table>
</main>