53 lines
1.4 KiB
Plaintext
53 lines
1.4 KiB
Plaintext
|
|
||
|
package templates
|
||
|
|
||
|
import "git.jmbit.de/jmb/goipam/db"
|
||
|
import "git.jmbit.de/jmb/goipam/utils"
|
||
|
|
||
|
templ ProfilePage(metaContent utils.MetaContent, title string, user *db.User, err error) {
|
||
|
@wrapBase(metaContent, title, err) {
|
||
|
@profileMain(user)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
templ profileMain(user *db.User) {
|
||
|
<div class="section is-medium">
|
||
|
<div class="container">
|
||
|
@ProfileStatic(user)
|
||
|
</div>
|
||
|
</div>
|
||
|
}
|
||
|
|
||
|
templ ProfileStatic(user *db.User) {
|
||
|
<div hx-target="this" hx-swap="outerHTML">
|
||
|
<div class="field"><label>Username</label>: { user.Name }</div>
|
||
|
<div class="field"><label>Display Name</label>: { user.DisplayName }</div>
|
||
|
<div class="field"><label>Email</label>: { user.Email }</div>
|
||
|
<button hx-get="/profile/edit.html" class="button button-primary">
|
||
|
Click To Edit
|
||
|
</button>
|
||
|
</div>
|
||
|
}
|
||
|
|
||
|
templ ProfileForm(user *db.User) {
|
||
|
<form hx-post="/profile/edit" hx-swap="outerHTML">
|
||
|
<div>
|
||
|
<label>Username</label>
|
||
|
<input type="text" name="username" value={ user.Name }/>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label>Display Name</label>
|
||
|
<input type="text" name="displayname" value={ user.DisplayName }/>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label>Email Address</label>
|
||
|
<input type="email" name="email" value={ user.Email }/>
|
||
|
</div>
|
||
|
<button class="button button-primary">Submit</button>
|
||
|
<button class="button button-primary" hx-get="/profile/static.html">Cancel</button>
|
||
|
</form>
|
||
|
}
|
||
|
|
||
|
templ PasswordForm(result string) {
|
||
|
}
|