coffeescript-ui
Version:
Coffeescript User Interface System
109 lines (103 loc) • 2.63 kB
JavaScript
// Generated by CoffeeScript 1.10.0
(function() {
var App;
App = (function() {
function App() {
var body, disableButton, menuButton, spinnerButton;
disableButton = new CUI.Button({
text: "Disable button",
onClick: (function(_this) {
return function() {
disableButton.disable();
return CUI.setTimeout({
ms: 1000,
call: function() {
return disableButton.enable();
}
});
};
})(this)
});
spinnerButton = new CUI.Button({
text: "Spinner button",
left: true,
onClick: (function(_this) {
return function() {
spinnerButton.startSpinner();
return CUI.setTimeout({
ms: 1000,
call: function() {
return spinnerButton.stopSpinner();
}
});
};
})(this)
});
menuButton = new CUI.Button({
text: "Menu button",
icon: "fa-bars",
menu: {
items: [
{
text: "# 1"
}, new CUI.Button({
text: "# 2"
}), {
text: "Click me!",
onClick: (function(_this) {
return function() {
return CUI.alert({
text: "I'm a button!"
});
};
})(this)
}, {
text: "Submenu",
menu: {
items: [
{
text: "#4"
}
]
}
}
]
}
});
body = new CUI.HorizontalLayout({
auto_buttonbar: false,
left: {
content: new CUI.Label({
centered: true,
text: "Left !!"
})
},
center: {
content: [
disableButton, spinnerButton, menuButton, new CUI.Button({
text: "Group button #1",
group: "some-group"
}), new CUI.Button({
text: "Group button #2",
group: "some-group"
}), new CUI.Button({
text: "Group button #3",
group: "some-group"
})
]
},
right: {
content: new CUI.Label({
centered: true,
text: "Right"
})
}
});
CUI.dom.append(document.body, body);
}
return App;
})();
CUI.ready(function() {
return new App();
});
}).call(this);