Adds logout button.

This commit is contained in:
Stefan Schallerl 2025-02-07 12:33:01 +01:00
parent 60309ec3c4
commit 52e4568fcc
7 changed files with 19 additions and 13 deletions

View file

@ -59,7 +59,8 @@ class FilemureApp(repository: SqliteRepository) {
title = "unauthorized",
target = "",
content = Unauthorized(),
back = ""
back = "",
logout = false
)
)
}

View file

@ -15,8 +15,6 @@ import java.time.format.FormatStyle
class DocumentController(val modifiers: TemplateModifiers, val repository: SqliteRepository) {
private val dtf = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT)
fun documentDetail(ctx: Context) {
val session = ctx.requireSession()
val extId = ExtId(ctx.pathParam("extId"))
@ -29,6 +27,7 @@ class DocumentController(val modifiers: TemplateModifiers, val repository: Sqlit
title = document.title,
target = "document-${document.extId}",
back = "/",
logout = true,
content = Document(
modifiers = modifiers,
extId = document.extId.value,
@ -84,6 +83,7 @@ class DocumentController(val modifiers: TemplateModifiers, val repository: Sqlit
// TODO enable target for new documents in form
target = "",
back = "/",
logout = true,
content = DocumentCreateForm(
modifiers = modifiers,
title = title,
@ -174,6 +174,7 @@ class DocumentController(val modifiers: TemplateModifiers, val repository: Sqlit
title = document.title,
target = "",
back = "/document/$extId",
logout = true,
content = DocumentEditForm(
modifiers = modifiers,
extId = extId,

View file

@ -19,6 +19,7 @@ class LimboController(val modifiers: TemplateModifiers, val repository: SqliteRe
title = "Limbo",
target = "limbo",
back = "/",
logout = true,
content = Limbo(
modifiers = modifiers, limboFileCount = files.size.toString(), file = {
files.map { f ->

View file

@ -15,6 +15,7 @@ class LoginController(val modifiers: TemplateModifiers, val repository: SqliteRe
title = "Hello to Filemure",
target = "",
back = "",
logout = false,
content = Login()
)
)

View file

@ -25,6 +25,7 @@ class OverviewController(private val modifiers: TemplateModifiers, private val r
title = "Overview",
target = "document",
back = "",
logout = true,
content = Overview(
modifiers = modifiers,
limboFileCount = limboFileCount.toString(),
@ -64,6 +65,7 @@ class OverviewController(private val modifiers: TemplateModifiers, private val r
title = "Overview",
target = "document",
back = "/",
logout = true,
content = OverviewDocuments(
modifiers = modifiers,
category = LocalDate.of(year, month, 1).formatHumanYearMonth(),

View file

@ -24,6 +24,7 @@ class SearchController(val modifiers: TemplateModifiers, val repository: SqliteR
title = "Search",
target = "document",
back = "/",
logout = true,
content = Search(
modifiers = modifiers,
search = q ?: "",

View file

@ -17,11 +17,6 @@
<main class="responsive">
<header>
<nav>
<!--
<button class="circle transparent">
<i>menu</i>
</button>
-->
{if $back}
<a href="{$back}">
<button class="circle transparent">
@ -31,11 +26,15 @@
{/if}
<h5 class="max center-align">{*$title}</h5>
<!--
{if $logout}
<form action="/logout" method="post">
<button class="circle transparent">
<img class="responsive" src="/favicon.png">
<i>logout</i>
<span>log out</span>
</button>
-->
</form>
{/if}
</nav>
</header>