Documentation ¶
Overview ¶
Package scut contains a somewhat ugly but useful collection of frequently appearing patterns to allow faster prototyping. Methods here are mainly related to view- or conroller-like parts.
Index ¶
- func CanonicalHost(host string, opt map[string]interface{}) string
- func Dirify(s string) string
- func GetFile(fs iface.FileSys, filepath string) ([]byte, error)
- func GetNouns(odoc iface.NestedData) map[string]interface{}
- func GetTPath(opt map[string]interface{}, host string) string
- func IsAdmin(user iface.User) bool
- func IsModerator(user iface.User) bool
- func IsRegistered(user iface.User) bool
- func IsStranger(user iface.User) bool
- func Merge(a map[string]interface{}, b map[string]interface{})
- func NotAdmin(user iface.User) bool
- func OnlyAdmin(u iface.User)
- func PossibleModPath(filep string) bool
- func TemplateName(opt map[string]interface{}) string
- func TemplateType(opt map[string]interface{}) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalHost ¶
CanonicalHost(uni.Req.Host, uni.Opt) Gives you back the canonical address of the site so it can be made available from different domains.
func GetFile ¶
TODO: Implement file caching here. Reads the filepath relative filepath from either the current template, or the fallback module tpl folder if filepath has at least one slash in it. file_reader is optional, falls back to simple ioutil.ReadFile if not given. file_reader will be a custom file_reader with caching soon.
func GetNouns ¶
func GetNouns(odoc iface.NestedData) map[string]interface{}
Gets the nouns from the options document. If the opt doc is empty, it returns a default nouns configoration.
func GetTPath ¶
Observes opt and gives you back the path of your template eg "templates/public/template_name" or "templates/private/hostname/template_name"
func IsModerator ¶
func IsRegistered ¶
func IsStranger ¶
func PossibleModPath ¶
Decides if a given relative filepath (filep) is a possible module filepath. This may be deprecated in the future since it seems so restrictive.
func TemplateName ¶
Gives you back the name of the current template in use.
func TemplateType ¶
Gives you back the type of the currently used template (either "private" or public).
Types ¶
This section is empty.