Guest User

Untitled

a guest
Jun 19th, 2018
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. JqueryMobile.MPage = SC.View.extend({
  2.  
  3. // render a div with data-role-attribute = page
  4. render: function(context, firstTime) {
  5. context.begin('div');
  6. context.attr('data-role', 'page');
  7.  
  8. // call renderers of childViews
  9. if(firstTime) {
  10. this.renderChildViews(context, firstTime);
  11. }
  12. },
  13.  
  14. // if the view did append to the DOM, call jQuery mobile to do the styling
  15. didAppendToDocument: function() {
  16. $("#" + this.get('layerId')).page();
  17. $("#" + this.get('layerId')).show();
  18. }
  19. });
  20.  
  21. JqueryMobile.MHeader = SC.View.extend({
  22. // render a div with data-role-attribute = header
  23. render: function(context, firstTime) {
  24. context.begin('div');
  25. context.attr('data-role', 'header');
  26. context.push('Page Title');
  27. }
  28. });
  29.  
  30. JqueryMobile.MContent = SC.View.extend({
  31. // render a div with data-role-attribute = content
  32. render: function(context, firstTime) {
  33. context.begin('div');
  34. context.attr('data-role', 'content');
  35. context.push('Page content goes here.');
  36. }
  37. });
  38.  
  39. JqueryMobile.MFooter = SC.View.extend({
  40. // render a div with data-role-attribute = footer
  41. render: function(context, firstTime) {
  42. context.begin('div');
  43. context.attr('data-role', 'footer');
  44. context.push('Page Footer');
  45. }
  46. });
  47.  
  48.  
  49. // MAIN PAGE
  50. JqueryMobile.mainPage = SC.Page.design({
  51.  
  52. mainPane: SC.MainPane.design({
  53. childViews: 'foo'.w(),
  54.  
  55. // show one jQuery mobile page with header, content and footer
  56. foo: JqueryMobile.MPage.design({
  57. childViews: 'header content footer'.w(),
  58. pageName: 'foo',
  59.  
  60. header: JqueryMobile.MHeader.design({
  61.  
  62. }),
  63.  
  64. content: JqueryMobile.MContent.design({
  65.  
  66. }),
  67.  
  68. footer: JqueryMobile.MFooter.design({
  69.  
  70. })
  71. })
  72. })
  73.  
  74. });
Add Comment
Please, Sign In to add comment