From b89a7ee8b956c96a1dcee995ea840feddc5d4b27 Mon Sep 17 00:00:00 2001 From: Pierre Frisch Date: Thu, 22 Dec 2011 07:25:50 -0800 Subject: First commit of Ninja to ninja-internal Signed-off-by: Valerio Virgillito --- js/components/ui/file-input.reel/file-input.css | 34 +++++++++++++ js/components/ui/file-input.reel/file-input.html | 31 +++++++++++ js/components/ui/file-input.reel/file-input.js | 65 ++++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 js/components/ui/file-input.reel/file-input.css create mode 100644 js/components/ui/file-input.reel/file-input.html create mode 100644 js/components/ui/file-input.reel/file-input.js (limited to 'js/components/ui/file-input.reel') diff --git a/js/components/ui/file-input.reel/file-input.css b/js/components/ui/file-input.reel/file-input.css new file mode 100644 index 00000000..6bc1d13f --- /dev/null +++ b/js/components/ui/file-input.reel/file-input.css @@ -0,0 +1,34 @@ +/* + 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. +
*/ + +.fileInput { + float: left; +} + +.fileInput .file-path { + width: 80% !important; + float: left; +} + +.fileInput .browse-button { + display: block; + width: 20px; + height: 20px; + float: left; + background-color: transparent !important; + border: 0 !important; + text-indent: -9999px; + padding: 0 !important; + background: url(../../../../images/tools/zoom_up.png) transparent no-repeat right !important; + + opacity: 0.7; + margin: 1px 0 0 4px; + cursor: pointer; +} + +.fileInput .browse-button:hover { + opacity: 1; +} diff --git a/js/components/ui/file-input.reel/file-input.html b/js/components/ui/file-input.reel/file-input.html new file mode 100644 index 00000000..5cdd8f9e --- /dev/null +++ b/js/components/ui/file-input.reel/file-input.html @@ -0,0 +1,31 @@ + + + + + + + + + +
+ + +
+ + \ No newline at end of file diff --git a/js/components/ui/file-input.reel/file-input.js b/js/components/ui/file-input.reel/file-input.js new file mode 100644 index 00000000..2ea38162 --- /dev/null +++ b/js/components/ui/file-input.reel/file-input.js @@ -0,0 +1,65 @@ +/* +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; + +var FileInput = exports.FileInput = Montage.create(Component, { + + _filePath: { + enumerable: false, + value: "" + }, + + filePath: { + enumerable: true, + serializable: true, + get: function () { + return this._filePath; + }, + set: function (value) { + if (value !== this._filePath) { + this._filePath = value; + this.needsDraw = true; + } + } + }, + + draw: { + value: function() { + this.filePathField.value = this._filePath; + } + }, + + handleChange: + { + value:function(event) + { + if(event.currentTarget.id === "fileInputControl") + { + this.filePath = this.inputField.value; + } + else + { + this.filePath = this.filePathField.value; + } + + var e = document.createEvent("CustomEvent"); + e.initEvent("change", true, true); + e.type = "change"; + e.filePath = this.filePath; + this.dispatchEvent(e); + } + }, + + prepareForDraw: { + value: function() { + this.inputField.addEventListener("change", this, false); + this.filePathField.addEventListener("change", this, false); + } + } + +}); -- cgit v1.2.3