use external gfbmb package
This commit is contained in:
1 parent
be3f79d2e1
commit
7f9b531388
5 files changed
+11
-38
No files matched your search
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/SowinskiBraeden/MyHomeCloud/render"
|
||||
"github.com/SowinskiBraeden/gfbmb/messageBox"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
@@ -26,7 +26,7 @@ func UploadImage(c *fiber.Ctx) error {
|
||||
err := c.SaveFile(file, fmt.Sprintf("./images/%s", image))
|
||||
if err != nil {
|
||||
return c.Status(fiber.StatusInternalServerError).Render("upload", fiber.Map{
|
||||
"errorMsg": render.NewErrorBox("the image could not be saved"),
|
||||
"errorMsg": messageBox.NewDangerBox("the image could not be saved"),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -37,6 +37,6 @@ func UploadImage(c *fiber.Ctx) error {
|
||||
// newImage.Album =
|
||||
|
||||
return c.Status(fiber.StatusNotImplemented).Render("upload", fiber.Map{
|
||||
"errorMsg": render.NewSuccessBox("Success"),
|
||||
"errorMsg": messageBox.NewSuccessBox("Success"),
|
||||
})
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package controllers
|
||||
|
||||
import "github.com/gofiber/fiber/v2"
|
||||
import (
|
||||
"github.com/SowinskiBraeden/gfbmb/messageBox"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
// Render Index
|
||||
func MainPage(c *fiber.Ctx) error {
|
||||
@@ -9,6 +12,6 @@ func MainPage(c *fiber.Ctx) error {
|
||||
|
||||
func UploadImageView(c *fiber.Ctx) error {
|
||||
return c.Render("upload", fiber.Map{
|
||||
"errorMsg": "<div></div>",
|
||||
"errorMsg": messageBox.EmptyMessageBox(),
|
||||
})
|
||||
}
|
||||
@@ -3,6 +3,7 @@ module github.com/SowinskiBraeden/MyHomeCloud
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/SowinskiBraeden/gfbmb v0.0.0-20220411232833-d7374a8d6af0
|
||||
github.com/gofiber/fiber/v2 v2.31.0
|
||||
github.com/gofiber/template v1.6.26
|
||||
github.com/google/uuid v1.3.0
|
||||
|
||||
@@ -54,6 +54,8 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3
|
||||
github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
|
||||
github.com/Joker/jade v1.1.3/go.mod h1:T+2WLyt7VH6Lp0TRxQrUYEs64nRc83wkMQrfeIQKduM=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/SowinskiBraeden/gfbmb v0.0.0-20220411232833-d7374a8d6af0 h1:2bxOMciaau/pWgzkH4ZXXHVTdUW/0GBvJ4Z0QW0eymU=
|
||||
github.com/SowinskiBraeden/gfbmb v0.0.0-20220411232833-d7374a8d6af0/go.mod h1:0qAOkswfp8zWWtmsRdP29foVySFrN2dlHWiTblpH7JA=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package render
|
||||
|
||||
func NewWarningBox(message string) string {
|
||||
return `
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
` + message + `
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>`
|
||||
}
|
||||
|
||||
func NewErrorBox(message string) string {
|
||||
return `
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
` + message + `
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
|
||||
func NewSuccessBox(message string) string {
|
||||
return `
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
` + message + `
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
Reference in new issue
Block a user