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 register, submit desired credentials.</p>
<p>To log in, submit your credentials.</p>
<p>To register, submit desired credentials.</p>
{#if message != null}
<h3>{message}</h3>
{/if}
{#if message != null}
<h3>{message}</h3>
{/if}
<form method="post" action="/auth/action/login">
<label for="username">Username</label>
<input type="text" id="username" name="username">
<br>
<label for="password">Password</label>
<input type="password" id="password" name="password">
<br>
<input type="submit">
</form>
<form method="post" action="/auth/action/login">
<label for="username">Username</label>
<input type="text" id="username" name="username">
<br>
<label for="password">Password</label>
<input type="password" id="password" name="password">
<br>
<input type="submit">
</form>
{/include}

View file

@ -1,2 +1,6 @@
<p>Logged in as {username}</p>
<p><a href="/auth/logout">Log out</a></p>
{#include layout}
{#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}
<h3>{message}</h3>
{/if}
{#if message != null}
<h3>{message}</h3>
{/if}
<form method="post" action="/auth/action/register">
<input type="hidden" name="username" value="{username}">
<label for="password">Confirm password</label>
<input type="password" id="password" name="password">
<br>
<input type="submit" value="Register">
</form>
<form method="post" action="/auth/action/register">
<label for="username">Username</label>
<input type="text" id="username" name="username" disabled value="{username}">
<br>
<label for="password">Confirm password</label>
<input type="password" id="password" name="password">
<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">
<label for="title">Title</label>
<input type="text" name="title" id="title" value="{title}">
<br>
<label for="content">Content</label>
<textarea id="content" name="content"></textarea>
<br>
<input type="submit">
</form>
<form action="/action/create" method="post">
<label for="title">Title</label>
<input type="text" name="title" id="title" value="{title}">
<br>
<label for="content">Content</label>
<textarea id="content" name="content"></textarea>
<br>
<input type="submit">
</form>
{#if http:param("error") != null}
<p>Error: <strong>{http:param("error")}</strong></p>
{/if}
{#if http:param("error") != null}
<p>Error: <strong>{http:param("error")}</strong></p>
{/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">
<input type="hidden" name="title" value="{page.title}">
<textarea id="content" name="content">{content}</textarea>
<br>
<input type="submit">
</form>
<form action="/action/edit" method="post">
<input type="hidden" name="title" value="{page.title}">
<textarea id="content" name="content">{content}</textarea>
<br>
<input type="submit">
</form>
{#if http:param("error") != null}
<p>Error: <strong>{http:param("error")}</strong></p>
{/if}
{#if http:param("error") != null}
<p>Error: <strong>{http:param("error")}</strong></p>
{/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}
{#if page.latestRevision == revision}
<span>
<strong>
{#for revision in revisions}
{#if page.latestRevision == revision}
<span>
<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>
({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>
({revision.getDelta}) {revision.getTimestamp.toString()} by
<a href="/user/{revision.getAuthor.getSlug}">{revision.getAuthor.getName}</a>
</span>
{/if}
<br>
{/for}
</span>
{/if}
<br>
{/for}
<ul>
<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="/edit/{page.getSlug}">Edit page</a></li>
</ul>
<ul>
<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="/edit/{page.getSlug}">Edit page</a></li>
</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>
<li><a href="/edit/{path}">Create it</a></li>
<li><a href="/">Go home</a></li>
</ul>
<ul>
<li><a href="/edit/{path}">Create it</a></li>
<li><a href="/">Go home</a></li>
</ul>
{/include}

View file

@ -1,15 +1,19 @@
<form action="/search">
<input type="text" name="query" id="query" placeholder="Search query">
<input type="submit" value="Search">
</form>
{#include layout customTitle=true}
{#pageTitle}TalkPages{/pageTitle}
<ul>
<li><a href="/edit">Create a page</a></li>
{#if !user:loggedIn}
<form action="/search">
<input type="text" name="query" id="query" placeholder="Search query">
<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>
{#else}
{#else}
<li><a href="/auth/logout">Logout ({user:name})</a></li>
{/if}
</ul>
{/if}
</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()}
<p>Are you looking for:</p>
<ul>
{#for suggestion in suggestions}
<li><a href="/page/{suggestion.getSlug}">{suggestion.getTitle}</a></li>
{/for}
</ul>
<p>Actions:</p>
{/if}
{#if !suggestions.isEmpty()}
<p>Are you looking for:</p>
<ul>
{#for suggestion in suggestions}
<li><a href="/page/{suggestion.getSlug}">{suggestion.getTitle}</a></li>
{/for}
</ul>
<p>Actions:</p>
{/if}
<ul>
<li><a href="/edit/{title}">Create</a></li>
<li><a href="/">Go home</a></li>
</ul>
<ul>
<li><a href="/edit/{title}">Create</a></li>
<li><a href="/">Go home</a></li>
</ul>
{/include}

View file

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

View file

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