-
Notifications
You must be signed in to change notification settings - Fork 2
Modules
hadrienl edited this page Apr 23, 2013
·
3 revisions
Insert a template content from the file "templatename.tpl.html" placed in same module folder
Example:
/**
* File located in views/myview/myview.view.js
* @module myapp/views/myview
*/
MyView = Y.Base.create('MyView', Y.ys.View, [], {
}, {
ATTRS: {
template: {
value: {$myview.tpl}
}
}
});
With a template file located in views/myview/templates/myview.tpl.html:
Hello World!
Will generate :
/**
* File located in views/myview/myview.view.js
* @module myapp/views/myview
*/
MyView = Y.Base.create('MyView', Y.ys.View, [], {
}, {
ATTRS: {
template: {
value: '<p>'+
' Hello World!'+
'</p>'
}
}
});
generate a classname from the module name and the given parameter. If this tag is used in myapp/views/myview
module, the classname will be 'myapp-views-myview-foobar'
.
Example:
/**
* @module myapp/views/myview
*/
var NS = 'myapp',
CLASS_TITLE = {$classname:'title'},
CLASS_SNIPPET = {$classname:'snippet'};
Will generate :
/**
* @module myapp/views/myview
*/
var NS = 'myapp',
CLASS_TITLE = 'myapp-views-myview-title',
CLASS_SNIPPET = 'myapp-views-myview-snippet';
And will be used to retrieve nodes in your view's container.