awa.tpl Class
Singleton object for underscore templates. Underscore tempalte files end with htm, jtml files end in html. Dont use JTML
both renderModelDisplay and renderModelInput accept an array of attributes that you want rendered.
you can pass a string for the attribute id or an object with atleast the id property specified to match the attribute id.
Anything else you dont provide, the generator will try and pull from the model.
attributes
{
id: //attribute id (i.e. pat_fname)
displayMethod: //takes parameters in this order (value, attribute_id, model). should return a string or element
className: //applied to the attribute field's class attribute (usually a tr or div)
displayClassName: //applied to the attribute display element's class attribute (usually a span or td)
headerClassName: //applied to the attribute header element's class attribute (th or label)
inputClassName:
errorClassName:
}
Item Index
Methods
Properties
Methods
get
-
name
Parameters:
-
nameStringname of template.
Returns:
returns a compiled template.
getTemplate
-
name
Parameters:
-
nameStringname of template.
Returns:
template contents
has
-
name
Parameters:
-
nameStringname of template.
Returns:
true if it exists
render
-
name -
args
Parameters:
-
nameStringname of template.
-
argsObjectname of template.
Returns:
html string
renderButton
-
args
Parameters:
-
argsObjectconfiguration object with various properties
-
[contents]Object optionalhtml contents of the button (icons, text, etc.)
-
[icon]Object optionalhtml contents of the button (icons, text, etc.)
-
[type]Object optionalbutton widget type, decides the color
-
callbackStringdata-events string. either a function name, or an event type followed by a colon and then a function name.
-
Returns:
html string
renderInput
-
args
Parameters:
-
argsObjectconfiguration object with various properties
-
[contents]Object optionalhtml contents of the button (icons, text, etc.)
-
[icon]Object optionalhtml contents of the button (icons, text, etc.)
-
[type]Object optionalbutton widget type, decides the color
-
callbackStringdata-events string. either a function name, or an event type followed by a colon and then a function name.
-
Returns:
html string
renderModelDisplay
-
args
attributes { id: type: not in use yet displayMethod: href: className: displayClassName: headerClassName: }
Parameters:
-
argsObjectconfiguration object with various properties
-
modelModelname of template.
-
[attributes]Array optionalselected attributes in the order to be rendered
-
[tpl]String | Function optionalname of template.
-
Returns:
html string
renderModelInput
-
args
Parameters:
-
argsObjectconfiguration object with various properties
-
modelModelname of template.
-
[title]String optionalselected attributes in the order to be rendered
-
[attributes]Array optionalselected attributes in the order to be rendered
-
[tpl]String | Function optionalname of template.
-
Returns:
html string
renderModelInputBlock
-
config
Parent views should check this before changing/swapping a view. Useful for views that are in edit mode that you want to do confirmation before leaving.
Parameters:
-
configObjectconfiguration object with various properties
-
[model]Object optionalSource Model
-
attributesObjectArray of strings or objects. An object and provide extra features as needed but requires 'attribute' property to outline which it is.
-
Returns:
Literal lies
renderSelect
-
args
Parameters:
-
argsObjectconfiguration object with various properties
-
collectionArray | awa.mvc.CollectionSource collection
-
collectionIDString | Functionselected attributes in the order to be rendered
-
collectionValueString | Functionname of template.
-
[defaultID]String optionalDefault id, usually a blank space
-
[defaultValue]String optionalDelect display, "Select {blah}..."
-
[selectedID]String optionalValue to start the select on
-
Returns:
html string
Properties
templates
Unknown
holds the uncompiled version of the templates
templatesCompiled
Unknown
holds the compiled version of the templates