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

View file

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

View file

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

View file

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

View file

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

View file

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