This commit is contained in:
maddalax 2024-09-24 14:55:07 -05:00
parent df90b00ee2
commit 7262c221d4

View file

@ -67,12 +67,11 @@ func CompleteAllIcon(list []*ent.Task) *h.Element {
return item.CompletedAt == nil return item.CompletedAt == nil
})) }))
return h.Button( return h.Div(
h.TextF("Complete %s tasks", notCompletedCount), h.ClassX("absolute top-0 left-0 p-4 rotate-90 text-2xl cursor-pointer", map[string]bool{
h.PostPartialWithQs(CompleteAll, "text-slate-400": notCompletedCount > 0,
h.NewQs("complete", }), h.Text(""),
h.Ternary(notCompletedCount > 0, "true", "false"), h.PostPartialWithQs(CompleteAll, h.NewQs("complete", h.Ternary(notCompletedCount > 0, "true", "false"))),
)),
) )
} }
@ -269,10 +268,12 @@ func ToggleCompleted(ctx *h.RequestContext) *h.Partial {
func CompleteAll(ctx *h.RequestContext) *h.Partial { func CompleteAll(ctx *h.RequestContext) *h.Partial {
service := tasks.NewService(ctx.ServiceLocator()) service := tasks.NewService(ctx.ServiceLocator())
service.SetAllCompleted(ctx.QueryParam("complete") == "true") service.SetAllCompleted(ctx.QueryParam("complete") == "true")
return h.SwapPartial(ctx,
Card(ctx), list, _ := service.List()
)
return h.NewPartial(h.OobSwap(ctx, CardBody(list, getActiveTab(ctx))))
} }
func ClearCompleted(ctx *h.RequestContext) *h.Partial { func ClearCompleted(ctx *h.RequestContext) *h.Partial {