Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish: fix publish button crop && listing: NoOffsetPart true #448

Merged
merged 6 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func ContainsVersionBar(body string) bool {
return strings.Contains(body, "presets_OpenListingDialog") && strings.Contains(body, "-version-list-dialog")
}

var reListContent = regexp.MustCompile(`<tr[\s\S]+?<td>[\s\S]+?<v-radio :model-value='([^']+)'\s*:true-value='([^']+)'[\s\S]+?</v-radio>\s*([^<]+)?\s*</div>[\s\S]+?</tr>`)
var reListContent = regexp.MustCompile(`<tr[\s\S]+?<td[^>]*>[\s\S]+?<v-radio :model-value='([^']+)'\s*:true-value='([^']+)'[\s\S]+?</v-radio>\s*([^<]+)?\s*</div>[\s\S]+?</tr>`)

func EnsureVersionListDisplay(selected string, dislayModels []*examples_admin.WithPublishProduct) testflow.ValidatorFunc {
return testflow.Combine(
Expand Down
4 changes: 2 additions & 2 deletions example/admin/input_demo_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ func configureDialogCustomerSelector(db *gorm.DB, pb *presets.Builder) {
lb := b.Listing().DialogWidth("900px")
lb.NewButtonFunc(func(ctx *web.EventContext) h.HTMLComponent { return nil })
lb.RowMenu().Empty()
lb.CellWrapperFunc(func(cell h.MutableAttrHTMLComponent, id string, obj interface{}, dataTableID string) h.HTMLComponent {
return cell
lb.WrapCell(func(in presets.CellProcessor) presets.CellProcessor {
return in
})
lb.BulkAction("Confirm").ButtonCompFunc(func(ctx *web.EventContext) h.HTMLComponent {
return VBtn("Confirm").Attr("@click", web.Plaid().
Expand Down
16 changes: 9 additions & 7 deletions example/admin/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,15 @@
lb.NewButtonFunc(func(ctx *web.EventContext) h.HTMLComponent { return nil })
lb.RowMenu().Empty()
registerSelectFavorPostEvent(db, pb)
lb.CellWrapperFunc(func(cell h.MutableAttrHTMLComponent, id string, obj interface{}, dataTableID string) h.HTMLComponent {
cell.SetAttr("@click.self", web.Plaid().
Query("id", strings.Split(id, "_")[0]).
EventFunc(eventSelectFavorPost).
Go(),
)
return cell
lb.WrapCell(func(in presets.CellProcessor) presets.CellProcessor {
return func(evCtx *web.EventContext, cell h.MutableAttrHTMLComponent, id string, obj any) (h.MutableAttrHTMLComponent, error) {
cell.SetAttr("@click", web.Plaid().
Query("id", strings.Split(id, "_")[0]).
EventFunc(eventSelectFavorPost).
Go(),
)
return in(evCtx, cell, id, obj)

Check warning on line 427 in example/admin/user_config.go

View check run for this annotation

Codecov / codecov/patch

example/admin/user_config.go#L422-L427

Added lines #L422 - L427 were not covered by tests
}
})
lb.FilterDataFunc(func(ctx *web.EventContext) vx.FilterData {
return []*vx.FilterItem{
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/pquerna/otp v1.4.0
github.com/qor/oss v0.0.0-20240729105053-88484a799a79
github.com/qor5/web/v3 v3.0.6-0.20240806032534-6c0e81ec7b12
github.com/qor5/web/v3 v3.0.6-0.20240808073627-bd2003d12e2c
github.com/qor5/x/v3 v3.0.7-0.20240808022508-35f1ab5b53fe
github.com/samber/lo v1.46.0
github.com/shurcooL/sanitized_anchor_name v1.0.0
Expand All @@ -49,7 +49,7 @@ require (
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
golang.org/x/text v0.16.0
golang.org/x/text v0.17.0
gorm.io/driver/postgres v1.5.9
gorm.io/driver/sqlite v1.5.6
gorm.io/gorm v1.25.11
Expand Down Expand Up @@ -164,7 +164,7 @@ require (
golang.org/x/image v0.18.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 // indirect
Expand Down
16 changes: 6 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,8 @@ github.com/qor/oss v0.0.0-20240729105053-88484a799a79 h1:MXQCoxxGj15XjuOSdhkLrPs
github.com/qor/oss v0.0.0-20240729105053-88484a799a79/go.mod h1:FDxJAVwmZ1j8ITcKJExFlzkTYuUor1dBKZgNVWqEqlM=
github.com/qor5/web v1.3.2 h1:zw796YJeDLe8vRwGR1cM+uS1ZuSkPutchBEXv2GgOhI=
github.com/qor5/web v1.3.2/go.mod h1:LszskQJbFQDJwOeZC6j6afOiHxxyjrzz8B3zuBwfgKQ=
github.com/qor5/web/v3 v3.0.6-0.20240806032534-6c0e81ec7b12 h1:CUJ8p/m0HFw/cizcrvUfKt7BkPvYMaVUv2qXDfs00ew=
github.com/qor5/web/v3 v3.0.6-0.20240806032534-6c0e81ec7b12/go.mod h1:32vdHHcZb2JimlcaclW9hLUyimdXjrllZDHTh3rl6d0=
github.com/qor5/x/v3 v3.0.7-0.20240806090036-8f4e3b201ac5 h1:C5tGNPy3zhi4qRq8rz2q9FcslNPGqre6vDIpC2FVUGQ=
github.com/qor5/x/v3 v3.0.7-0.20240806090036-8f4e3b201ac5/go.mod h1:p8LBZGmJ9pozop2jMACV5tN/1gkpAskteOhlwcfFxpw=
github.com/qor5/x/v3 v3.0.7-0.20240807061706-4db6cfcc8d47 h1:2ors2qujUOPFhs/gP08NlJZWyTG6mNjNttkdp1ivenM=
github.com/qor5/x/v3 v3.0.7-0.20240807061706-4db6cfcc8d47/go.mod h1:p8LBZGmJ9pozop2jMACV5tN/1gkpAskteOhlwcfFxpw=
github.com/qor5/web/v3 v3.0.6-0.20240808073627-bd2003d12e2c h1:uYoko94cUQN04E2hnZIsp/+yiEEI97V5OKcbS9cTa7o=
github.com/qor5/web/v3 v3.0.6-0.20240808073627-bd2003d12e2c/go.mod h1:32vdHHcZb2JimlcaclW9hLUyimdXjrllZDHTh3rl6d0=
github.com/qor5/x/v3 v3.0.7-0.20240808022508-35f1ab5b53fe h1:kZSRwsseo3Jwlk3Z/27f8h6kQynNII5YewbYppB648k=
github.com/qor5/x/v3 v3.0.7-0.20240808022508-35f1ab5b53fe/go.mod h1:p8LBZGmJ9pozop2jMACV5tN/1gkpAskteOhlwcfFxpw=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
Expand Down Expand Up @@ -553,8 +549,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -599,8 +595,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
49 changes: 23 additions & 26 deletions pagebuilder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,6 @@
// change old detail layout
pm.Detailing().AfterTitleCompFunc(func(obj interface{}, ctx *web.EventContext) h.HTMLComponent {
return publish.DefaultVersionBar(db)(obj, ctx)

})
pm.Detailing().Title(func(ctx *web.EventContext, obj any, style presets.DetailingStyle, defaultTitle string) (title string, titleCompo h.HTMLComponent, err error) {
var pageAppbarContent []h.HTMLComponent
Expand Down Expand Up @@ -1008,19 +1007,18 @@
}
listing.Field("DisplayName").Label("Name")
listing.SearchFunc(sharedContainerSearcher(db, r))
listing.CellWrapperFunc(func(cell h.MutableAttrHTMLComponent, id string, obj interface{}, dataTableID string) h.HTMLComponent {
tdbind := cell
c := obj.(*Container)

tdbind.SetAttr("@click.self",
web.Plaid().
EventFunc(actions.Edit).
URL(b.ContainerByName(c.ModelName).GetModelBuilder().Info().ListingHref()).
Query(presets.ParamID, c.ModelID).
Query(paramOpenFromSharedContainer, 1).
Go()+fmt.Sprintf(`; vars.currEditingListItemID="%s-%d"`, dataTableID, c.ModelID))

return tdbind
listing.WrapCell(func(in presets.CellProcessor) presets.CellProcessor {
return func(evCtx *web.EventContext, cell h.MutableAttrHTMLComponent, id string, obj any) (h.MutableAttrHTMLComponent, error) {
c := obj.(*Container)
cell.SetAttr("@click",
web.Plaid().
EventFunc(actions.Edit).
URL(b.ContainerByName(c.ModelName).GetModelBuilder().Info().ListingHref()).
Query(presets.ParamID, c.ModelID).
Query(paramOpenFromSharedContainer, 1).
Go()+fmt.Sprintf(`; locals.current_editing_id=%q"`, id))
return in(evCtx, cell, id, obj)

Check warning on line 1020 in pagebuilder/builder.go

View check run for this annotation

Codecov / codecov/patch

pagebuilder/builder.go#L1012-L1020

Added lines #L1012 - L1020 were not covered by tests
}
})

if b.ab != nil {
Expand Down Expand Up @@ -1083,18 +1081,17 @@
return nil
})
listing.RowMenu().Empty()
listing.CellWrapperFunc(func(cell h.MutableAttrHTMLComponent, id string, obj interface{}, dataTableID string) h.HTMLComponent {
tdbind := cell
c := obj.(*DemoContainer)

tdbind.SetAttr("@click.self",
web.Plaid().
EventFunc(actions.Edit).
URL(b.ContainerByName(c.ModelName).GetModelBuilder().Info().ListingHref()).
Query(presets.ParamID, c.ModelID).
Go()+fmt.Sprintf(`; vars.currEditingListItemID="%s-%d"`, dataTableID, c.ModelID))

return tdbind
listing.WrapCell(func(in presets.CellProcessor) presets.CellProcessor {
return func(evCtx *web.EventContext, cell h.MutableAttrHTMLComponent, id string, obj any) (h.MutableAttrHTMLComponent, error) {
c := obj.(*DemoContainer)
cell.SetAttr("@click",
web.Plaid().
EventFunc(actions.Edit).
URL(b.ContainerByName(c.ModelName).GetModelBuilder().Info().ListingHref()).
Query(presets.ParamID, c.ModelID).
Go()+fmt.Sprintf(`; locals.current_editing_id=%q`, id))
return in(evCtx, cell, id, obj)

Check warning on line 1093 in pagebuilder/builder.go

View check run for this annotation

Codecov / codecov/patch

pagebuilder/builder.go#L1086-L1093

Added lines #L1086 - L1093 were not covered by tests
}
})
if b.ab != nil {
pm.Use(b.ab)
Expand Down
24 changes: 17 additions & 7 deletions presets/listing_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
ListingStyleNested ListingStyle = "Nested"
)

type ColumnsProcessor func(evCtx *web.EventContext, columns []*Column) ([]*Column, error)
type (
ColumnsProcessor func(evCtx *web.EventContext, columns []*Column) ([]*Column, error)
CellProcessor func(evCtx *web.EventContext, cell h.MutableAttrHTMLComponent, id string, obj any) (h.MutableAttrHTMLComponent, error)
)

type OrderableField struct {
FieldName string
Expand All @@ -42,6 +45,7 @@
newBtnFunc ComponentFunc
pageFunc web.PageFunc
cellWrapperFunc vx.CellWrapperFunc
cellProcessor CellProcessor
Searcher SearchFunc
searchColumns []string
titleFunc func(evCtx *web.EventContext, style ListingStyle, defaultTitle string) (title string, titleCompo h.HTMLComponent, err error)
Expand Down Expand Up @@ -104,11 +108,23 @@
return b
}

// Deprecated: Use WrapCell instead.
func (b *ListingBuilder) CellWrapperFunc(cwf vx.CellWrapperFunc) (r *ListingBuilder) {
b.cellWrapperFunc = cwf
return b
}

func (b *ListingBuilder) WrapCell(w func(in CellProcessor) CellProcessor) (r *ListingBuilder) {
if b.cellProcessor == nil {
b.cellProcessor = w(func(evCtx *web.EventContext, cell h.MutableAttrHTMLComponent, id string, obj any) (h.MutableAttrHTMLComponent, error) {
return cell, nil
})
} else {
b.cellProcessor = w(b.cellProcessor)

Check warning on line 123 in presets/listing_builder.go

View check run for this annotation

Codecov / codecov/patch

presets/listing_builder.go#L122-L123

Added lines #L122 - L123 were not covered by tests
}
return b
}

func (b *ListingBuilder) DisablePagination(v bool) (r *ListingBuilder) {
b.disablePagination = v
return b
Expand Down Expand Up @@ -146,12 +162,6 @@
return b
}

// Deprecated: Use WrapColumns instead.
func (b *ListingBuilder) DisplayColumnsProcessor(f ColumnsProcessor) (r *ListingBuilder) {
b.columnsProcessor = f
return b
}

func (b *ListingBuilder) SearchColumns(vs ...string) (r *ListingBuilder) {
b.searchColumns = vs
return b
Expand Down
30 changes: 20 additions & 10 deletions presets/listing_compo.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
h.Div(
c.tabsFilter(ctx),
).Class("px-2"),
c.toolbarSearch(ctx),
c.toolbarSearch(ctx),
VCardText().Class("pt-2 px-2").Children(
c.dataTable(ctx),
),
Expand Down Expand Up @@ -331,7 +331,7 @@
}

func (c *ListingCompo) defaultCellWrapperFunc(_ context.Context) func(cell h.MutableAttrHTMLComponent, id string, obj any, dataTableID string) h.HTMLComponent {
return func(cell h.MutableAttrHTMLComponent, id string, obj any, dataTableID string) h.HTMLComponent {
return func(cell h.MutableAttrHTMLComponent, id string, obj any, _ string) h.HTMLComponent {
if c.lb.mb.hasDetailing && !c.lb.mb.detailing.drawer {
cell.SetAttr("@click", web.Plaid().PushStateURL(c.lb.mb.Info().DetailingHref(id)).Go())
return cell
Expand All @@ -348,7 +348,7 @@
if c.ParentID != "" {
onClick.Query(ParamParentID, c.ParentID)
}
cell.SetAttr("@click", fmt.Sprintf(`%s; locals.current_editing_id = "%s-%s";`, onClick.Go(), dataTableID, id))
cell.SetAttr("@click", fmt.Sprintf(`%s; locals.current_editing_id = %q;`, onClick.Go(), id))
return cell
}
}
Expand Down Expand Up @@ -499,19 +499,29 @@
),
)
}).
RowWrapperFunc(func(row h.MutableAttrHTMLComponent, id string, obj any, dataTableID string) h.HTMLComponent {
RowWrapperFunc(func(row h.MutableAttrHTMLComponent, id string, obj any, _ string) h.HTMLComponent {
// TODO: how to cancel active if not using vars.presetsRightDrawer
row.SetAttr(":class", fmt.Sprintf(`{
"vx-list-item--active primary--text": vars.presetsRightDrawer && locals.current_editing_id === "%s-%s",
}`, dataTableID, id,
"vx-list-item--active primary--text": vars.presetsRightDrawer && locals.current_editing_id === %q,
}`, id,
))
return row
}).
RowMenuHead(btnConfigColumns).
RowMenuItemFuncs(c.lb.RowMenu().listingItemFuncs(evCtx)...).
CellWrapperFunc(
lo.If(c.lb.cellWrapperFunc != nil, c.lb.cellWrapperFunc).Else(c.defaultCellWrapperFunc(ctx)),
)
CellWrapperFunc(func(cell h.MutableAttrHTMLComponent, id string, obj interface{}, dataTableID string) h.HTMLComponent {
if c.lb.cellProcessor != nil {
compo, err := c.lb.cellProcessor(evCtx, cell, id, obj)
if err != nil {
panic(err)

Check warning on line 516 in presets/listing_compo.go

View check run for this annotation

Codecov / codecov/patch

presets/listing_compo.go#L516

Added line #L516 was not covered by tests
}
return compo
}
if c.lb.cellWrapperFunc != nil {
return c.lb.cellWrapperFunc(cell, id, obj, dataTableID)

Check warning on line 521 in presets/listing_compo.go

View check run for this annotation

Codecov / codecov/patch

presets/listing_compo.go#L521

Added line #L521 was not covered by tests
}
return c.defaultCellWrapperFunc(ctx)(cell, id, obj, dataTableID)
})

if len(c.lb.bulkActions) > 0 {
syncQuery := ""
Expand Down Expand Up @@ -549,7 +559,7 @@
PerPage(searchParams.PerPage).
CustomPerPages([]int64{c.lb.perPage}).
PerPageText(msgr.PaginationRowsPerPage).
// NoOffsetPart(true).
NoOffsetPart(true).
OnSelectPerPage(stateful.ReloadAction(ctx, c,
func(target *ListingCompo) {
target.Page = 0
Expand Down
25 changes: 18 additions & 7 deletions publish/version_compo.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ func DefaultVersionComponentFunc(mb *presets.ModelBuilder, cfg ...VersionCompone
publishEvent = config.PublishEvent(obj, field, ctx)
}
publishBtn = h.Div(
v.VBtn(msgr.Publish).Attr("@click", publishEvent).Rounded("0").
Class("rounded-s ml-2").Variant(v.VariantElevated).Color(v.ColorPrimary).Height(36),
v.VBtn(msgr.Publish).Attr("@click", publishEvent).Class("ml-2").
ClassIf("rounded", config.Top).ClassIf("rounded-0 rounded-s", !config.Top).
Variant(v.VariantElevated).Color(v.ColorPrimary).Height(36),
)
}
case StatusOnline:
Expand All @@ -144,8 +145,9 @@ func DefaultVersionComponentFunc(mb *presets.ModelBuilder, cfg ...VersionCompone
Class("ml-2").Variant(v.VariantElevated).Color(v.ColorError).Height(36)
}),
h.Iff(rePublishEvent != "", func() h.HTMLComponent {
return v.VBtn(msgr.Republish).Attr("@click", rePublishEvent).
Class("ml-2").ClassIf("rounded-0 rounded-s", true).Variant(v.VariantElevated).Color(v.ColorPrimary).Height(36)
return v.VBtn(msgr.Republish).Attr("@click", rePublishEvent).Class("ml-2").
ClassIf("rounded", config.Top).ClassIf("rounded-0 rounded-s", !config.Top).
Variant(v.VariantElevated).Color(v.ColorPrimary).Height(36)
}),
).Class("d-inline-flex")
}
Expand Down Expand Up @@ -311,8 +313,17 @@ func configureVersionListDialog(db *gorm.DB, pb *Builder, b *presets.Builder, pm
return in(model, params, ctx)
}
})
lb.CellWrapperFunc(func(cell h.MutableAttrHTMLComponent, id string, obj interface{}, dataTableID string) h.HTMLComponent {
return cell
lb.WrapCell(func(in presets.CellProcessor) presets.CellProcessor {
return func(evCtx *web.EventContext, cell h.MutableAttrHTMLComponent, id string, obj any) (h.MutableAttrHTMLComponent, error) {
compo := presets.ListingCompoFromEventContext(evCtx)
filter := MustFilterQuery(compo)
slug := obj.(presets.SlugEncoder).PrimarySlug()
filter.Set(filterKeySelected, slug)
cell.SetAttr("@click", stateful.ReloadAction(evCtx.R.Context(), compo, func(target *presets.ListingCompo) {
target.FilterQuery = filter.Encode()
}).Go())
return in(evCtx, cell, id, obj)
}
})
lb.Field("Version").ComponentFunc(func(obj interface{}, field *presets.FieldContext, ctx *web.EventContext) h.HTMLComponent {
compo := presets.ListingCompoFromEventContext(ctx)
Expand All @@ -322,7 +333,7 @@ func configureVersionListDialog(db *gorm.DB, pb *Builder, b *presets.Builder, pm
filter.Set(filterKeySelected, slug)
return h.Td().Children(
h.Div().Class("d-inline-flex align-center").Children(
v.VRadio().ModelValue(slug).TrueValue(selected).Attr("@change",
v.VRadio().ModelValue(slug).TrueValue(selected).Attr("@click.native.stop", true).Attr("@change",
stateful.ReloadAction(ctx.R.Context(), compo, func(target *presets.ListingCompo) {
target.FilterQuery = filter.Encode()
}).Go(),
Expand Down
2 changes: 1 addition & 1 deletion utils/testflow/gentool/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/gobuffalo/flect v1.0.2
github.com/pkg/errors v0.9.1
github.com/qor5/admin/v3 v3.0.1-0.20240424102851-d75759576158
github.com/qor5/web/v3 v3.0.6-0.20240806032534-6c0e81ec7b12
github.com/qor5/web/v3 v3.0.6-0.20240808073627-bd2003d12e2c
github.com/sergi/go-diff v1.3.1
mvdan.cc/gofumpt v0.6.0
)
Expand Down
4 changes: 2 additions & 2 deletions utils/testflow/gentool/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/qor5/web/v3 v3.0.6-0.20240806032534-6c0e81ec7b12 h1:CUJ8p/m0HFw/cizcrvUfKt7BkPvYMaVUv2qXDfs00ew=
github.com/qor5/web/v3 v3.0.6-0.20240806032534-6c0e81ec7b12/go.mod h1:32vdHHcZb2JimlcaclW9hLUyimdXjrllZDHTh3rl6d0=
github.com/qor5/web/v3 v3.0.6-0.20240808073627-bd2003d12e2c h1:uYoko94cUQN04E2hnZIsp/+yiEEI97V5OKcbS9cTa7o=
github.com/qor5/web/v3 v3.0.6-0.20240808073627-bd2003d12e2c/go.mod h1:32vdHHcZb2JimlcaclW9hLUyimdXjrllZDHTh3rl6d0=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
Expand Down
Loading