mirror of https://github.com/statping/statping
dev: Add base.gohtml in assets [#137](https://github.com/statping-ng/statping-ng/issues/137)
parent
b7ecf0c31b
commit
96a844a014
|
@ -8,7 +8,7 @@ const tokenKey = "statping_auth";
|
||||||
class Api {
|
class Api {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.version = "0.91.0";
|
this.version = "0.91.0";
|
||||||
this.commit = "40f31e3110550754a929a9f848c2eefa4df9ae3f";
|
this.commit = "b7ecf0c31b0c75c394061d2f6457a925e4440f1e";
|
||||||
}
|
}
|
||||||
|
|
||||||
async oauth() {
|
async oauth() {
|
||||||
|
|
|
@ -172,18 +172,33 @@ func ExecuteResponse(w http.ResponseWriter, r *http.Request, file string, data i
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorln(err)
|
log.Errorln(err)
|
||||||
}
|
}
|
||||||
render, err := source.TmplBox.String(file)
|
|
||||||
if err != nil {
|
log.Infoln("Ca commence à être intéressant")
|
||||||
log.Errorln(err)
|
asset := file
|
||||||
}
|
if source.UsingAssets(utils.Directory) {
|
||||||
// render the page requested
|
|
||||||
if _, err := mainTemplate.Parse(render); err != nil {
|
asset = utils.Directory + "/assets/" + file
|
||||||
log.Errorln(err)
|
log.Infoln(fmt.Sprintf("asset : %s", asset))
|
||||||
|
|
||||||
|
if _, err := mainTemplate.ParseFiles(asset); err != nil {
|
||||||
|
log.Errorln(err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
render, err := source.TmplBox.String(asset)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorln(err)
|
||||||
|
}
|
||||||
|
// render the page requested
|
||||||
|
if _, err := mainTemplate.Parse(render); err != nil {
|
||||||
|
log.Errorln(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
log.Infoln("step 3")
|
||||||
// execute the template
|
// execute the template
|
||||||
if err := mainTemplate.Execute(w, data); err != nil {
|
if err := mainTemplate.Execute(w, data); err != nil {
|
||||||
log.Errorln(err)
|
log.Errorln(err)
|
||||||
}
|
}
|
||||||
|
log.Infoln("step 4")
|
||||||
}
|
}
|
||||||
|
|
||||||
func returnJson(d interface{}, w http.ResponseWriter, r *http.Request) {
|
func returnJson(d interface{}, w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ var (
|
||||||
"scss/mobile.scss",
|
"scss/mobile.scss",
|
||||||
"scss/variables.scss",
|
"scss/variables.scss",
|
||||||
"robots.txt",
|
"robots.txt",
|
||||||
|
"base.gohtml",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -87,6 +88,7 @@ func CompileSASS() error {
|
||||||
|
|
||||||
// UsingAssets returns true if the '/assets' folder is found in the directory
|
// UsingAssets returns true if the '/assets' folder is found in the directory
|
||||||
func UsingAssets(folder string) bool {
|
func UsingAssets(folder string) bool {
|
||||||
|
log.Infoln(fmt.Sprintf("using assets? checking %s", folder))
|
||||||
if _, err := os.Stat(folder + "/assets"); err == nil {
|
if _, err := os.Stat(folder + "/assets"); err == nil {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
@ -174,7 +176,7 @@ func DeleteAllAssets(folder string) error {
|
||||||
// CopyAllToPublic will copy all the files in a rice box into a local folder
|
// CopyAllToPublic will copy all the files in a rice box into a local folder
|
||||||
func CopyAllToPublic(box *rice.Box) error {
|
func CopyAllToPublic(box *rice.Box) error {
|
||||||
exclude := map[string]bool{
|
exclude := map[string]bool{
|
||||||
"base.gohtml": true,
|
// "base.gohtml": true,
|
||||||
"index.html": true,
|
"index.html": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue