2
0

ui-app-se.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. YUI.add('ui-app-se', function (Y) {
  2. var MODULE = 'module';
  3. Y.namespace('UI.App').Se = Y.Base.create('seAppUI', Y.App, [], {
  4. views: {
  5. // libs: {
  6. // type: Y.UI.Pages.Libs
  7. // },
  8. // lib: {
  9. // type: Y.UI.Pages.Lib,
  10. // parent: 'libs'
  11. // },
  12. // projects: {
  13. // type: Y.UI.Pages.Projects
  14. // },
  15. // project: {
  16. // type: Y.UI.Pages.Project,
  17. // parent: 'projects'
  18. // },
  19. module: {
  20. type: Y.UI.Pages.Module,
  21. // parent: 'project'
  22. },
  23. // runtime: {
  24. // type: Y.UI.Pages.Runtime
  25. // },
  26. // docs: {
  27. // type: Y.UI.Pages.Docs
  28. // }
  29. },
  30. initializer: function () {
  31. var self = this;
  32. self.once('ready', function (event) {
  33. if (self.hasRoute(self.getPath())) {
  34. self.dispatch();
  35. } else {
  36. self.showModule();
  37. }
  38. });
  39. },
  40. // showLibs: function (req, res) {
  41. // this.showView('docs'); // libs;
  42. // },
  43. // showLib: function (req, res) {
  44. // this.showView('docs'); // lib
  45. // },
  46. // showProjects: function (req, res) {
  47. // this.showView('docs'); // projects
  48. // },
  49. // showProject: function (req, res) {
  50. // this.showView('docs'); // project
  51. // },
  52. showModule: function (req, res) {
  53. this.showView('module', { module: this.getModule() });
  54. },
  55. // showRuntime: function (req, res) {
  56. // this.showView('docs'); // runtime
  57. // },
  58. // showDocs: function (req, res) {
  59. // this.showView('docs');
  60. // },
  61. getModule: function () {
  62. return this.get(MODULE);
  63. },
  64. setModule: function (module) {
  65. return this.set(MODULE, module);
  66. }
  67. }, {
  68. ATTRS: {
  69. routes: [
  70. { path: '/', callbacks: 'showModule' },
  71. // { path: '/libs', callbacks: 'showLibs' },
  72. // { path: '/lib', callbacks: 'showLib' },
  73. // { path: '/projects', callbacks: 'showProjects' },
  74. // { path: '/project', callbacks: 'showProject' },
  75. { path: '/module', callbacks: 'showModule' },
  76. // { path: '/runtime', callbacks: 'showRuntime' },
  77. // { path: '/docs', callbacks: 'showDocs' }
  78. ],
  79. module: {
  80. value: new Y.SE.Models.Module,
  81. validator: function (mod) {
  82. return mod instanceof Y.SE.Models.Module;
  83. }
  84. },
  85. user: {
  86. value: null
  87. }
  88. }
  89. });
  90. }, '1.0', {
  91. requires: [
  92. 'app',
  93. // 'ui-page-libs',
  94. // 'ui-page-lib',
  95. // 'ui-page-projects',
  96. // 'ui-page-project',
  97. 'ui-page-module',
  98. // 'ui-page-runtime',
  99. // 'ui-page-docs'
  100. 'se-model-module'
  101. ]
  102. });