The client side templates are evolving, and this document describes the set of templates at the time of writing.
Each filled out template is assigned a serialized template id and has a context dictionary
that is stored in the lookup hash $.yote.util.template_context
keyed by its template_id.
The context is copied from the current context ( if any ) that is assigned to the template this template
is embedded in. If this template is embedded directly in the body, a new context is created for it.
This context is also passed in to all functions called from the templates. There are three sorts of functions that can be called from the templates. A function that returns html that is placed in the filled out template, a function that is called after the template is rendered and functions that are attached to links and buttons and are called when those are clicked.
The context dictionary may have the following context fields :
$.yote.util.template_context[ template_id ] = {
vars = { dictionary of variables assigned in the templates. };
newfields = { dictionary mapping field names to ids of controls.
The control ids are for controls specifically created for
the assignment of a particular field for a new item };
controls = { dictionary mapping a name to the id of a control. };
};
It should be stressed again that the context is copied each time a template is filled out. This means a variable created in an enclosing template will still be visible to the the enclosed template with the value it had when created unless it had been explicitly overwritten.
These directives are executed and their values placed in context.
<$$$ var varname value $$$> <$$$ control ctlname <..html control..> $$$> <$$$ new ctlname <..html control..> $$$> <$$$ new_hashkey <..html control..> $$$>