aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui/cloudpopup.reel/cloudpopup.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-01-31 22:44:15 -0800
committerJose Antonio Marquez2012-01-31 22:44:15 -0800
commitd2ff7026abd7e40b49917491773cba9367221f99 (patch)
tree22ab4103ebe645dbd3d38937860c137bf1c18801 /js/io/ui/cloudpopup.reel/cloudpopup.js
parent67097a84b13199a6e7ee3185f1c5521208f1732f (diff)
downloadninja-d2ff7026abd7e40b49917491773cba9367221f99.tar.gz
Hooking cloud popup UI to core
Set up the popup UI for cloud to core API to detected cloud API connection.
Diffstat (limited to 'js/io/ui/cloudpopup.reel/cloudpopup.js')
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.js b/js/io/ui/cloudpopup.reel/cloudpopup.js
index 3e104bb7..f81dc93c 100755
--- a/js/io/ui/cloudpopup.reel/cloudpopup.js
+++ b/js/io/ui/cloudpopup.reel/cloudpopup.js
@@ -18,10 +18,21 @@ exports.CloudPopup = Montage.create(Component, {
18 }, 18 },
19 //////////////////////////////////////////////////////////////////// 19 ////////////////////////////////////////////////////////////////////
20 // 20 //
21 components: {
22 enumerable: false,
23 value: {test_btn: null, ok_btn: null, cancel_btn: null, status: null, url: null}
24 },
25 ////////////////////////////////////////////////////////////////////
26 //
21 prepareForDraw: { 27 prepareForDraw: {
22 enumerable: false, 28 enumerable: false,
23 value: function () { 29 value: function () {
24 // 30 //
31 this.components.test_btn = this.element.getElementsByClassName('btn_test')[0];
32 this.components.ok_btn = this.element.getElementsByClassName('btn_ok')[0];
33 this.components.cancel_btn = this.element.getElementsByClassName('btn_cancel')[0];
34 this.components.status = this.element.getElementsByClassName('status')[0];
35 this.components.url = this.element.getElementsByClassName('cloud_url')[0];
25 } 36 }
26 }, 37 },
27 //////////////////////////////////////////////////////////////////// 38 ////////////////////////////////////////////////////////////////////
@@ -30,6 +41,7 @@ exports.CloudPopup = Montage.create(Component, {
30 enumerable: false, 41 enumerable: false,
31 value: function() { 42 value: function() {
32 // 43 //
44
33 } 45 }
34 }, 46 },
35 //////////////////////////////////////////////////////////////////// 47 ////////////////////////////////////////////////////////////////////
@@ -38,6 +50,7 @@ exports.CloudPopup = Montage.create(Component, {
38 enumerable: false, 50 enumerable: false,
39 value: function() { 51 value: function() {
40 // 52 //
53 this.testConnection();
41 } 54 }
42 }, 55 },
43 //////////////////////////////////////////////////////////////////// 56 ////////////////////////////////////////////////////////////////////
@@ -46,6 +59,36 @@ exports.CloudPopup = Montage.create(Component, {
46 enumerable: false, 59 enumerable: false,
47 value: function() { 60 value: function() {
48 // 61 //
62 this.components.test_btn.addEventListener('click', this.testConnection.bind(this), false);
63 //
64 this.components.ok_btn.addEventListener('click', this.closeDialog.bind(this), false);
65 this.components.cancel_btn.addEventListener('click', this.closeDialog.bind(this), false);
66 }
67 },
68 ////////////////////////////////////////////////////////////////////
69 //this.application.ninja.coreIoApi.hideCloudDialog
70 testConnection: {
71 enumerable: false,
72 value: function() {
73 //
74 this.application.ninja.coreIoApi.rootUrl = this.components.url.value;
75 //
76 if (this.application.ninja.coreIoApi.cloudAvailable()) {
77 this.components.status.style.color = '#77FF00';
78 this.components.status.innerHTML = 'Connected';
79 } else {
80 this.components.status.style.color = '#FF3A3A';
81 this.components.status.innerHTML = 'Disconnected';
82 }
83 }
84 },
85 ////////////////////////////////////////////////////////////////////
86 //
87 closeDialog: {
88 enumerable: false,
89 value: function() {
90 //
91 this.application.ninja.coreIoApi.hideCloudDialog();
49 } 92 }
50 } 93 }
51 //////////////////////////////////////////////////////////////////// 94 ////////////////////////////////////////////////////////////////////