Guest User

Untitled

a guest
Nov 18th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. YUI.add('personView',function(Y){
  2. Y.PersonView = Y.Base.create(
  3. 'personView',
  4. Y.View,
  5. [],
  6. {
  7. initializer:function(){
  8. this.model = this.get('model');
  9. },
  10. render:function(){
  11. if (this.template) {
  12. this.get('container').setHTML(this.template(this.model.getAttrs(['name','age','height'])));
  13. } else {
  14. Y.io('/scripts/views/templates/Person.Template.html',{
  15. on:{
  16. complete:function(id,response){
  17. this.template = Y.Handlebars.compile(response.responseText);
  18. this.render();
  19. }
  20. },
  21. context:this
  22. });
  23.  
  24. }
  25. return this;
  26. }
  27. });
  28. }, '0.0.1', {
  29. requires: ['base-build','handlebars', 'io-base','node-base','view', 'personModel']
  30. });
Add Comment
Please, Sign In to add comment