Redmage/views/devices/put/view.templ

69 lines
2.1 KiB
Plaintext
Raw Normal View History

2024-05-08 10:10:23 +07:00
package put
import "github.com/tigorlazuardi/redmage/views"
import "github.com/tigorlazuardi/redmage/views/components"
type Data struct {
PageTitle string
PostAction string
2024-05-08 19:32:14 +07:00
EditMode bool
2024-05-08 10:10:23 +07:00
NameInput NameInputData
SlugInput SlugInputData
ResolutionX ResolutionData
ResolutionY ResolutionData
AspectRatioTolerance AspectRatioToleranceData
NSFWCheckbox NSFWCheckboxData
WindowsWallpaperCheckbox WindowsWallpaperCheckboxData
MinImageResolutionXInput ResolutionData
MinImageResolutionYInput ResolutionData
MaxImageResolutionXInput ResolutionData
MaxImageResolutionYInput ResolutionData
}
templ View(c *views.Context, data Data) {
@components.Doctype() {
@components.Head(c, components.HeadTitle(data.PageTitle))
@components.Body(c) {
@Content(c, data)
}
}
}
templ Content(c *views.Context, data Data) {
<main class="prose min-w-full">
@components.Container() {
<h1>{ data.PageTitle }</h1>
<div class="divider"></div>
<form
method="post"
hx-post={ data.PostAction }
action={ templ.SafeURL(data.PostAction) }
hx-target={ components.NotificationContainerID }
hx-target-error={ components.NotificationContainerID }
hx-swap="afterbegin"
class="grid sm:grid-cols-2 gap-4 sm:gap-y-8"
2024-05-08 10:10:23 +07:00
>
@NameInput(data.NameInput)
2024-05-08 19:32:14 +07:00
if !data.EditMode {
@SlugInput(data.SlugInput)
}
2024-05-08 10:10:23 +07:00
@ResolutionXInput(data.ResolutionX)
@ResolutionYInput(data.ResolutionY)
<div class="divider my-auto sm:my-8 sm:col-span-2"><h3 class="m-0 p-0">Filter</h3></div>
2024-05-08 10:10:23 +07:00
@AspectRatioToleranceInput(data.AspectRatioTolerance)
@NSFWCheckbox(data.NSFWCheckbox)
2024-05-08 19:32:14 +07:00
if !data.EditMode {
@WindowsWallpaperCheckbox(data.WindowsWallpaperCheckbox)
}
2024-05-08 10:10:23 +07:00
@MinImageResolutionXInput(data.MinImageResolutionXInput)
@MinImageResolutionYInput(data.MinImageResolutionYInput)
@MaxImageResolutionXInput(data.MaxImageResolutionXInput)
@MaxImageResolutionYInput(data.MaxImageResolutionYInput)
2024-05-08 19:32:14 +07:00
<button type="submit" class="btn btn-primary sm:col-span-2">Save</button>
2024-05-08 10:10:23 +07:00
</form>
}
</main>
@components.NotificationContainer()
}