diff options
author | Pushkar Joshi | 2012-06-13 10:56:14 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-06-13 10:56:14 -0700 |
commit | 03f48f8bdd18462a111032ea54fd21dabe9568b2 (patch) | |
tree | 1087824ad17fcffae4f566551b71b78dd51d9a61 /js/components/prompt.reel/prompt.js | |
parent | 250d84a79d9f72c6a98cbbecfe4e21f2c0d53a19 (diff) | |
parent | 5a7774f6769a7a682e21bafe0e57007668f16153 (diff) | |
download | ninja-03f48f8bdd18462a111032ea54fd21dabe9568b2.tar.gz |
Merge branch 'master' into brushtool
Diffstat (limited to 'js/components/prompt.reel/prompt.js')
-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 | ||