coffeescript-ui
Version:
Coffeescript User Interface System
73 lines (59 loc) • 1.9 kB
JavaScript
// Generated by CoffeeScript 1.10.0
(function() {
var App, HelloWorld, HelloWorldTemplate,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
HelloWorld = (function(superClass) {
extend(HelloWorld, superClass);
function HelloWorld(opts) {
var label;
this.opts = opts != null ? opts : {};
HelloWorld.__super__.constructor.call(this, this.opts);
label = new CUI.Label({
text: "Hello World!",
centered: true
});
this.registerDOMElement(label.DOM);
}
return HelloWorld;
})(CUI.DOMElement);
HelloWorldTemplate = (function(superClass) {
extend(HelloWorldTemplate, superClass);
function HelloWorldTemplate(opts) {
var template;
this.opts = opts != null ? opts : {};
HelloWorldTemplate.__super__.constructor.call(this, this.opts);
template = new CUI.Template({
name: "hello-world",
map: {
title: true
}
});
template.append("Hello world", "title");
this.registerTemplate(template);
}
return HelloWorldTemplate;
})(CUI.DOMElement);
App = (function() {
function App() {
var body;
body = new CUI.VerticalLayout({
top: {
content: new HelloWorldTemplate()
},
center: {
content: new HelloWorld()
}
});
CUI.dom.append(document.body, body);
}
return App;
})();
CUI.ready(function() {
return CUI.Template.loadTemplateFile("hello-world.html").done((function(_this) {
return function() {
return new App();
};
})(this));
});
}).call(this);