// 1. Inline javascript
var MyAppConfig = {
"dialog": {
"name":"loginPanel",
"header":"Log in",
"close":"true"
"container":"panelBody",
"html":"<h1>xxx</h1><p>zzz</p>"
}
};
var YUI_config = {
filter: 'debug',
groups: {
'myapp': {
modules: {
'project-myapp-core': {
fullpath: 'http://www.myapp.com/scripts/Core.js',
requires: ['node-base']
}
}
},
'alloy': {
gallery: 'gallery-2011.02.09-21-32',
modules: {
'gallery-aui-skin-base': {
fullpath: 'http://yui.yahooapis.com/gallery-2011.02.09-21-32/build/gallery-aui-skin-base/css/gallery-aui-skin-base-min.css',
type: 'css'
},
'gallery-aui-skin-classic': {
fullpath: 'http://yui.yahooapis.com/gallery-2011.02.09-21-32/build/gallery-aui-skin-classic/css/gallery-aui-skin-classic-min.css',
type: 'css',
requires: ['gallery-aui-skin-base']
}
}
}
}
};
YUI(YUI_config).use('node', 'base', 'project-myapp-core', function(Y) {
var MyApp = {};
MyApp.Core = new Y.MyApp.Core();
Y.on('domready', MyApp.Core.begin, Y, null, application);
});
// 2. Core module
YUI.add('project-myapp-core', function(Y) {
function Core(config) {
Core.superclass.constructor.apply(this, arguments);
}
Core.NAME = 'myapp-core';
Core.ATTRS = {
dialog: {
value: false
}
};
var Panel;
Panel = [];
Y.extend(Core, Y.Base, {
initializer: function (cfg) {
var dialogconfig = this.get('dialog');
if (dialogconfig) {
this.openDialog(dialogconfig);
}
},
openDialog: function(config) {
var name = config.name;
if (Panel[name]) {
Panel[name].destroy();
}
Y.use('gallery-aui-dialog', function (Y) {
var Panel[name] = new Y.Dialog({
centered: true,
constrain2view: true,
draggable: false,
resizable: false,
close: true,
destroyOnClose: true,
modal: true,
width: '500px',
zIndex: 6000
}).render();
});
}
});
Y.namespace('MyApp');
Y.MyApp.Core = Core;
}, '0.0.1', { requires: ['node-base'] });