aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/base.qtpl12
-rw-r--r--templates/settings.qtpl5
-rw-r--r--templates/user.qtpl54
3 files changed, 70 insertions, 1 deletions
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 {
<div class="column">
{%s user.Path %}
</div>
- <div class="column has-text-right"><a href="#">Edit</a> / <a href="#" class="is-danger">Delete</a></div>
+ <div class="column has-text-right"><a href="/users?userId={%s FromUInttoString(&user.ID) %}">Edit</a> <a href="/users/delete?userId={%s FromUInttoString(&user.ID) %}" class="is-danger">Delete</a></div>
</div>
</div>
{% endfor %}
+ <div class="field">
+ <a href="/users/" class="button">Create</a>
+ </div>
</div>
</div>
{% 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() %}
+<h1>Initial Setup</h1>
+<form action="/users/" method="post">
+ {% if p.ID != nil %}
+ <input type="hidden" name="userId" value="{%s FromUInttoString(p.ID) %}" />
+ {% endif %}
+ <div class="field">
+ <label class="label">Username</label>
+ <div class="control">
+ <input class="input" name="username" type="text" value="{%s p.Username %}">
+ </div>
+ </div>
+
+ {% if p.ID == nil %}
+ <div class="field">
+ <label class="label">Password</label>
+ <div class="control">
+ <input class="input" name="password" type="password">
+ </div>
+ </div>
+ {% endif %}
+ <div class="field">
+ <label class="label">Root folder</label>
+ <div class="control">
+ <input class="input" name="path" type="text" value="{%s p.Path %}">
+ </div>
+ </div>
+ <div class="field">
+ <label class="label">Is Admin?</label>
+ <div class="control">
+ <input type="checkbox" name="isAdmin" type="password" {% if p.IsAdmin %}checked{% endif %}>
+ </div>
+ </div>
+ <div class="field">
+ <input class="button is-pulled-right" value="Save" type="submit">
+ </div>
+</form>
+{% endfunc %}
+
+{% func (p *UserPage) Script() %}
+{% endfunc %}