lens @ 417041797674319485bea96cb38489670ff3b2ef

 1
 2{% code
 3type UserPage struct {
 4    ID *uint
 5    Username string
 6    Path string
 7    IsAdmin bool
 8}
 9
10%}
11
12{% func (p *UserPage) Title() %}User{% endfunc %}
13
14{% func (p *UserPage) Content() %}
15<h1>Initial Setup</h1>
16<form action="/users" method="post">
17    {% if p.ID != nil %} 
18    <input type="hidden" name="userId" value="{%s FromUInttoString(p.ID) %}" />
19    {% endif %}
20    <div class="field">
21        <label class="label">Username</label>
22        <div class="control">
23            <input class="input" name="username" type="text" value="{%s p.Username %}">
24        </div>
25    </div>
26
27    {% if p.ID == nil %} 
28    <div class="field">
29        <label class="label">Password</label>
30        <div class="control">
31            <input class="input" name="password" type="password">
32        </div>
33    </div>
34    {% endif %}
35    <div class="field">
36        <label class="label">Root folder</label>
37        <div class="control">
38            <input class="input" name="path" type="text" value="{%s p.Path %}">
39        </div>
40    </div>
41    <div class="field">
42        <label class="label">Is Admin?</label>
43        <div class="control">
44            <input type="checkbox" name="isAdmin" {% if p.IsAdmin %}checked{% endif %}>
45        </div>
46    </div>
47    <div class="field">
48        <input class="button is-pulled-right" value="Save" type="submit">
49    </div>
50</form>
51{% endfunc %}
52
53{% func (p *UserPage) Script() %}
54{% endfunc %}