aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-01-31 15:59:46 -0800
committerJose Antonio Marquez2012-01-31 15:59:46 -0800
commite75223a2c4c1e13d66639841e6418e94fe9b726f (patch)
treea37a20b56ef597d8a83cdb71b0dbb2f3cc7f5842
parent6dc03672707a91085954359d82c14bd876f85b12 (diff)
downloadninja-e75223a2c4c1e13d66639841e6418e94fe9b726f.tar.gz
Cloud IO Prompt
Setting up UI for the file IO prompt on initialization of Ninja and whenever a cloud IO call is made and the server is not detected.
-rw-r--r--.gitignore3
-rwxr-xr-xjs/components/popup-manager.reel/popup-manager.js3
-rwxr-xr-xjs/io/system/coreioapi.js84
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.html54
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.js55
-rwxr-xr-xjs/io/ui/cloudpopup.reel/config.rb9
-rw-r--r--js/io/ui/cloudpopup.reel/css/cloudpopup.css118
-rwxr-xr-xjs/io/ui/cloudpopup.reel/css/cloudpopup.scss122
-rwxr-xr-xjs/ninja.reel/ninja.js4
9 files changed, 439 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index fd016bd0..6c288e8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,4 +22,5 @@ cloud/
22 22
23/.idea/scopes/scope_settings.xml 23/.idea/scopes/scope_settings.xml
24_scss/imports/scss/_Stage.scss 24_scss/imports/scss/_Stage.scss
25compass_app_log.txt \ No newline at end of file 25compass_app_log.txt
26js/io/ui/cloudpopup.reel/.sass-cache/5fd824121af95f6044b06681535cf0639ffb5db3/cloudpopup.scssc \ No newline at end of file
diff --git a/js/components/popup-manager.reel/popup-manager.js b/js/components/popup-manager.reel/popup-manager.js
index be3c1e8d..bc755f74 100755
--- a/js/components/popup-manager.reel/popup-manager.js
+++ b/js/components/popup-manager.reel/popup-manager.js
@@ -32,7 +32,8 @@ exports.PopupMananger = Montage.create(Component, {
32 addPopup: { 32 addPopup: {
33 enumerable: true, 33 enumerable: true,
34 value: function (popup, depth, blackout) { 34 value: function (popup, depth, blackout) {
35 // 35 //Fix to ensure always highest
36 this.element.style.zIndex = this._getNextHighestZindex(document.body); // Highest z-index in body
36 //TODO: Add blackout background 37 //TODO: Add blackout background
37 //Checking for manual or setting auto to next highest depth 38 //Checking for manual or setting auto to next highest depth
38 if (depth) { 39 if (depth) {
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index 33c7bc28..4407d59a 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -10,7 +10,9 @@ NOTES:
10//////////////////////////////////////////////////////////////////////// 10////////////////////////////////////////////////////////////////////////
11///////////////////////////////////////////////////////////////////// */ 11///////////////////////////////////////////////////////////////////// */
12var Montage = require("montage/core/core").Montage, 12var Montage = require("montage/core/core").Montage,
13 Component = require("montage/ui/component").Component; 13 Component = require("montage/ui/component").Component,
14 Popup = require("js/components/popup.reel").Popup,
15 CloudPopup = require("js/io/ui/cloudpopup.reel").CloudPopup;
14//////////////////////////////////////////////////////////////////////// 16////////////////////////////////////////////////////////////////////////
15//Exporting as Project I/O 17//Exporting as Project I/O
16exports.CoreIoApi = Montage.create(Component, { 18exports.CoreIoApi = Montage.create(Component, {
@@ -26,16 +28,11 @@ exports.CoreIoApi = Montage.create(Component, {
26 //Checks for IO API to be active 28 //Checks for IO API to be active
27 this.ioServiceDetected = this.cloudAvailable(); 29 this.ioServiceDetected = this.cloudAvailable();
28 // 30 //
29 console.log('FileIO: localStorage URL detected | IO Service Detected: '+ this.ioServiceDetected); 31 console.log('Cloud Status: URL detected in localStorage as '+this.rootUrl);
30 //
31 } else { 32 } else {
32 //TODO: Remove, automatically prompt user on welcome
33 this.rootUrl = 'http://localhost:16380';
34 //TODO: Changed to false, welcome screen prompts user
35 this.ioServiceDetected = this.cloudAvailable();
36 //
37 console.log('FileIO: localStorage URL NOT detected | IO Service Detected: '+ this.ioServiceDetected);
38 // 33 //
34 this.ioServiceDetected = false;
35 console.log('Cloud Status: No URL detected in localStorage');
39 } 36 }
40 } 37 }
41 }, 38 },
@@ -45,18 +42,83 @@ exports.CoreIoApi = Montage.create(Component, {
45 enumerable: false, 42 enumerable: false,
46 value: function () { 43 value: function () {
47 // 44 //
48 if (this.getCloudStatus().status === 200) { 45 if (this.rootUrl && this.getCloudStatus().status === 200) {
49 //Active 46 //Active
50 return true; 47 return true;
51 } else { 48 } else {
52 //Inactive 49 //Inactive
53 //TODO: Logic to prompt the user for cloud, otherwise return false 50 if (!this._cloudDialogOpen || this.application.ninja) {
51 this.showCloudDialog();
52 }
54 return false; 53 return false;
55 } 54 }
56 } 55 }
57 }, 56 },
58 //////////////////////////////////////////////////////////////////// 57 ////////////////////////////////////////////////////////////////////
59 // 58 //
59 _cloudDialogOpen: {
60 enumerable: false,
61 value: false
62 },
63 ////////////////////////////////////////////////////////////////////
64 //
65 _cloudDialogComponents: {
66 enumerable: false,
67 value: {blackout: null, popup: null, dialog: null}
68 },
69 ////////////////////////////////////////////////////////////////////
70 //
71 showCloudDialog: {
72 enumerable: false,
73 value: function () {
74 //
75 this._cloudDialogComponents.blackout = document.createElement('div');
76 this._cloudDialogComponents.blackout.style.width = '100%';
77 this._cloudDialogComponents.blackout.style.height = '100%';
78 this._cloudDialogComponents.blackout.style.background = 'rgba(0, 0, 0, .6)';
79 this.application.ninja.popupManager.addPopup(this._cloudDialogComponents.blackout);
80 //
81 ////////////////////////////////////////////////////
82 //Creating popup from m-js component
83 var popup = document.createElement('div');
84 //
85 this._cloudDialogComponents.dialog = CloudPopup.create();
86 //
87 document.body.appendChild(popup);
88 //
89 this._cloudDialogComponents.dialog.element = popup;
90 this._cloudDialogComponents.dialog.needsDraw = true;
91 this._cloudDialogComponents.dialog.element.style.opacity = 0;
92 //
93 this._cloudDialogComponents.dialog.addEventListener('firstDraw', this, false);
94 }
95 },
96
97 handleFirstDraw: {
98 value: function (e) {
99 if (e._target._element.className === 'cloud_popup') {
100 this._cloudDialogComponents.dialog.removeEventListener('firstDraw', this, false);
101 //
102 this._cloudDialogComponents.popup = this.application.ninja.popupManager.createPopup(this._cloudDialogComponents.dialog.element, {x: '200px', y: '200px'});
103 this._cloudDialogComponents.popup.addEventListener('firstDraw', this, false);
104 } else {
105 //
106 this._cloudDialogComponents.dialog.element.style.opacity = 1;
107 this._cloudDialogComponents.popup.element.style.opacity = 1;
108 }
109 }
110 },
111
112
113 ////////////////////////////////////////////////////////////////////
114 //
115 hideCloudDialog: {
116 enumerable: false,
117 value: function () {
118 }
119 },
120 ////////////////////////////////////////////////////////////////////
121 //
60 _ioServiceDetected: { 122 _ioServiceDetected: {
61 enumerable: false, 123 enumerable: false,
62 value: false 124 value: false
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.html b/js/io/ui/cloudpopup.reel/cloudpopup.html
new file mode 100755
index 00000000..8e45f926
--- /dev/null
+++ b/js/io/ui/cloudpopup.reel/cloudpopup.html
@@ -0,0 +1,54 @@
1<!DOCTYPE html>
2
3<!-- <copyright>
4 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
5 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
6 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
7 </copyright> -->
8
9<html lang="en">
10 <head>
11
12 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
13
14 <link rel="stylesheet" type="text/css" href="css/cloudpopup.css">
15
16 <script type="text/montage-serialization">
17 {
18 "owner": {
19 "module": "js/io/ui/cloudpopup.reel",
20 "name": "cloudpopup",
21 "properties": {
22 "element": {"#": "cloud_popup"}
23 }
24 }
25 }
26 </script>
27
28 </head>
29
30 <body>
31
32 <div id="cloud_popup" class="cloud_popup">
33 <div class="content">
34
35 <h3>Cloud Service Dialog</h3>
36
37 <p>Duis aliquet egestas purus in blandit. Curabitur vulputate, ligula lacinia scelerisque tempor, lacus lacus ornare ante, ac egestas.</p>
38
39 <label for="cloud_url">Cloud Server URL:</label><input type="text" id="cloud_url" value="http://localhost:16380" />
40
41 <button class="test">Test</button>
42
43 <label>Status:</label><div class="status">Disconnected</div>
44
45 <button class="handle_cancel">Cancel</button>
46
47 <button class="handle_ok">Ok</button>
48
49 </div>
50 </div>
51
52 </body>
53
54</html> \ No newline at end of file
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.js b/js/io/ui/cloudpopup.reel/cloudpopup.js
new file mode 100755
index 00000000..3e104bb7
--- /dev/null
+++ b/js/io/ui/cloudpopup.reel/cloudpopup.js
@@ -0,0 +1,55 @@
1/* <copyright>
2