Skip to content

Commit

Permalink
fix: remove params from url
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Aug 20, 2024
1 parent 9835b40 commit 43086ca
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 122 deletions.
117 changes: 0 additions & 117 deletions components/paginations/paginations.go

This file was deleted.

9 changes: 5 additions & 4 deletions components/tables/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/zeiss/fiber-htmx/components/forms"
"github.com/zeiss/fiber-htmx/components/utils"
"github.com/zeiss/pkg/conv"
"github.com/zeiss/pkg/urlx"
"github.com/zeiss/pkg/utilx"

"github.com/gofiber/fiber/v2"
Expand Down Expand Up @@ -234,7 +235,7 @@ func Pagination(p PaginationProps, children ...htmx.Node) htmx.Node {
func Prev(p PaginationProps) htmx.Node {
return htmx.Form(
htmx.Method("GET"),
htmx.Action(p.URL),
htmx.Action(urlx.MustRemoveQueryValues(p.URL, "offset", "limit")),
htmx.Input(
htmx.Type("hidden"),
htmx.Name("offset"),
Expand Down Expand Up @@ -269,7 +270,7 @@ func Prev(p PaginationProps) htmx.Node {
func Next(p PaginationProps) htmx.Node {
return htmx.Form(
htmx.Method("GET"),
htmx.Action(p.URL),
htmx.Action(urlx.MustRemoveQueryValues(p.URL, "offset", "limit")),
htmx.Input(
htmx.Type("hidden"),
htmx.Name("offset"),
Expand Down Expand Up @@ -336,7 +337,7 @@ type SearchProps struct {
func Search(props SearchProps, children ...htmx.Node) htmx.Node {
return htmx.Form(
htmx.Method("GET"),
htmx.Action(props.URL),
htmx.Action(urlx.MustRemoveQueryValues(props.URL, props.Name)),
forms.TextInputBordered(
forms.TextInputProps{
ClassNames: htmx.Merge(
Expand All @@ -355,7 +356,7 @@ func Search(props SearchProps, children ...htmx.Node) htmx.Node {
func Select(p SelectProps, children ...htmx.Node) htmx.Node {
return htmx.Form(
htmx.Method("GET"),
htmx.Action(p.URL),
htmx.Action(urlx.MustRemoveQueryValues(p.URL, "offset", "limit")),
htmx.IfElse(utilx.NotEmpty(p.ID), htmx.HxTrigger(fmt.Sprintf("change from:#%s", p.ID)), htmx.HxTrigger("change from:#select-table-options")),
htmx.Input(
htmx.Type("hidden"),
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/yuin/goldmark v1.7.4
github.com/zeiss/fiber-authz v1.0.33
github.com/zeiss/fiber-goth v1.2.11
github.com/zeiss/pkg v0.1.8-0.20240820092709-193dc1657dbb
github.com/zeiss/pkg v0.1.8-0.20240820122414-ce95f079ee32
gorm.io/gorm v1.25.11
mvdan.cc/gofumpt v0.7.0
)
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,10 @@ github.com/zeiss/fiber-goth v1.2.11 h1:24EiIKF1iPrmlspbW/BylcqVyj4Ltwzmx9DM7pRs6
github.com/zeiss/fiber-goth v1.2.11/go.mod h1:9NuXxIeKZgmk3dfl7HWbZK/eAfukvjMCHHacGo0m84Y=
github.com/zeiss/pkg v0.1.8-0.20240820092709-193dc1657dbb h1:ADg+FSvKUAPAM1RgKc0D1/rMGZLgMXdPsGbqhuWuiyc=
github.com/zeiss/pkg v0.1.8-0.20240820092709-193dc1657dbb/go.mod h1:MDEraF5xLbffG1zSfbrFWIP8bGFyvQMlvRG/xgJKozE=
github.com/zeiss/pkg v0.1.8-0.20240820122115-4c39e253e2aa h1:x1G7sEpISk2kYwfzrGD1I00YUvE/iDZjskCEwRbUKFg=
github.com/zeiss/pkg v0.1.8-0.20240820122115-4c39e253e2aa/go.mod h1:MDEraF5xLbffG1zSfbrFWIP8bGFyvQMlvRG/xgJKozE=
github.com/zeiss/pkg v0.1.8-0.20240820122414-ce95f079ee32 h1:cycuVXit5Emm5+tX5zwbgJrmlMHqfkI0u5UIs4LmJng=
github.com/zeiss/pkg v0.1.8-0.20240820122414-ce95f079ee32/go.mod h1:MDEraF5xLbffG1zSfbrFWIP8bGFyvQMlvRG/xgJKozE=
gitlab.com/bosi/decorder v0.4.2 h1:qbQaV3zgwnBZ4zPMhGLW4KZe7A7NwxEhJx39R3shffo=
gitlab.com/bosi/decorder v0.4.2/go.mod h1:muuhHoaJkA9QLcYHq4Mj8FJUwDZ+EirSHRiaTcTf6T8=
go-simpler.org/assert v0.9.0 h1:PfpmcSvL7yAnWyChSjOz6Sp6m9j5lyK8Ok9pEL31YkQ=
Expand Down

0 comments on commit 43086ca

Please sign in to comment.