add layout template

This commit is contained in:
Minecon724 2024-09-14 13:14:25 +02:00
parent d27b50afa0
commit 5c965eb61d
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8
12 changed files with 176 additions and 131 deletions

View file

@ -1,18 +1,20 @@
<h1>Login</h1> {#include layout}
{#pageTitle}Login{/pageTitle}
<p>To log in, submit your credentials.</p> <p>To log in, submit your credentials.</p>
<p>To register, submit desired credentials.</p> <p>To register, submit desired credentials.</p>
{#if message != null} {#if message != null}
<h3>{message}</h3> <h3>{message}</h3>
{/if} {/if}
<form method="post" action="/auth/action/login"> <form method="post" action="/auth/action/login">
<label for="username">Username</label> <label for="username">Username</label>
<input type="text" id="username" name="username"> <input type="text" id="username" name="username">
<br> <br>
<label for="password">Password</label> <label for="password">Password</label>
<input type="password" id="password" name="password"> <input type="password" id="password" name="password">
<br> <br>
<input type="submit"> <input type="submit">
</form> </form>
{/include}

View file

@ -1,2 +1,6 @@
<p>Logged in as {username}</p> {#include layout}
<p><a href="/auth/logout">Log out</a></p> {#pageTitle}Account{/pageTitle}
<p>Logged in as {username}</p>
<p><a href="/auth/logout">Log out</a></p>
{/include}

View file

@ -1,13 +1,17 @@
<p>Registering as <strong>{username}</strong></p> {#include layout}
{#pageTitle}Register{/pageTitle}
{#if message != null} {#if message != null}
<h3>{message}</h3> <h3>{message}</h3>
{/if} {/if}
<form method="post" action="/auth/action/register"> <form method="post" action="/auth/action/register">
<input type="hidden" name="username" value="{username}"> <label for="username">Username</label>
<label for="password">Confirm password</label> <input type="text" id="username" name="username" disabled value="{username}">
<input type="password" id="password" name="password"> <br>
<br> <label for="password">Confirm password</label>
<input type="submit" value="Register"> <input type="password" id="password" name="password">
</form> <br>
<input type="submit" value="Register">
</form>
{/include}

View file

@ -1,17 +1,19 @@
<h1>Creating a page</h1> {#include layout}
{#pageTitle}Create a page{/pageTitle}
<p>Editing as {user:name}</p> <p>Editing as {user:name}</p>
<form action="/action/create" method="post"> <form action="/action/create" method="post">
<label for="title">Title</label> <label for="title">Title</label>
<input type="text" name="title" id="title" value="{title}"> <input type="text" name="title" id="title" value="{title}">
<br> <br>
<label for="content">Content</label> <label for="content">Content</label>
<textarea id="content" name="content"></textarea> <textarea id="content" name="content"></textarea>
<br> <br>
<input type="submit"> <input type="submit">
</form> </form>
{#if http:param("error") != null} {#if http:param("error") != null}
<p>Error: <strong>{http:param("error")}</strong></p> <p>Error: <strong>{http:param("error")}</strong></p>
{/if} {/if}
{/include}

View file

@ -1,14 +1,16 @@
<h1>Editing {page.title}</h1> {#include layout}
{#pageTitle}Editing {page.title}{/pageTitle}
<p>Editing as {user:name}</p> <p>Editing as {user:name}</p>
<form action="/action/edit" method="post"> <form action="/action/edit" method="post">
<input type="hidden" name="title" value="{page.title}"> <input type="hidden" name="title" value="{page.title}">
<textarea id="content" name="content">{content}</textarea> <textarea id="content" name="content">{content}</textarea>
<br> <br>
<input type="submit"> <input type="submit">
</form> </form>
{#if http:param("error") != null} {#if http:param("error") != null}
<p>Error: <strong>{http:param("error")}</strong></p> <p>Error: <strong>{http:param("error")}</strong></p>
{/if} {/if}
{/include}

View file

@ -1,26 +1,28 @@
<h1>History of {page.getTitle}</h1> {#include layout}
{#pageTitle}History of {page.getTitle}{/pageTitle}
{#for revision in revisions} {#for revision in revisions}
{#if page.latestRevision == revision} {#if page.latestRevision == revision}
<span> <span>
<strong> <strong>
<a href="/page/{page.getTitle}?revision={revision.getIndex}">#{revision.getIndex}</a>
({revision.getDelta}) {revision.getTimestamp.toString()} by
<a href="/user/{revision.getAuthor.getSlug}">{revision.getAuthor.getName}</a>
</strong>
</span>
{#else}
<span>
<a href="/page/{page.getTitle}?revision={revision.getIndex}">#{revision.getIndex}</a> <a href="/page/{page.getTitle}?revision={revision.getIndex}">#{revision.getIndex}</a>
({revision.getDelta}) {revision.getTimestamp.toString()} by ({revision.getDelta}) {revision.getTimestamp.toString()} by
<a href="/user/{revision.getAuthor.getSlug}">{revision.getAuthor.getName}</a> <a href="/user/{revision.getAuthor.getSlug}">{revision.getAuthor.getName}</a>
</strong> </span>
</span> {/if}
{#else} <br>
<span> {/for}
<a href="/page/{page.getTitle}?revision={revision.getIndex}">#{revision.getIndex}</a>
({revision.getDelta}) {revision.getTimestamp.toString()} by
<a href="/user/{revision.getAuthor.getSlug}">{revision.getAuthor.getName}</a>
</span>
{/if}
<br>
{/for}
<ul> <ul>
<li><a href="/page/{page.getSlug}">Back to {page.getTitle}</a></li> <li><a href="/page/{page.getSlug}">Back to {page.getTitle}</a></li>
<li><a href="/page/Talk:{page.getSlug}">Talk:{page.getTitle}</a></li> <li><a href="/page/Talk:{page.getSlug}">Talk:{page.getTitle}</a></li>
<li><a href="/edit/{page.getSlug}">Edit page</a></li> <li><a href="/edit/{page.getSlug}">Edit page</a></li>
</ul> </ul>
{/include}

View file

@ -1,8 +1,10 @@
<h1>{title}</h1> {#include layout}
{#pageTitle}{title}{/pageTitle}
Page titled "{title}" doesn't exist. There's no history to show. Page titled "{title}" doesn't exist. There's no history to show.
<ul> <ul>
<li><a href="/edit/{path}">Create it</a></li> <li><a href="/edit/{path}">Create it</a></li>
<li><a href="/">Go home</a></li> <li><a href="/">Go home</a></li>
</ul> </ul>
{/include}

View file

@ -1,15 +1,19 @@
<form action="/search"> {#include layout customTitle=true}
<input type="text" name="query" id="query" placeholder="Search query"> {#pageTitle}TalkPages{/pageTitle}
<input type="submit" value="Search">
</form>
<ul> <form action="/search">
<li><a href="/edit">Create a page</a></li> <input type="text" name="query" id="query" placeholder="Search query">
{#if !user:loggedIn} <input type="submit" value="Search">
</form>
<ul>
<li><a href="/edit">Create a page</a></li>
{#if !user:loggedIn}
<li><a href="/auth">Login or register</a></li> <li><a href="/auth">Login or register</a></li>
{#else} {#else}
<li><a href="/auth/logout">Logout ({user:name})</a></li> <li><a href="/auth/logout">Logout ({user:name})</a></li>
{/if} {/if}
</ul> </ul>
<small>Running <a href="/page/TalkPages">TalkPages</a> version {config:["quarkus.application.version"]}</small> <small>Running <a href="/page/TalkPages">TalkPages</a> version {config:["quarkus.application.version"]}</small>
{/include}

View file

@ -1,18 +1,20 @@
<h1>{title}</h1> {#include layout}
{#pageTitle}{title}{/pageTitle}
<p>There is no such article.</p> <p>There is no such article.</p>
{#if !suggestions.isEmpty()} {#if !suggestions.isEmpty()}
<p>Are you looking for:</p> <p>Are you looking for:</p>
<ul> <ul>
{#for suggestion in suggestions} {#for suggestion in suggestions}
<li><a href="/page/{suggestion.getSlug}">{suggestion.getTitle}</a></li> <li><a href="/page/{suggestion.getSlug}">{suggestion.getTitle}</a></li>
{/for} {/for}
</ul> </ul>
<p>Actions:</p> <p>Actions:</p>
{/if} {/if}
<ul> <ul>
<li><a href="/edit/{title}">Create</a></li> <li><a href="/edit/{title}">Create</a></li>
<li><a href="/">Go home</a></li> <li><a href="/">Go home</a></li>
</ul> </ul>
{/include}

View file

@ -1,24 +1,28 @@
{#if http:param("redirectFrom") != null} {#include layout}
<p>Redirected from {http:param("redirectFrom")}</p> {#header}
{/if} {#if http:param("redirectFrom") != null}
<p>Redirected from {http:param("redirectFrom")}</p>
{/if}
{#if old} {#if old}
{#if page.latestRevision != revision} {#if page.latestRevision != revision}
<h3> <h3>
You are viewing an outdated revision #{revision.getIndex} of this page from {revision.getTimestamp.toString()}, authored by {revision.getAuthor.getName}. You are viewing an outdated revision #{revision.getIndex} of this page from {revision.getTimestamp.toString()}, authored by {revision.getAuthor.getName}.
<br> <br>
<a href="/page/{page.getTitle}">See current version</a> <a href="/page/{page.getTitle}">See current version</a>
</h3> </h3>
{#else} {#else}
<h4>This is the current revision #{revision.index} authored by {revision.author.name}.</h4> <h4>This is the current revision #{revision.index} authored by {revision.author.name}.</h4>
{/if} {/if}
{/if} {/if}
{/header}
<h1>{page.title}</h1> {#pageTitle}{page.title}{/pageTitle}
{revision.content.sanitizeContent.raw} {revision.content.sanitizeContent.raw}
<br><br> <br><br>
<small>Modified {revision.timestamp.toString()} | <a href="/history/{page.getSlug}">Full history</a> | <a href="/edit/{page.getSlug}">Edit</a> <small>Modified {revision.timestamp.toString()} | <a href="/history/{page.getSlug}">Full history</a> | <a href="/edit/{page.getSlug}">Edit</a>
{#if !page.title.startsWith("Talk:")} | <a href="/page/Talk:{page.getSlug}">Talk</a>{/if}</small> {#if !page.title.startsWith("Talk:")} | <a href="/page/Talk:{page.getSlug}">Talk</a>{/if}</small>
{/include}

View file

@ -1,7 +1,9 @@
<h1>{page.getTitle}</h1> {#include layout}
{#pageTitle}{page.getTitle}{/pageTitle}
There is no revision #{revisionId}. There is no revision #{revisionId}.
<ul> <ul>
<li><a href="/history/{page.getSlug}">View history</a></li> <li><a href="/history/{page.getSlug}">View history</a></li>
<li><a href="/page/{page.getSlug}">Back to {page.getTitle}</a></li> <li><a href="/page/{page.getSlug}">Back to {page.getTitle}</a></li>
</ul> </ul>
{/include}

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- TODO opengraph tags and maybe some nice css. also add errors and stuff here -->
<title>{#insert pageTitle /}{#if !customTitle??} - TalkPages{/if}</title> <!-- I give up -->
</head>
<body>
{#insert header}{/}
<h1>{#insert pageTitle /}</h1>
{#insert}{/}
</body>
</html>