From 3cd7ec3706ed09b72e64e10ab4afb52d5bb7f64d Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Mon, 22 Jul 2024 19:48:42 +0200 Subject: [PATCH] hx (work in progress): start with login form --- layouts/partials/hx/button.html | 1 + layouts/shortcodes/hx/button.html | 6 +++++ layouts/shortcodes/hx/data-field-line.html | 6 +++++ layouts/shortcodes/hx/data-form.html | 11 +++++++++ layouts/shortcodes/hx/debug.html | 1 + layouts/shortcodes/hx/xplore.html | 2 +- sites/hx/config.yaml | 1 + sites/hx/content/app/login.md | 27 ++++++++++++++++++++++ 8 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/hx/button.html create mode 100644 layouts/shortcodes/hx/button.html create mode 100644 layouts/shortcodes/hx/data-field-line.html create mode 100644 layouts/shortcodes/hx/data-form.html create mode 100644 layouts/shortcodes/hx/debug.html create mode 100644 sites/hx/content/app/login.md diff --git a/layouts/partials/hx/button.html b/layouts/partials/hx/button.html new file mode 100644 index 0000000..f28f116 --- /dev/null +++ b/layouts/partials/hx/button.html @@ -0,0 +1 @@ + diff --git a/layouts/shortcodes/hx/button.html b/layouts/shortcodes/hx/button.html new file mode 100644 index 0000000..5645864 --- /dev/null +++ b/layouts/shortcodes/hx/button.html @@ -0,0 +1,6 @@ +{{- $type := .Get "type" | default "button" -}} +{{- $name := .Get "name" | default "submit" -}} +{{- $label := .Get "label" | default (title $name) -}} + +{{- $params := dict "type" $type "name" $name "label" $label -}} +{{ partial "hx/button" $params }} diff --git a/layouts/shortcodes/hx/data-field-line.html b/layouts/shortcodes/hx/data-field-line.html new file mode 100644 index 0000000..f341b2c --- /dev/null +++ b/layouts/shortcodes/hx/data-field-line.html @@ -0,0 +1,6 @@ +{{- $type := .Get "type" | default "text" -}} +{{- $name := .Get "name" | default "textline" -}} +
+ +
diff --git a/layouts/shortcodes/hx/data-form.html b/layouts/shortcodes/hx/data-form.html new file mode 100644 index 0000000..d0f91ba --- /dev/null +++ b/layouts/shortcodes/hx/data-form.html @@ -0,0 +1,11 @@ +{{- $root := .Site.Params.Api.Root -}} +{{- $name := .Get "name" | default "data" -}} +{{- $action := .Get "action" | default "data" -}} +{{- $domain := .Get "domain" | default $.Page.Params.api.domain -}} +{{- $target := .Get "target" | default "#debug" -}} +{{- $label := "Submit" -}} +
+ {{ .Inner }} + +
diff --git a/layouts/shortcodes/hx/debug.html b/layouts/shortcodes/hx/debug.html new file mode 100644 index 0000000..4137f78 --- /dev/null +++ b/layouts/shortcodes/hx/debug.html @@ -0,0 +1 @@ +
diff --git a/layouts/shortcodes/hx/xplore.html b/layouts/shortcodes/hx/xplore.html index 6a553f1..4f22b0d 100644 --- a/layouts/shortcodes/hx/xplore.html +++ b/layouts/shortcodes/hx/xplore.html @@ -3,7 +3,7 @@ Hello World! -
+
diff --git a/sites/hx/config.yaml b/sites/hx/config.yaml index a3492d7..e6e10c0 100644 --- a/sites/hx/config.yaml +++ b/sites/hx/config.yaml @@ -27,6 +27,7 @@ params: api: module: main-htmx.ts + root: /hx taxonomies: domain: domains diff --git a/sites/hx/content/app/login.md b/sites/hx/content/app/login.md new file mode 100644 index 0000000..2009e43 --- /dev/null +++ b/sites/hx/content/app/login.md @@ -0,0 +1,27 @@ +--- +title: Login +summary: Login Page +img: +pageid: login +domains: [] +topics: [] +date: 2024-07-22 +author: helmutm +draft: false +weight: 900 +api: + domain: auth +--- + +Please enter login data: + +{{< hx/data-form name="login" action="login" >}} + + Login: {{< hx/data-field-line name="login" attrs="autofocus" >}} + Password: {{< hx/data-field-line type="password" name="password" >}} + +{{< /hx/data-form >}} + +--- + +{{< hx/debug >}}