FileButton: add image option (so tooltip title becomes configurable if type is 'image')
This commit is contained in:
parent
0564db6ec5
commit
b1019a7c5d
1 changed files with 14 additions and 10 deletions
|
@ -2,16 +2,17 @@
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
Ox.FileButton <f> File Button
|
Ox.FileButton <f> File Button
|
||||||
([options[, self]]) -> <o:Ox.Element> File Button
|
|
||||||
click <!> click
|
|
||||||
options <o> Options
|
options <o> Options
|
||||||
disabled <b|false> If true, the button is disabled
|
disabled <b|false> If true, the button is disabled
|
||||||
maxFiles <n|-1> Maximum number of files, or -1 for unlimited
|
image <s|false> Symbol name (if type is 'image')
|
||||||
maxSize <n|-1> Maximum total file size in bytes, or -1 for unlimited
|
maxFiles <n|-1> Maximum number of files (or -1 for unlimited)
|
||||||
title <s|''> Title of the button
|
maxSize <n|-1> Maximum total file size in bytes (or -1 for unlimited)
|
||||||
|
title <s|''> Title of the button (and its tooltip)
|
||||||
type <s|'text'> Type of the button ('text' or 'image')
|
type <s|'text'> Type of the button ('text' or 'image')
|
||||||
width <n|256> Width of the button in px
|
width <n|256> Width of the button in px
|
||||||
self <o> Shared private variable
|
self <o> Shared private variable
|
||||||
|
([options[, self]]) -> <o:Ox.Element> File Button
|
||||||
|
click <!> click
|
||||||
@*/
|
@*/
|
||||||
Ox.FileButton = function(options, self) {
|
Ox.FileButton = function(options, self) {
|
||||||
|
|
||||||
|
@ -19,6 +20,7 @@ Ox.FileButton = function(options, self) {
|
||||||
var that = Ox.Element({}, self)
|
var that = Ox.Element({}, self)
|
||||||
.defaults({
|
.defaults({
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
image: '',
|
||||||
maxFiles: -1,
|
maxFiles: -1,
|
||||||
maxSize: -1,
|
maxSize: -1,
|
||||||
style: 'default',
|
style: 'default',
|
||||||
|
@ -45,9 +47,13 @@ Ox.FileButton = function(options, self) {
|
||||||
self.$button = Ox.Button({
|
self.$button = Ox.Button({
|
||||||
disabled: self.options.disabled,
|
disabled: self.options.disabled,
|
||||||
style: self.options.style,
|
style: self.options.style,
|
||||||
title: self.options.title,
|
title: self.options.type == 'image'
|
||||||
|
? self.options.image
|
||||||
|
: self.options.title,
|
||||||
type: self.options.type,
|
type: self.options.type,
|
||||||
width: self.options.type == 'image' ? 'auto' : self.options.width
|
width: self.options.type == 'image'
|
||||||
|
? 'auto'
|
||||||
|
: self.options.width
|
||||||
})
|
})
|
||||||
.css({
|
.css({
|
||||||
float: 'left'
|
float: 'left'
|
||||||
|
@ -95,9 +101,7 @@ Ox.FileButton = function(options, self) {
|
||||||
return $('<input>')
|
return $('<input>')
|
||||||
.attr(
|
.attr(
|
||||||
Ox.extend({
|
Ox.extend({
|
||||||
title: self.options.type == 'text' ? self.options.title
|
title: self.options.title,
|
||||||
: self.options.maxFiles == 1 ? 'Select File...'
|
|
||||||
: 'Select Files...',
|
|
||||||
type: 'file'
|
type: 'file'
|
||||||
}, self.multiple ? {
|
}, self.multiple ? {
|
||||||
multiple: true
|
multiple: true
|
||||||
|
|
Loading…
Reference in a new issue