From 19c77d87df72a85345e527d790878fc65eca189a Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Mon, 11 Jun 2012 15:44:15 -0700 Subject: Adding temp prompt UI component Added a temp prompt component and added on before close logic to ensure user does not lose data if the file needs saving when they close. --- js/components/prompt.reel/prompt.js | 73 +++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 js/components/prompt.reel/prompt.js (limited to 'js/components') 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 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +//////////////////////////////////////////////////////////////////////// +// +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; +//////////////////////////////////////////////////////////////////////// +// +exports.NinjaPrompt = Montage.create(Component, { + //////////////////////////////////////////////////////////////////// + //TODO: This should have an UI template eventually + hasTemplate: { + value: false + }, + //////////////////////////////////////////////////////////////////// + //Type of prompt window (should be confirm, prompt, alert, or input) + _type: { + value: null + }, + //////////////////////////////////////////////////////////////////// + // + _params: { + value: null + }, + //////////////////////////////////////////////////////////////////// + // + _callback: { + value: null + }, + //////////////////////////////////////////////////////////////////// + // + initialize: { + value: function (type, params, callback) { + // + this._type = type.toLowerCase(); + this._params = params; + this._callback = callback; + } + }, + //////////////////////////////////////////////////////////////////// + // + show: { + value: function () { + // + var input; + // + switch (this._type) { + case 'confirm': + input = confirm(this._params.message); + if (this._callback) this._callback(input); + break; + default: + //TODO: Add support for other standard box types + break; + } + } + }, + //////////////////////////////////////////////////////////////////// + //This is for later, need to hide if need (overwrite) + hide: { + value: function () { + //TODO: Add support as real UI component + } + } + //////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// +}); +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// \ No newline at end of file -- cgit v1.2.3