diff --git a/example/integration/pagebuilder_test.go b/example/integration/pagebuilder_test.go index b6fbb0ac..3e385c05 100644 --- a/example/integration/pagebuilder_test.go +++ b/example/integration/pagebuilder_test.go @@ -42,7 +42,7 @@ func TestMain(m *testing.M) { // via SetupDatabase. The user config relies on GORM creating associations for user roles, // so the plugin must not be active on this connection. var err error - TestDB, err = gorm.Open(postgres.Open(testSuite.DSN()), &gorm.Config{}) + TestDB, err = gorm.Open(postgres.Open(testSuite.DSN()), &gorm.Config{SkipDefaultTransaction: true}) if err != nil { panic(err) } diff --git a/go.mod b/go.mod index ec499312..a3751f52 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/qor5/imaging v1.6.4 github.com/qor5/web v1.3.2 github.com/qor5/web/v3 v3.0.12-0.20250618085230-3764d0e521a8 - github.com/qor5/x/v3 v3.2.1-0.20260515090943-65b6f4f15c42 + github.com/qor5/x/v3 v3.2.1-0.20260522031431-46d6ad4cfc7e github.com/samber/lo v1.50.0 github.com/shurcooL/sanitized_anchor_name v1.0.0 github.com/spf13/cast v1.7.1 diff --git a/go.sum b/go.sum index 698ff968..cbe4d814 100644 --- a/go.sum +++ b/go.sum @@ -446,6 +446,8 @@ github.com/qor5/web/v3 v3.0.12-0.20250618085230-3764d0e521a8 h1:s3jBS5bq6VX56Gic github.com/qor5/web/v3 v3.0.12-0.20250618085230-3764d0e521a8/go.mod h1:hrhZ4nc1U+AOBrGmnUoRUPpA9fymxlAbNfGvn9TJLns= github.com/qor5/x/v3 v3.2.1-0.20260515090943-65b6f4f15c42 h1:BQUNVobg116KpSDV42Nz1vD6Ks+m8V79iutGm/ECskM= github.com/qor5/x/v3 v3.2.1-0.20260515090943-65b6f4f15c42/go.mod h1:aw3fBGpEbyrEoGLOtQdBTUAKNJ7i0RE1exHjHJSlPbs= +github.com/qor5/x/v3 v3.2.1-0.20260522031431-46d6ad4cfc7e h1:lY7f8OnU8JXmYkhSgNbqFAZ35nI45rFO2582nzBUtac= +github.com/qor5/x/v3 v3.2.1-0.20260522031431-46d6ad4cfc7e/go.mod h1:aw3fBGpEbyrEoGLOtQdBTUAKNJ7i0RE1exHjHJSlPbs= github.com/redis/go-redis/v9 v9.16.0 h1:OotgqgLSRCmzfqChbQyG1PHC3tLNR89DG4jdOERSEP4= github.com/redis/go-redis/v9 v9.16.0/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= diff --git a/pagebuilder/messages.go b/pagebuilder/messages.go index d030abf6..2385a617 100644 --- a/pagebuilder/messages.go +++ b/pagebuilder/messages.go @@ -103,6 +103,7 @@ type Messages struct { SharedContainerHasBeenUpdated string TemplateFixedAreaMessage string SharedContainerModificationWarning string + Success string } var Messages_en_US = &Messages{ @@ -201,6 +202,7 @@ var Messages_en_US = &Messages{ SharedContainerHasBeenUpdated: "The shared container on this page has been updated. You may notice differences between the preview and the live page.", TemplateFixedAreaMessage: "This container is fixed and cannot be updated", SharedContainerModificationWarning: "This is a shared container. Any modifications you make will apply to all pages that use it", + Success: "Success", } var Messages_zh_CN = &Messages{ @@ -300,6 +302,7 @@ var Messages_zh_CN = &Messages{ SharedContainerHasBeenUpdated: "此页面上的共享容器已更新。您可能会注意到预览和实时页面之间的差异。", TemplateFixedAreaMessage: "此区域由模板固定,无法编辑。", SharedContainerModificationWarning: "这是一个共享容器。您所做的任何修改都将应用于使用它的所有页面", + Success: "成功", } var Messages_ja_JP = &Messages{ @@ -397,6 +400,7 @@ var Messages_ja_JP = &Messages{ SharedContainerHasBeenUpdated: "このページの共有コンテナが更新されました。プレビューとライブページの間に違いがあるかもしれません。", TemplateFixedAreaMessage: "この領域はテンプレートによって固定されており、編集できません。", SharedContainerModificationWarning: "これは共有コンテナです。行った変更は、それを使用するすべてのページに適用されます", + Success: "成功", } type ModelsI18nModulePage struct { diff --git a/pagebuilder/settings.go b/pagebuilder/settings.go index 4253505b..6d7f4d37 100644 --- a/pagebuilder/settings.go +++ b/pagebuilder/settings.go @@ -146,7 +146,7 @@ transform-origin: 0 0; transform:scale(0.5);width:200%;height:200%`), h.Div( previewComp, VBtn("").Icon("mdi-content-copy").Color(ColorSecondary).Width(20).Height(20).Variant(VariantText).Size(SizeXSmall).Class("ml-1 fix-btn-icon"). - Attr("@click", fmt.Sprintf(`$event.view.window.navigator.clipboard.writeText(%s);vars.presetsMessage = { show: true, message: "success", color: %q}`, copyURL, ColorSuccess)), + Attr("@click", fmt.Sprintf(`$event.view.window.navigator.clipboard.writeText(%s);vars.presetsMessage = { show: true, message: %q, color: %q}`, copyURL, msgr.Success, ColorSuccess)), ).Class("d-inline-flex align-center py-4"), ).Class("my-10") } diff --git a/presets/listing_builder.go b/presets/listing_builder.go index b48c264c..e60e466a 100644 --- a/presets/listing_builder.go +++ b/presets/listing_builder.go @@ -372,10 +372,12 @@ func (b *ListingBuilder) openListingDialog(evCtx *web.EventContext) (r web.Event } compo.OnMounted = fmt.Sprintf(`({el}) => { - var listingDialogElem = el.ownerDocument.getElementById(%q); - if (listingDialogElem && listingDialogElem.offsetHeight > parseInt(listingDialogElem.style.minHeight || '0', 10)) { + var listingDialogElem = el.ownerDocument.getElementById(%q); + if (listingDialogElem) { + // Reset so the dialog can shrink when content gets shorter, then re-lock to prevent flicker on next reload. + listingDialogElem.style.minHeight = '0px'; listingDialogElem.style.minHeight = listingDialogElem.offsetHeight+'px'; - }; + } }`, compo.CompoID()) content := v.VCard().Attr("id", compo.CompoID()).Children( diff --git a/publish/version_compo.go b/publish/version_compo.go index 8e2db18e..4ac4876b 100644 --- a/publish/version_compo.go +++ b/publish/version_compo.go @@ -235,12 +235,16 @@ func buildScheduleButton(obj interface{}, ctx *web.EventContext, mb *presets.Mod Query(presets.ParamID, slug). URL(mb.Info().ListingHref()).Go() if config.Top { - scheduleBtn = v.VAutocomplete().PrependInnerIcon("mdi-alarm").Density(v.DensityCompact). - Variant(v.FieldVariantSoloFilled).ModelValue(msgr.SchedulePublishTime). - BgColor(v.ColorPrimaryLighten2).Readonly(true). - Width(500).HideDetails(true). + scheduleBtn = v.VBtn(msgr.SchedulePublishTime). + PrependIcon("mdi-alarm"). + AppendIcon("mdi-menu-down"). + Variant(v.VariantFlat). + Color(v.ColorPrimaryLighten2). + Density(v.DensityCompact). + Height(36). Attr(":disabled", phraseHasPresetsDataChanged). - Attr("@click", clickEvent).Class("ml-2 text-caption page-builder-autoCmp") + Attr("@click", clickEvent). + Class("ml-2 text-caption text-none") } else { scheduleBtn = v.VBtn("").Size(v.SizeSmall).Children(v.VIcon("mdi-alarm").Size(v.SizeXLarge)).Rounded("0").Class("rounded-e ml-abs-1"). Variant(v.VariantElevated).Color(v.ColorPrimary).Width(36).Height(36). @@ -344,7 +348,7 @@ func configureVersionListDialog(db *gorm.DB, pb *Builder, b *presets.Builder, pm } lb := mb.Listing(listingFields...). - DialogWidth("900px"). + DialogWidth("900"). Title(func(evCtx *web.EventContext, _ presets.ListingStyle, _ string) (string, h.HTMLComponent, error) { msgr := i18n.MustGetModuleMessages(evCtx.R, I18nPublishKey, Messages_en_US).(*Messages) return msgr.VersionsList, nil, nil