Documentation ¶
Index ¶
Constants ¶
View Source
const (
LOMAKE_TYPE_FIELD = `lomaketype`
)
Variables ¶
View Source
var DecoratorChains = map[DecoratorType][]DecoratorType{ INPUT_TEXT: {INPUT_TEXT, LABEL, DIV}, INPUT_PASSWORD: {INPUT_PASSWORD, LABEL, DIV}, INPUT_HIDDEN: {INPUT_HIDDEN}, TEXTAREA: {TEXTAREA, LABEL, DIV}, }
Order of how decorators are applied
View Source
var DecoratorMap = map[string]DecoratorType{ "input.text": INPUT_TEXT, "input.password": INPUT_PASSWORD, "input.hidden": INPUT_HIDDEN, "textarea": TEXTAREA, }
map string into decorator
View Source
var DecoratorTemplates = map[DecoratorType]string{ DIV: `<div class="form-group{{ if .Item.Required }} required{{ end }}">{{- .Parent -}}</div>`, LABEL: `<label for="{{- .Item.Name -}}">{{ if .Item.Required }}* {{ end }}{{- T .Item.Description -}}</label>{{- .Parent -}}`, TEXTAREA: `{{- .Parent -}}<textarea class="form-control" name="{{- .Item.Name -}}" id="{{- .Item.Name -}}" placeholder="{{- T .Item.Placeholder -}}">{{- .Item.Value -}}</textarea>`, INPUT_PASSWORD: `{{- .Parent -}}<input class="form-control" type="password" name="{{- .Item.Name -}}" id="{{- .Item.Name -}}" value="{{- .Item.Value -}}" placeholder="{{- T .Item.Placeholder -}}" />`, INPUT_TEXT: `{{- .Parent -}}<input class="form-control" type="text" name="{{- .Item.Name -}}" id="{{- .Item.Name -}}" value="{{- .Item.Value -}}" placeholder="{{- T .Item.Placeholder -}}" />`, INPUT_HIDDEN: `{{- .Parent -}}<input type="hidden" name="{{- .Item.Name -}}" id="{{- .Item.Name -}}" value="{{- .Item.Value -}}" />`, }
Base HTML templates .Parent is the parent decorator
View Source
var HTMLTemplate *template.Template
Template for generating HTML
View Source
var Translator *message.Printer
Translate form labels, placeholders, ..
Functions ¶
func NewStructureDescription ¶
func NewStructureDescription() structureDescription
Types ¶
type DecoratorType ¶
type DecoratorType uint64
const ( DIV DecoratorType = iota LABEL TEXTAREA INPUT_PASSWORD INPUT_TEXT INPUT_HIDDEN )
Click to show internal directories.
Click to hide internal directories.