From 0564db6ec55a101fa1b9b326655dc821a5ee15bf Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 27 Jun 2012 10:37:12 +0200 Subject: [PATCH] allow for file buttons with 'image' type --- source/Ox.UI/js/Form/FileButton.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/Ox.UI/js/Form/FileButton.js b/source/Ox.UI/js/Form/FileButton.js index 0a1815df..be95e4d3 100644 --- a/source/Ox.UI/js/Form/FileButton.js +++ b/source/Ox.UI/js/Form/FileButton.js @@ -5,6 +5,12 @@ Ox.FileButton File Button ([options[, self]]) -> File Button click click options Options + disabled If true, the button is disabled + maxFiles Maximum number of files, or -1 for unlimited + maxSize Maximum total file size in bytes, or -1 for unlimited + title Title of the button + type Type of the button ('text' or 'image') + width Width of the button in px self Shared private variable @*/ Ox.FileButton = function(options, self) { @@ -18,7 +24,7 @@ Ox.FileButton = function(options, self) { style: 'default', title: '', type: 'text', - width: 256 + width: options.type == 'image' ? 16 : 256 }) .options(options || {}) .update({ @@ -41,7 +47,7 @@ Ox.FileButton = function(options, self) { style: self.options.style, title: self.options.title, type: self.options.type, - width: self.options.width + width: self.options.type == 'image' ? 'auto' : self.options.width }) .css({ float: 'left' @@ -89,7 +95,9 @@ Ox.FileButton = function(options, self) { return $('') .attr( Ox.extend({ - title: self.options.title, + title: self.options.type == 'text' ? self.options.title + : self.options.maxFiles == 1 ? 'Select File...' + : 'Select Files...', type: 'file' }, self.multiple ? { multiple: true