diff options
author | Nivesh Rajbhandari | 2012-06-13 10:03:53 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-06-13 10:03:53 -0700 |
commit | 1cfbfc91815b04dc2a5b090c5e05e300b9371eb7 (patch) | |
tree | 4cf6749de9fea6b90370e6f593146ae4a8690384 /js/components | |
parent | 509092ff335f74517a413cfb2deeb9d2de20f8e3 (diff) | |
parent | 5a7774f6769a7a682e21bafe0e57007668f16153 (diff) | |
download | ninja-1cfbfc91815b04dc2a5b090c5e05e300b9371eb7.tar.gz |
Merge branch 'refs/heads/ninja-internal' into PI_HotTextFixes
Diffstat (limited to 'js/components')
-rw-r--r-- | js/components/prompt.reel/prompt.js | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/js/components/prompt.reel/prompt.js b/js/components/prompt.reel/prompt.js new file mode 100644 index 00000000..652d7b7e --- /dev/null +++ b/js/components/prompt.reel/prompt.js | |||
@@ -0,0 +1,73 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | //////////////////////////////////////////////////////////////////////// | ||
8 | // | ||
9 | var Montage = require("montage/core/core").Montage, | ||
10 | Component = require("montage/ui/component").Component; | ||
11 | //////////////////////////////////////////////////////////////////////// | ||
12 | // | ||
13 | exports.NinjaPrompt = Montage.create(Component, { | ||
14 | //////////////////////////////////////////////////////////////////// | ||
15 | //TODO: This should have an UI template eventually | ||
16 | hasTemplate: { | ||
17 | value: false | ||
18 | }, | ||
19 | //////////////////////////////////////////////////////////////////// | ||
20 | //Type of prompt window (should be confirm, prompt, alert, or input) | ||
21 | _type: { | ||
22 | value: null | ||
23 | }, | ||
24 | //////////////////////////////////////////////////////////////////// | ||
25 | // | ||
26 | _params: { | ||
27 | value: null | ||
28 | }, | ||
29 | //////////////////////////////////////////////////////////////////// | ||
30 | // | ||
31 | _callback: { | ||
32 | value: null | ||
33 | }, | ||
34 | //////////////////////////////////////////////////////////////////// | ||
35 | // | ||
36 | initialize: { | ||
37 | value: function (type, params, callback) { | ||
38 | // | ||
39 | this._type = type.toLowerCase(); | ||
40 | this._params = params; | ||
41 | this._callback = callback; | ||
42 | } | ||
43 | }, | ||
44 | //////////////////////////////////////////////////////////////////// | ||
45 | // | ||
46 | show: { | ||
47 | value: function () { | ||
48 | // | ||
49 | var input; | ||
50 | // | ||
51 | switch (this._type) { | ||
52 | case 'confirm': | ||
53 | input = confirm(this._params.message); | ||
54 | if (this._callback) this._callback(input); | ||
55 | break; | ||
56 | default: | ||
57 | //TODO: Add support for other standard box types | ||
58 | break; | ||
59 | } | ||
60 | } | ||
61 | }, | ||
62 | //////////////////////////////////////////////////////////////////// | ||
63 | //This is for later, need to hide if need (overwrite) | ||
64 | hide: { | ||
65 | value: function () { | ||
66 | //TODO: Add support as real UI component | ||
67 | } | ||
68 | } | ||
69 | //////////////////////////////////////////////////////////////////// | ||
70 | //////////////////////////////////////////////////////////////////// | ||
71 | }); | ||
72 | //////////////////////////////////////////////////////////////////////// | ||
73 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file | ||