8000 fix string format by zhangshanwen · Pull Request #539 · qor5/admin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix string format #539

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

Merged
merged 1 commit into from
Aug 30, 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
8 changes: 4 additions & 4 deletions media/filechooser.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func fileComponent(
Go()),
),
)
clickEvent := fmt.Sprintf(`vars.imageSrc="%s";vars.imagePreview=true;`, src)
clickEvent := fmt.Sprintf(`vars.imageSrc=%q;vars.imagePreview=true;`, src)
if base.IsImageFormat(f.File.FileName) && inMediaLibrary {
*event = clickEvent
}
Expand Down Expand Up @@ -711,9 +711,9 @@ func mediaLibraryContent(mb *Builder, field string, ctx *web.EventContext,
VTab(h.Text(msgr.Folders)).Value(tabFolders),
).Attr("v-model", "tabLocals.tab").
Attr("@update:model-value",
fmt.Sprintf(`$event=="%s"?null:%v`, tab, clickTabEvent),
fmt.Sprintf(`$event==%q?null:%v`, tab, clickTabEvent),
),
).VSlot(`{locals:tabLocals}`).Init(fmt.Sprintf(`{tab:"%s"}`, tab)),
).VSlot(`{locals:tabLocals}`).Init(fmt.Sprintf(`{tab:%q}`, tab)),
),
),
),
Expand Down Expand Up @@ -891,7 +891,7 @@ func searchComponent(ctx *web.EventContext, field string, cfg *media_library.Med
HideDetails(true).
SingleLine(true).
Attr("v-model", "vars.searchMsg").
Attr(web.VAssign("vars", fmt.Sprintf(`{searchMsg:"%s"}`, ctx.Param(searchKeywordName(field))))...).
Attr(web.VAssign("vars", fmt.Sprintf(`{searchMsg:%q}`, ctx.Param(searchKeywordName(field))))...).
Attr("@click:clear", `vars.searchMsg="";`+event).
Attr("@keyup.enter", event).
Children(
Expand Down
2 changes: 1 addition & 1 deletion pagebuilder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ func (b *Builder) deviceToggle(ctx *web.EventContext) h.HTMLComponent {
Attr("v-model", "toggleLocals.activeDevice").
Attr("@update:model-value", web.Plaid().EventFunc(ReloadRenderPageOrTemplateEvent).
PushState(true).MergeQuery(true).Query(paramsDevice, web.Var("toggleLocals.activeDevice")).Go()),
).VSlot("{ locals : toggleLocals}").Init(fmt.Sprintf(`{activeDevice: "%s"}`, device))
).VSlot("{ locals : toggleLocals}").Init(fmt.Sprintf(`{activeDevice: %q}`, device))
}

func (b *Builder) getModelBuilder(mb *presets.ModelBuilder) *ModelBuilder {
Expand Down
4 changes: 2 additions & 2 deletions pagebuilder/model_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ func (b *ModelBuilder) renderContainersSortedList(ctx *web.EventContext) (r h.HT
),
),
).Name("append"),
).Attr(":variant", fmt.Sprintf(` element.hidden &&!isHovering && !element.editShow?"%s":"%s"`, VariantPlain, VariantText)).
).Attr(":variant", fmt.Sprintf(` element.hidden &&!isHovering && !element.editShow?%q:%q`, VariantPlain, VariantText)).
Attr(":class", fmt.Sprintf(`element.container_data_id==vars.%s && !element.hidden?"bg-%s":""`, paramContainerDataID, ColorPrimaryLighten2)).
Attr("v-bind", "props", "@click", clickColumnEvent).
Attr(web.VAssign("vars",
fmt.Sprintf(`{%s:"%s"}`, paramContainerDataID, ctx.Param(paramContainerDataID)))...),
fmt.Sprintf(`{%s:%q}`, paramContainerDataID, ctx.Param(paramContainerDataID)))...),
).Name("default").Scope("{ isHovering, props }"),
),
VDivider(),
Expand Down
8 changes: 4 additions & 4 deletions pagebuilder/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@
Count(&containerCount)
var copyURL string
if p, ok := obj.(publish.StatusInterface); ok {
copyURL = fmt.Sprintf(`$event.view.window.location.origin+"%s"`, previewDevelopUrl)
copyURL = fmt.Sprintf(`$event.view.window.location.origin+%q`, previewDevelopUrl)
if p.EmbedStatus().Status == publish.StatusOnline {
>
Density(DensityCompact).Type(TypeInfo).Variant(VariantTonal).Closable(true).Class("mb-2")
previewDevelopUrl = b.publisher.FullUrl(p.EmbedStatus().OnlineUrl)
copyURL = fmt.Sprintf(`"%s"`, previewDevelopUrl)
copyURL = fmt.Sprintf(`%q`, previewDevelopUrl)

Check warning on line 79 in pagebuilder/settings.go

View check run for this annotation

Codecov / codecov/patch

pagebuilder/settings.go#L79

Added line #L79 was not covered by tests
}
}
return h.Div(
Expand Down Expand Up @@ -118,7 +118,7 @@
h.Div(
h.A(h.Text(previewDevelopUrl)).Href(previewDevelopUrl),
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: "%s"}`, copyURL, ColorSuccess)),
Attr("@click", fmt.Sprintf(`$event.view.window.navigator.clipboard.writeText(%s);vars.presetsMessage = { show: true, message: "success", color: %q}`, copyURL, ColorSuccess)),
).Class("d-inline-flex align-center py-4"),
).Class("my-10")
}
Expand Down Expand Up @@ -184,7 +184,7 @@
}
msgr := i18n.MustGetModuleMessages(ctx.R, I18nPageBuilderKey, Messages_en_US).(*Messages)
return h.Div(
detailingRow(msgr.Title, h.Text(p.Title)).Attr(web.VAssign("vars", fmt.Sprintf(`{pageTitle:"%s"}`, p.Title))...),
detailingRow(msgr.Title, h.Text(p.Title)).Attr(web.VAssign("vars", fmt.Sprintf(`{pageTitle:%q}`, p.Title))...),
detailingRow(msgr.Slug, h.Text(p.Slug)),
detailingRow(msgr.Category, h.Text(category.Path)),
)
Expand Down
4 changes: 2 additions & 2 deletions pagebuilder/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (b *TemplateBuilder) searchComponent(ctx *web.EventContext) h.HTMLComponent
HideDetails(true).
SingleLine(true).
Attr("v-model", "vars.searchMsg").
Attr(web.VAssign("vars", fmt.Sprintf(`{searchMsg:"%s"}`, ctx.Param(ParamSearchKeyword)))...).
Attr(web.VAssign("vars", fmt.Sprintf(`{searchMsg:%q}`, ctx.Param(ParamSearchKeyword)))...).
Attr("@click:clear", `vars.searchMsg="";`+clickEvent).
Attr("@keyup.enter", clickEvent).
Children(
Expand Down Expand Up @@ -396,7 +396,7 @@ func (b *TemplateBuilder) selectedTemplate(ctx *web.EventContext) h.HTMLComponen
h.Div(
h.Span(name).Class("text-caption"),
).Class("mt-2"),
).Class("mb-6").Attr(web.VAssign("form", fmt.Sprintf(`{%s:"%s"}`, ParamTemplateSelectedID, selectID))...)
).Class("mb-6").Attr(web.VAssign("form", fmt.Sprintf(`{%s:%q}`, ParamTemplateSelectedID, selectID))...)
}

type TemplateSelected struct {
Expand Down
Loading
0