Skip to content

Commit

Permalink
Merge pull request #643 from qor5/toast-multiline
Browse files Browse the repository at this point in the history
other snackbars support multiline text display
  • Loading branch information
molon authored Oct 14, 2024
2 parents a9b24ad + 07a493f commit 3da9ca1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pagebuilder/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,9 @@ func (b *Builder) pageEditorLayout(in web.PageFunc, config *presets.LayoutConfig
web.Portal().Name(dialogPortalName),
web.Portal().Name(addContainerDialogPortal),
h.Template(
VSnackbar(h.Text("{{vars.presetsMessage.message}}")).
VSnackbar(
h.Div().Style("white-space: pre-wrap").Text("{{vars.presetsMessage.message}}"),
).
Attr("v-model", "vars.presetsMessage.show").
Attr(":color", "vars.presetsMessage.color").
Timeout(1000),
Expand Down
4 changes: 3 additions & 1 deletion presets/detailing.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ func (b *DetailingBuilder) defaultPageFunc(ctx *web.EventContext) (r web.PageRes

var notice h.HTMLComponent
if msg, ok := ctx.Flash.(string); ok {
notice = VSnackbar(h.Text(msg)).ModelValue(true).Location("top").Color("success")
notice = VSnackbar(
h.Div().Attr("v-pre", true).Style("white-space: pre-wrap").Text(msg),
).ModelValue(true).Location("top").Color("success")
}

comp := web.Scope(b.ToComponent(b.mb.Info(), obj, ctx)).VSlot("{form}")
Expand Down
2 changes: 1 addition & 1 deletion presets/editing.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func (b *EditingBuilder) editFormFor(obj interface{}, ctx *web.EventContext) h.H
if text != "" {
notice = web.Scope(
VSnackbar(
h.Text(text),
h.Div().Attr("v-pre", true).Style("white-space: pre-wrap").Text(text),
).Location("top").
Timeout(2000).
Color(color).
Expand Down
4 changes: 3 additions & 1 deletion presets/presets.go
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,9 @@ func (b *Builder) PlainLayout(in web.PageFunc) (out web.PageFunc) {
Height(2).
Color(b.progressBarColor),
h.Template(
VSnackbar(h.Text("{{vars.presetsMessage.message}}")).
VSnackbar(
h.Div().Style("white-space: pre-wrap").Text("{{vars.presetsMessage.message}}"),
).
Attr("v-model", "vars.presetsMessage.show").
Attr(":color", "vars.presetsMessage.color").
Timeout(2000).
Expand Down

0 comments on commit 3da9ca1

Please sign in to comment.