Documentation ¶
Index ¶
- func Add(a, b int) int
- func CSS(s string) template.CSS
- func Checked(checked interface{}) template.HTMLAttr
- func Disabled(obj interface{}) template.HTMLAttr
- func EncodeKey(data interface{}) string
- func EncodeParentKey(key *datastore.Key) string
- func Hide(display bool) template.CSS
- func KeyEqual(a, b *datastore.Key) bool
- func Markdown(input string) interface{}
- func Preview(size int, val string) string
- func Selected(selected bool) template.HTMLAttr
- func Show(display bool) template.CSS
- func Timestamp(d time.Time) string
- func ToErrorList(in interface{}) template.HTML
- type Errors
- type Page
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Checked ¶
Checked returns the checked attribute for positive values.
<input type="checkbox" {{IsAdmin | checked}}> => <input type="checkbox" checked="checked">
func Disabled ¶
Disabled returns the checked attribute for positive values.
<button type="submit" {{HasError | disabled}}>Save</button> => <button type="submit" disabled="">Save</button> or <button type="submit" {{ValidationError | disabled}}>Save</button> => <button type="submit" disabled="">Save</button>
func EncodeParentKey ¶
EncodeParentKey encodes the key's parent
func Markdown ¶
func Markdown(input string) interface{}
Markdown converts text in the markdown syntax to html
func Show ¶
Show returns an empty style attr or display:none
<div {{IsVisibe | show}}> => <div style="display:none">some hidden text</div>
func ToErrorList ¶
ToErrorList can be added to the template FuncMap to format the error output.
// handler myTemplate.executeTemplate(w, "layout", template.FuncMap{ "error": ToErrorList, }) <!-- HTML --> <form ...> {{ .Error | error }} </form>
Types ¶
type Errors ¶
type Errors struct {
// contains filtered or unexported fields
}
Errors allows multiple errors to be contained within a single error, which simplifies returning validation errors to the client.
type Page ¶
type Page map[string]interface{}
Page is the container for data passed to the html form
func NewPageWithCSRFToken ¶
NewPageWithCSRFToken create a page with an initialized CSRF token
Click to show internal directories.
Click to hide internal directories.