Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sowinskibraeden/gfbmb
GoFiber BootStrap Message Box, an easy solution to insert BootStrap message boxes into your html page via GoFiber.
https://github.com/sowinskibraeden/gfbmb
bootstrap gofiber html-template
Last synced: 11 days ago
JSON representation
GoFiber BootStrap Message Box, an easy solution to insert BootStrap message boxes into your html page via GoFiber.
- Host: GitHub
- URL: https://github.com/sowinskibraeden/gfbmb
- Owner: SowinskiBraeden
- Created: 2022-04-11T23:09:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-11T23:28:33.000Z (over 2 years ago)
- Last Synced: 2024-11-09T05:06:35.127Z (11 days ago)
- Topics: bootstrap, gofiber, html-template
- Language: Go
- Homepage:
- Size: 31.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## GoFiber BootStrap Message Box (gfbmb)
GoFiber BootStrap Message Box, and easy solution to insert BootStrap message boxes into your html page via GoFiber.
### Getting Started
1. Get the module in your terminal.
```
go get github.com/SowinskiBraeden/gfbmb
```2. Ensure your GoFiber engine has `unescape` defined.
```GoLang
engine.AddFunc(
"unescape", func(s string) template.HTML {
return template.HTML(s)
},
)
```3. Ensure your html page has the required modules.
```html```
4. Place where you want your Message box to go in your html page.
```html
{{ unescape msgBox }}
```5. Render your html page with the empty message box.
```GoLang
app.Get("/", func(c *fiber.Ctx) error {
return c.Render("index", fiber.Map{
"msgBox": messageBox.EmptyMessageBox(),
})
})
```6. When rendering a page with a message, use one of the following...
```GoLang
newMsgBox, err := messageBox.NewMessageBox(message, msgType)
// msgType is optional, providing none will default to 'success'
// msgType can be 'success', 'warning' or 'danger'
if err != nil {
return c.Render("index", fiber.Map{
"msgBox": messageBox.NewDangerBox(err.Error()),
})
}
```
or one of these...
```GoLang
newMsgBox := messageBox.NewSuccessBox(message)
newMsgBox := messageBox.NewWarningBox(message)
newMsgBox := messageBox.NewErrorBox(message)
```7. Render your html page with your new Message Box.
```GoLang
return c.Render("index", fiber.Map{
"msgBox": newMsgBox,
})
```You can see the full example using the `main.go` file.