Skip to content

Commit

Permalink
Convert the pages into a shared template
Browse files Browse the repository at this point in the history
Signed-off-by: Jo Vandeginste <[email protected]>
  • Loading branch information
jovandeginste committed Jan 6, 2025
1 parent 25e0cf9 commit 67d3593
Show file tree
Hide file tree
Showing 42 changed files with 5,980 additions and 6,481 deletions.
187 changes: 89 additions & 98 deletions views/admin/edit_user.templ
Original file line number Diff line number Diff line change
Expand Up @@ -9,102 +9,93 @@ import (
)

templ EditUser(u *database.User) {
<!DOCTYPE html>
<html>
<head>
@partials.Head()
</head>
<body>
@partials.Header()
<div class="inner-form">
<h2>
@helpers.IconFor(`admin`)
{ i18n.T(ctx, "Manage user '%s'", u.Name) }
</h2>
<form
action={ templ.SafeURL(helpers.RouteFor(ctx, "admin-user-update", u.ID)) }
method="post"
class="inner-form"
>
<table>
<tbody>
<tr>
<td>
<label for="username">{ i18n.T(ctx, "Username") }</label>
</td>
<td>
<input
id="username"
name="username"
size="40"
value={ u.Username }
/>
</td>
</tr>
<tr>
<td>
<label for="name">{ i18n.T(ctx, "Name") }</label>
</td>
<td>
<input id="name" name="name" size="40" value={ u.Name }/>
</td>
</tr>
<tr>
<td>
<label for="name">{ i18n.T(ctx, "Password") }</label>
</td>
<td>
<input
type="password"
id="password"
name="password"
size="40"
placeholder={ i18n.T(ctx, "Leave blank to keep current password") }
value=""
/>
</td>
</tr>
<tr>
<td>
<label for="active">{ i18n.T(ctx, "Active") }</label>
</td>
<td>
<input
type="checkbox"
id="active"
name="active"
size="40"
checked?={ u.Active }
/>
</td>
</tr>
<tr>
<td>
<label for="admin">{ i18n.T(ctx, "Admin") }</label>
</td>
<td>
<input
type="checkbox"
id="admin"
name="admin"
size="40"
checked?={ u.Admin }
/>
</td>
</tr>
<tr>
<td></td>
<td>
<button type="submit" size="40">
{ i18n.T(ctx, "Update user") }
</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
@partials.Footer()
</body>
</html>
@partials.Page(partials.PageOptions{}) {
<h2>
@helpers.IconFor(`admin`)
{ i18n.T(ctx, "Manage user '%s'", u.Name) }
</h2>
<div class="inner-form">
<form
action={ templ.SafeURL(helpers.RouteFor(ctx, "admin-user-update", u.ID)) }
method="post"
>
<table>
<tbody>
<tr>
<td>
<label for="username">{ i18n.T(ctx, "Username") }</label>
</td>
<td>
<input
id="username"
name="username"
size="40"
value={ u.Username }
/>
</td>
</tr>
<tr>
<td>
<label for="name">{ i18n.T(ctx, "Name") }</label>
</td>
<td>
<input id="name" name="name" size="40" value={ u.Name }/>
</td>
</tr>
<tr>
<td>
<label for="name">{ i18n.T(ctx, "Password") }</label>
</td>
<td>
<input
type="password"
id="password"
name="password"
size="40"
placeholder={ i18n.T(ctx, "Leave blank to keep current password") }
value=""
/>
</td>
</tr>
<tr>
<td>
<label for="active">{ i18n.T(ctx, "Active") }</label>
</td>
<td>
<input
type="checkbox"
id="active"
name="active"
size="40"
checked?={ u.Active }
/>
</td>
</tr>
<tr>
<td>
<label for="admin">{ i18n.T(ctx, "Admin") }</label>
</td>
<td>
<input
type="checkbox"
id="admin"
name="admin"
size="40"
checked?={ u.Admin }
/>
</td>
</tr>
<tr>
<td></td>
<td>
<button type="submit" size="40">
{ i18n.T(ctx, "Update user") }
</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
}
}
Loading

0 comments on commit 67d3593

Please sign in to comment.