-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_account_select_window.js
56 lines (56 loc) · 1.88 KB
/
new_account_select_window.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
(function() {
var NewAccountSelectWindow;
var __bind = function(func, context) {
return function(){ return func.apply(context, arguments); };
}, __extends = function(child, parent) {
var ctor = function(){};
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.prototype.constructor = child;
if (typeof parent.extended === "function") parent.extended(child);
child.__super__ = parent.prototype;
};
NewAccountSelectWindow = function(controller, callback) {
var _i, _len, _ref, _result, data, item, klass, name;
Ti.API.debug("Creating select window");
NewAccountSelectWindow.__super__.constructor.apply(this, arguments);
this.win = Ti.UI.createWindow({
title: "Add Account",
backgroundColor: "#000000"
});
data = (function() {
_result = []; _ref = Citrus.AccountTypes;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
klass = _ref[_i];
_result.push((function() {
name = klass.prototype.type;
item = Titanium.UI.createDashboardItem({
image: Citrus.getIconPath(name),
type: name,
label: name.replace("Account", "")
});
return item;
})());
}
return _result;
})();
this.dashboard = Titanium.UI.createDashboardView({
data: data
});
this.dashboard.addEventListener('edit', __bind(function(e) {
return this.dashboard.stopEditing();
}, this));
this.dashboard.addEventListener('click', __bind(function(e) {
var type;
if (e.item) {
type = e.item.type;
return callback.call(controller, type);
}
}, this));
this.win.add(this.dashboard);
Ti.API.debug("Done creating select window");
return this;
};
__extends(NewAccountSelectWindow, Citrus.GenericWindow);
Citrus.NewAccountSelectWindow = NewAccountSelectWindow;
}).call(this);