From 3b9d27649a31e5af3fb137ff5b3378e7b8f7b9ae Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Sat, 22 Jul 2023 18:45:59 +0200 Subject: feat: Add user management As many things it is on crude state. The settings.go has become a big mess, but I have achieve MVP, so from now one things shall improve as I'll spent more time on refactoring. --- templates/base.qtpl | 12 +++++++++++ templates/settings.qtpl | 5 ++++- templates/user.qtpl | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 templates/user.qtpl (limited to 'templates') diff --git a/templates/base.qtpl b/templates/base.qtpl index 0c05782..5a7c3b7 100644 --- a/templates/base.qtpl +++ b/templates/base.qtpl @@ -1,11 +1,23 @@ This is a base page template. All the other template pages implement this interface. +{% import "strconv" %} + {% interface Page { Title() Content() Script() } + +%} + +{% code + func FromUInttoString(u *uint) string { + if u != nil { + return strconv.FormatUint(uint64(*u), 10) + } + return "" + } %} diff --git a/templates/settings.qtpl b/templates/settings.qtpl index 6eee1ab..4207439 100644 --- a/templates/settings.qtpl +++ b/templates/settings.qtpl @@ -52,10 +52,13 @@ type SettingsPage struct {
{%s user.Path %}
-
Edit / Delete
+
Edit Delete
{% endfor %} +
+ Create +
{% endfunc %} diff --git a/templates/user.qtpl b/templates/user.qtpl new file mode 100644 index 0000000..ba2f071 --- /dev/null +++ b/templates/user.qtpl @@ -0,0 +1,54 @@ + +{% code +type UserPage struct { + ID *uint + Username string + Path string + IsAdmin bool +} + +%} + +{% func (p *UserPage) Title() %}Login{% endfunc %} + +{% func (p *UserPage) Content() %} +

Initial Setup

+
+ {% if p.ID != nil %} + + {% endif %} +
+ +
+ +
+
+ + {% if p.ID == nil %} +
+ +
+ +
+
+ {% endif %} +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+{% endfunc %} + +{% func (p *UserPage) Script() %} +{% endfunc %} -- cgit v1.2.3