Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
b87e0113c9 | |||
1657c19cc4 | |||
95a37c9aca | |||
852d647f09 | |||
a390b5a02f | |||
f07131086a | |||
00adaed6a8 |
5 changed files with 18 additions and 8 deletions
9
core.go
9
core.go
|
@ -36,6 +36,7 @@ var cacheC CacheConfig
|
||||||
var db *gorm.DB
|
var db *gorm.DB
|
||||||
var mailer *Mailer
|
var mailer *Mailer
|
||||||
var basePath string
|
var basePath string
|
||||||
|
var runMode string
|
||||||
var disableEvents bool = false
|
var disableEvents bool = false
|
||||||
|
|
||||||
//go:embed all:template
|
//go:embed all:template
|
||||||
|
@ -107,12 +108,14 @@ func (app *App) Run(router *httprouter.Router) {
|
||||||
}
|
}
|
||||||
useHttps, _ := strconv.ParseBool(useHttpsStr)
|
useHttps, _ := strconv.ParseBool(useHttpsStr)
|
||||||
|
|
||||||
|
if runMode == "dev" {
|
||||||
fmt.Printf("Welcome to Goffee\n")
|
fmt.Printf("Welcome to Goffee\n")
|
||||||
if useHttps {
|
if useHttps {
|
||||||
fmt.Printf("Listening on https \nWaiting for requests...\n")
|
fmt.Printf("Listening on https \nWaiting for requests...\n")
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("Listening on port %s\nWaiting for requests...\n", portNumber)
|
fmt.Printf("Listening on port %s\nWaiting for requests...\n", portNumber)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check if use letsencrypt
|
// check if use letsencrypt
|
||||||
UseLetsEncryptStr := os.Getenv("App_USE_LETSENCRYPT")
|
UseLetsEncryptStr := os.Getenv("App_USE_LETSENCRYPT")
|
||||||
|
@ -177,7 +180,7 @@ func (app *App) RegisterRoutes(routes []Route, router *httprouter.Router) *httpr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if use letsencrypt
|
// check if enable core services
|
||||||
UseCoreServicesStr := os.Getenv("App_USE_CORESERVICES")
|
UseCoreServicesStr := os.Getenv("App_USE_CORESERVICES")
|
||||||
if UseCoreServicesStr == "" {
|
if UseCoreServicesStr == "" {
|
||||||
UseCoreServicesStr = "false"
|
UseCoreServicesStr = "false"
|
||||||
|
@ -571,6 +574,10 @@ func (app *App) SetBasePath(path string) {
|
||||||
basePath = path
|
basePath = path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (app *App) SetRunMode(runmode string) {
|
||||||
|
runMode = runmode
|
||||||
|
}
|
||||||
|
|
||||||
func DisableEvents() {
|
func DisableEvents() {
|
||||||
disableEvents = true
|
disableEvents = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ type ContentDropdown struct {
|
||||||
type ContentDropdownItem struct {
|
type ContentDropdownItem struct {
|
||||||
Text string
|
Text string
|
||||||
Link string
|
Link string
|
||||||
|
ID string
|
||||||
IsDisabled bool
|
IsDisabled bool
|
||||||
IsActive bool
|
IsActive bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{define "content_dropdown_item"}}
|
{{define "content_dropdown_item"}}
|
||||||
<li><a class="dropdown-item {{if eq .IsActive true}}active{{end}} {{if eq .IsDisabled true}}disabled{{end}}" href="{{.Link}}">{{.Text}}</a></li>
|
<li><a {{ if .ID }}id="{{.ID}}"{{end}} class="dropdown-item {{if eq .IsActive true}}active{{end}} {{if eq .IsDisabled true}}disabled{{end}}" href="{{.Link}}">{{.Text}}</a></li>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{define "content_dropdown"}}
|
{{define "content_dropdown"}}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package components
|
||||||
type ContentHref struct {
|
type ContentHref struct {
|
||||||
Text string
|
Text string
|
||||||
Link string
|
Link string
|
||||||
|
Target string // _blank _parent _self _top
|
||||||
Icon string
|
Icon string
|
||||||
IsButton bool
|
IsButton bool
|
||||||
TypeClass string // type primary, secondary, success, danger, warning, info, light, dark, link
|
TypeClass string // type primary, secondary, success, danger, warning, info, light, dark, link
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{{define "content_href"}}
|
{{define "content_href"}}
|
||||||
<a class="{{if eq .IsButton true}} btn btn-{{.TypeClass}}{{end}} {{if eq .IsDisabled true}}disabled{{end}}"
|
<a class="{{if eq .IsButton true}} btn btn-{{.TypeClass}}{{end}} {{if eq .IsDisabled true}}disabled{{end}}"
|
||||||
|
{{if .Target}} target="{{.Target}}"{{end}}
|
||||||
href="{{.Link}}" {{if eq .IsButton true}}role="button"{{end}} {{if eq .IsDisabled true}}aria-disabled="true"{{end}}>
|
href="{{.Link}}" {{if eq .IsButton true}}role="button"{{end}} {{if eq .IsDisabled true}}aria-disabled="true"{{end}}>
|
||||||
{{.Text}}
|
{{.Text}}
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in a new issue