@titanium/turbo
Version:
<p align="center"> <img src="https://cdn.secure-api.org/images/turbo-title_400.png" /><br> <a href="https://www.npmjs.com/package/@titanium/turbo"> <img src="https://img.shields.io/npm/v/@titanium/turbo.png" /> </a> </p>
29 lines (24 loc) • 529 B
JavaScript
var colors = ['blue', 'red', 'orange'];
var selectedColor = 'blue';
function closeKeyboard(e) {
e.source.blur();
}
function setColor(e) {
selectedColor = e.source.id;
_.each(colors, function(color) {
$[color].borderWidth = e.source.id === color ? 4 : 0;
});
}
function addUser() {
var users = Alloy.Collections.user;
var model = Alloy.createModel('user', {
name: $.name.value || '<no name>',
color: selectedColor
});
users.add(model);
model.save();
closeWindow();
}
function closeWindow() {
$.add.close();
}