New option to add a message on top of the website
This commit is contained in:
parent
46a5cf09d1
commit
c1744940f5
|
@ -42,12 +42,16 @@ var (
|
||||||
CustomHeadHTML = ""
|
CustomHeadHTML = ""
|
||||||
CustomBodyHTML = ""
|
CustomBodyHTML = ""
|
||||||
HideVoxPeople = false
|
HideVoxPeople = false
|
||||||
|
MsgHeaderColor = "danger"
|
||||||
|
MsgHeaderText = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flag.StringVar(&CustomHeadHTML, "custom-head-html", CustomHeadHTML, "Add custom HTML right before </head>")
|
flag.StringVar(&CustomHeadHTML, "custom-head-html", CustomHeadHTML, "Add custom HTML right before </head>")
|
||||||
flag.StringVar(&CustomBodyHTML, "custom-body-html", CustomBodyHTML, "Add custom HTML right before </body>")
|
flag.StringVar(&CustomBodyHTML, "custom-body-html", CustomBodyHTML, "Add custom HTML right before </body>")
|
||||||
flag.BoolVar(&HideVoxPeople, "hide-feedback-button", HideVoxPeople, "Hide the icon on page that permit to give feedback")
|
flag.BoolVar(&HideVoxPeople, "hide-feedback-button", HideVoxPeople, "Hide the icon on page that permit to give feedback")
|
||||||
|
flag.StringVar(&MsgHeaderText, "msg-header-text", MsgHeaderText, "Custom message banner to add at the top of the app")
|
||||||
|
flag.StringVar(&MsgHeaderColor, "msg-header-color", MsgHeaderColor, "Background color of the banner added at the top of the app")
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeclareRoutes(cfg *config.Options, router *gin.Engine) {
|
func DeclareRoutes(cfg *config.Options, router *gin.Engine) {
|
||||||
|
@ -55,6 +59,10 @@ func DeclareRoutes(cfg *config.Options, router *gin.Engine) {
|
||||||
CustomHeadHTML += "<style>#voxpeople { display: none !important; }</style>"
|
CustomHeadHTML += "<style>#voxpeople { display: none !important; }</style>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(MsgHeaderText) != 0 {
|
||||||
|
CustomHeadHTML += fmt.Sprintf(`<script type="text/javascript">window.msg_header = { text: %q, color: %q };</script>`, MsgHeaderText, MsgHeaderColor)
|
||||||
|
}
|
||||||
|
|
||||||
if cfg.DevProxy != "" {
|
if cfg.DevProxy != "" {
|
||||||
router.GET("/.svelte-kit/*_", serveOrReverse("", cfg))
|
router.GET("/.svelte-kit/*_", serveOrReverse("", cfg))
|
||||||
router.GET("/node_modules/*_", serveOrReverse("", cfg))
|
router.GET("/node_modules/*_", serveOrReverse("", cfg))
|
||||||
|
|
|
@ -80,6 +80,17 @@
|
||||||
|
|
||||||
<!--Styles /-->
|
<!--Styles /-->
|
||||||
|
|
||||||
|
{#if window.msg_header}
|
||||||
|
<div
|
||||||
|
class={(window.msg_header.color?"bg-" + window.msg_header.color:"bg-danger") + " text-light text-center fw-bolder pb-1"}
|
||||||
|
id="msg_header"
|
||||||
|
style="z-index: 101; margin-bottom: -.2em"
|
||||||
|
>
|
||||||
|
<small>
|
||||||
|
{window.msg_header.text}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<Header
|
<Header
|
||||||
routeId={data.route.id}
|
routeId={data.route.id}
|
||||||
sw_state={data.sw_state}
|
sw_state={data.sw_state}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user