2017-11-10 12:39:55 +01:00
|
|
|
package templates
|
|
|
|
|
|
|
|
import (
|
|
|
|
"html/template"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2018-06-17 16:15:58 +02:00
|
|
|
func (tm *TemplateManager) funcMap() template.FuncMap {
|
|
|
|
return template.FuncMap{
|
|
|
|
"bgPatternCount": tm.bgPatternCount,
|
|
|
|
"debugMode": tm.debugMode,
|
|
|
|
"apiUrl": tm.apiURL,
|
|
|
|
}
|
2017-11-10 12:39:55 +01:00
|
|
|
}
|
|
|
|
|
2018-06-17 16:15:58 +02:00
|
|
|
func (tm *TemplateManager) bgPatternCount() uint8 {
|
2018-04-09 23:21:06 +02:00
|
|
|
return uint8(time.Now().UnixNano() % 17)
|
2017-11-10 12:39:55 +01:00
|
|
|
}
|
|
|
|
|
2018-06-17 16:15:58 +02:00
|
|
|
func (tm *TemplateManager) debugMode() bool {
|
|
|
|
return tm.debugModeEnabled
|
2017-11-10 12:39:55 +01:00
|
|
|
}
|
2017-12-17 23:34:49 +01:00
|
|
|
|
2018-06-17 16:15:58 +02:00
|
|
|
func (tm *TemplateManager) apiURL() string {
|
|
|
|
return tm.externalAPIEndpoint
|
2017-12-17 23:34:49 +01:00
|
|
|
}
|