From 276d62af3d2c533abc0d40e84e8c584147e1a46e Mon Sep 17 00:00:00 2001 From: Bagas Aulia Rezki Date: Thu, 13 Jun 2024 17:20:57 +0700 Subject: [PATCH] Add htmx to the project --- view/auth/auth.templ | 2 +- view/error/error.templ | 4 ++-- view/index/index.templ | 4 ++-- view/layout/base.templ | 9 ++++++--- view/signin/signin.templ | 4 ++-- view/signup/signup.templ | 2 +- view/user/user.templ | 4 ++-- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/view/auth/auth.templ b/view/auth/auth.templ index 804944b..413d7fc 100644 --- a/view/auth/auth.templ +++ b/view/auth/auth.templ @@ -75,7 +75,7 @@ templ form(err types.Message, title string) {
Already have an account? - + Sign in
diff --git a/view/error/error.templ b/view/error/error.templ index 6bf5868..df48245 100644 --- a/view/error/error.templ +++ b/view/error/error.templ @@ -13,7 +13,7 @@ templ NotFound(title string){ Go back to homepage diff --git a/view/index/index.templ b/view/index/index.templ index 5de6c4b..ba6b13f 100644 --- a/view/index/index.templ +++ b/view/index/index.templ @@ -20,12 +20,12 @@ templ content(title string, user types.User) {
if user.Authenticated { + href="/user" hx-get="/user" hx-swap="outerHTML" hx-push-url="true" hx-target="#content"> Open Dashboard } else { + href="/signup" hx-get="/signup" hx-swap="outerHTML" hx-push-url="true" hx-target="#content"> Get started } diff --git a/view/layout/base.templ b/view/layout/base.templ index 6dabc6e..435614f 100644 --- a/view/layout/base.templ +++ b/view/layout/base.templ @@ -13,9 +13,12 @@ templ Base(title string){ { title } + - { children... } +
+ { children... } +
} @@ -70,10 +73,10 @@ templ Navbar(user types.User) {
} else { - + Sign up - + Sign in } diff --git a/view/signin/signin.templ b/view/signin/signin.templ index 6f6115b..53d0253 100644 --- a/view/signin/signin.templ +++ b/view/signin/signin.templ @@ -29,7 +29,7 @@ templ content(err types.Message, title string) {
@@ -52,7 +52,7 @@ templ content(err types.Message, title string) {
Don't have an account? - + Sign up
diff --git a/view/signup/signup.templ b/view/signup/signup.templ index 229ee84..c3d36a4 100644 --- a/view/signup/signup.templ +++ b/view/signup/signup.templ @@ -81,7 +81,7 @@ templ form(err types.Message, title string) {
Already have an account? - + Sign in
diff --git a/view/user/user.templ b/view/user/user.templ index c84b957..0825dda 100644 --- a/view/user/user.templ +++ b/view/user/user.templ @@ -221,12 +221,12 @@ templ content(title string, user types.User, ListSession []*session.SessionInfo)
+ type="button" href="/upload" hx-get="/upload" hx-swap="outerHTML" hx-push-url="true" hx-target="#content"> Upload + type="button" href="/download" hx-get="/download" hx-swap="outerHTML" hx-push-url="true" hx-target="#content"> Download