allow for file buttons with 'image' type
This commit is contained in:
parent
9bb6b7bcb9
commit
0564db6ec5
1 changed files with 11 additions and 3 deletions
|
@ -5,6 +5,12 @@ Ox.FileButton <f> File Button
|
|||
([options[, self]]) -> <o:Ox.Element> File Button
|
||||
click <!> click
|
||||
options <o> Options
|
||||
disabled <b|false> If true, the button is disabled
|
||||
maxFiles <n|-1> Maximum number of files, or -1 for unlimited
|
||||
maxSize <n|-1> Maximum total file size in bytes, or -1 for unlimited
|
||||
title <s|''> Title of the button
|
||||
type <s|'text'> Type of the button ('text' or 'image')
|
||||
width <n|256> Width of the button in px
|
||||
self <o> 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 $('<input>')
|
||||
.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
|
||||
|
|
Loading…
Reference in a new issue