Switched to light theme. Fixed time parsing.
This commit is contained in:
parent
db09b1db97
commit
96fc0ea600
4 changed files with 20 additions and 7 deletions
|
|
@ -16,6 +16,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const dateTimeFormat = "2006-01-02T15:04:05"
|
const dateTimeFormat = "2006-01-02T15:04:05"
|
||||||
|
const dateTimeFormatNoSeconds = "2006-01-02T15:04"
|
||||||
|
|
||||||
type Handler struct {
|
type Handler struct {
|
||||||
client *ent.Client
|
client *ent.Client
|
||||||
|
|
@ -307,8 +308,11 @@ func (h *Handler) bind(ctx echo.Context, entity any) error {
|
||||||
|
|
||||||
// Echo expects datetime values to be in a certain format but that does not align with the datetime-local
|
// Echo expects datetime values to be in a certain format but that does not align with the datetime-local
|
||||||
// HTML form element format, so we will attempt to convert it here.
|
// HTML form element format, so we will attempt to convert it here.
|
||||||
if t, err := time.Parse(dateTimeFormat, v[0]); err == nil {
|
for _, format := range []string{dateTimeFormatNoSeconds, dateTimeFormat} {
|
||||||
|
if t, err := time.Parse(format, v[0]); err == nil {
|
||||||
ctx.Request().Form[k][0] = t.Format(time.RFC3339)
|
ctx.Request().Form[k][0] = t.Format(time.RFC3339)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ctx.Bind(entity)
|
return ctx.Bind(entity)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
const dateTimeFormat = "2006-01-02T15:04:05"
|
const dateTimeFormat = "2006-01-02T15:04:05"
|
||||||
|
const dateTimeFormatNoSeconds = "2006-01-02T15:04"
|
||||||
|
|
||||||
type Handler struct {
|
type Handler struct {
|
||||||
client *{{ $pkg }}.Client
|
client *{{ $pkg }}.Client
|
||||||
|
|
@ -248,8 +249,11 @@
|
||||||
|
|
||||||
// Echo expects datetime values to be in a certain format but that does not align with the datetime-local
|
// Echo expects datetime values to be in a certain format but that does not align with the datetime-local
|
||||||
// HTML form element format, so we will attempt to convert it here.
|
// HTML form element format, so we will attempt to convert it here.
|
||||||
if t, err := time.Parse(dateTimeFormat, v[0]); err == nil {
|
for _, format := range []string{dateTimeFormatNoSeconds, dateTimeFormat} {
|
||||||
|
if t, err := time.Parse(format, v[0]); err == nil {
|
||||||
ctx.Request().Form[k][0] = t.Format(time.RFC3339)
|
ctx.Request().Form[k][0] = t.Format(time.RFC3339)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ctx.Bind(entity)
|
return ctx.Bind(entity)
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ func Auth(r *ui.Request, content Node) Node {
|
||||||
return Doctype(
|
return Doctype(
|
||||||
HTML(
|
HTML(
|
||||||
Lang("en"),
|
Lang("en"),
|
||||||
|
Data("theme", "light"),
|
||||||
Head(
|
Head(
|
||||||
Metatags(r),
|
Metatags(r),
|
||||||
CSS(),
|
CSS(),
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ func Primary(r *ui.Request, content Node) Node {
|
||||||
return Doctype(
|
return Doctype(
|
||||||
HTML(
|
HTML(
|
||||||
Lang("en"),
|
Lang("en"),
|
||||||
|
Data("theme", "light"),
|
||||||
Head(
|
Head(
|
||||||
Metatags(r),
|
Metatags(r),
|
||||||
CSS(),
|
CSS(),
|
||||||
|
|
@ -31,12 +32,15 @@ func Primary(r *ui.Request, content Node) Node {
|
||||||
),
|
),
|
||||||
Div(
|
Div(
|
||||||
Class("column is-10"),
|
Class("column is-10"),
|
||||||
|
Div(
|
||||||
|
Class("box"),
|
||||||
If(len(r.Title) > 0, H1(Class("title"), Text(r.Title))),
|
If(len(r.Title) > 0, H1(Class("title"), Text(r.Title))),
|
||||||
FlashMessages(r),
|
FlashMessages(r),
|
||||||
content,
|
content,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
HtmxListeners(r),
|
HtmxListeners(r),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue