diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-04-16 23:08:59 +0200 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-04-16 23:08:59 +0200 |
commit | 13a85f42183b7373296fa85319d33f1359feaea9 (patch) | |
tree | c332d86bc2c6406f0312d0d2f77d8444cb84c51b /view/timer.templ | |
parent | 4e715ab1e1053698c3eb02c13cc726ce9bd26667 (diff) |
Timer token show & reset
Diffstat (limited to 'view/timer.templ')
-rw-r--r-- | view/timer.templ | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/view/timer.templ b/view/timer.templ index 7e9ab7f..76bd7ba 100644 --- a/view/timer.templ +++ b/view/timer.templ @@ -5,6 +5,22 @@ import ( "stevenlr.com/timer/model"
)
+templ TimerTokenForm(timer model.Timer) {
+ <p class="token-form">
+ <button
+ type="button"
+ hx-post={ fmt.Sprint("/timer/", timer.Id, "/resetToken") }
+ hx-target="closest .token-form"
+ hx-confirm="Are you sure you want to reset the token for this timer?"
+ >Reset token</button>
+ <button
+ type="button"
+ hx-get={ fmt.Sprint("/timer/", timer.Id, "/token") }
+ hx-swap="outerHTML"
+ >Show token</button>
+ </p>
+}
+
templ TimerView(timer model.Timer) {
<div class="timer">
<h1>Timer "{ timer.Name }"</h1>
@@ -38,6 +54,8 @@ templ TimerView(timer model.Timer) { <button hx-target="closest .timer" hx-post={ fmt.Sprint("/timer/", timer.Id, "/addTime/4w") }>4 weeks</button>
</p>
}
+ <h3>API token</h3>
+ @TimerTokenForm(timer)
</div>
}
|