Documentation ¶
Index ¶
Constants ¶
View Source
const ( OVERRIDE_HANDLER int = iota // tag field 0 is for custom handlers OVERRIDE_LABEL // tag field 1 is for overriding the field label (name) OVERRIDE_PLACEHOLDER // tag field 2 is for overriding the placeholder (text to display when the field is empty) PARAM_1 // tag field 3 is for passing a configuration parameter to the handler PARAM_2 // tag field 4 is for passing a configuration parameter to the handler PARAM_3 // tag field 5 is for passing a configuration parameter to the handler )
Variables ¶
View Source
var J = jquery.NewJQuery
Convenience handle to jQuery
Functions ¶
func Root ¶
func Root(d *Dispatcher, container string, obj interface{}, cb Callback)
Root is the entry function of jogs. It creates the root node and calls the dispatcher, effectively starting the process of building the editor for our data
TODO: maybe this is superfluous. Could clients create the root node and call the dispatcher themselves?
Types ¶
type ConstSelector ¶
type ConstSelector struct {
// contains filtered or unexported fields
}
usage:
type Example struct { Fubr string `jogs:"CONST,Fuber,select fuber...,FOO BAR QUX FOX"` }
func (*ConstSelector) Handle ¶
func (h *ConstSelector) Handle(node Node, cb Callback)
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher decouples handles from handlers. This makes jogs a very flexible and extensible tool.
var DefaultDispatcher *Dispatcher
func (*Dispatcher) Register ¶
func (d *Dispatcher) Register(handle string, plugin Handler)
type HandlerFunc ¶
HandlerFunc is a wrapper that makes any function with signature func(Node, Callback) implement jogs' handler interface
func (HandlerFunc) Handle ¶
func (f HandlerFunc) Handle(node Node, cb Callback)
type Node ¶
type Node struct { Object interface{} // the actual data object that we want to edit ContainerId string // the id of the dom node in which we want this editor placed, a.k.a. parent EditorId string // the id of the dom node of this editor Handle string // a key to the handler that will build this node's editor Label string // the name of this editor, also the form field name Placeholder string // text to display when the field is empty Idx int // the index of the node in the struct field list or slice Tags []string // (optional) arguments for the handler, filled by parsing a struct tag called 'jogs' with comma separated strings (see OVERRIDE_ and PARAM_constants) }
Node is a structure containing all necessary info for building an editor node.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.