2023-05-18 21:17:17 +00:00
|
|
|
package overlay
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.d3nexus.de/Dadido3/D3vugu-components/components/input"
|
|
|
|
"github.com/vugu/vugu"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ModalRequester struct {
|
|
|
|
OverlayContainerRef
|
|
|
|
|
2023-05-25 13:59:13 +00:00
|
|
|
IconSlot vugu.Builder `vugu:"data"` // Slot for the symbol.
|
2023-05-18 21:17:17 +00:00
|
|
|
|
|
|
|
Title string `vugu:"data"`
|
|
|
|
Message string `vugu:"data"`
|
|
|
|
|
2023-05-19 21:45:39 +00:00
|
|
|
SignalColor string // A d3c CSS class for the color scheme of the small bar.
|
|
|
|
|
2023-05-18 21:17:17 +00:00
|
|
|
ClickAbort input.ClickHandler
|
|
|
|
ClickYes input.ClickHandler
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ModalRequester) handleClickAbort(event vugu.DOMEvent) {
|
|
|
|
if c.ClickAbort != nil {
|
|
|
|
c.ClickAbort.ClickHandle(input.ClickEvent{DOMEvent: event})
|
|
|
|
}
|
|
|
|
c.SetModal(nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ModalRequester) handleClickYes(event vugu.DOMEvent) {
|
|
|
|
if c.ClickYes != nil {
|
|
|
|
c.ClickYes.ClickHandle(input.ClickEvent{DOMEvent: event})
|
|
|
|
}
|
|
|
|
c.SetModal(nil)
|
|
|
|
}
|
|
|
|
|
2023-05-19 21:45:39 +00:00
|
|
|
// OverlayClasses implements OverlayClassesGetter which is used by the overlay package to add classes to overlay elements.
|
|
|
|
func (c *ModalRequester) OverlayClasses() (signalClasses, containerClasses string) {
|
|
|
|
return c.SignalColor, ""
|
|
|
|
}
|
|
|
|
|
2023-05-18 21:17:17 +00:00
|
|
|
// PageTitle implements PageTitleGetter which is used by PageInfo.
|
|
|
|
func (c *ModalRequester) PageTitle() (title, longTitle, shortTitle string) {
|
|
|
|
return c.Title, c.Title, c.Title
|
|
|
|
}
|