merging changes

This commit is contained in:
rlx 2011-10-06 04:32:43 +00:00
commit c615da5c15
3 changed files with 25 additions and 13 deletions

View file

@ -43,10 +43,11 @@ Ox.Button = function(options, self) {
width: 'auto' width: 'auto'
}) })
.options(options || {}) .options(options || {})
.attr({ .attr(Ox.extend({
disabled: self.options.disabled ? 'disabled' : '',
type: self.options.type == 'text' ? 'button' : 'image' type: self.options.type == 'text' ? 'button' : 'image'
}) }, self.options.disabled ? {
disabled: 'disabled'
} : {})
.addClass('OxButton Ox' + Ox.toTitleCase(self.options.size) + .addClass('OxButton Ox' + Ox.toTitleCase(self.options.size) +
(self.options.disabled ? ' OxDisabled': '') + (self.options.disabled ? ' OxDisabled': '') +
(self.options.selected ? ' OxSelected': '') + (self.options.selected ? ' OxSelected': '') +
@ -131,10 +132,12 @@ Ox.Button = function(options, self) {
self.setOption = function(key, value) { self.setOption = function(key, value) {
if (key == 'disabled') { if (key == 'disabled') {
that.attr({ if (value) {
disabled: value ? 'disabled' : '' that.attr({disabled: 'disabled'})
}) } else {
.toggleClass('OxDisabled'); that.removeAttr('disabled');
}
that.toggleClass('OxDisabled');
} else if (key == 'selected') { } else if (key == 'selected') {
if (value != that.hasClass('OxSelected')) { // fixme: neccessary? if (value != that.hasClass('OxSelected')) { // fixme: neccessary?
that.toggleClass('OxSelected'); that.toggleClass('OxSelected');

View file

@ -101,6 +101,12 @@ Ox.Checkbox = function(options, self) {
self.setOption = function(key, value) { self.setOption = function(key, value) {
if (key == 'checked') { if (key == 'checked') {
that.toggleChecked(); that.toggleChecked();
} else if (key == 'disabled') {
if (value) {
that.attr({disabled: 'disabled'})
} else {
that.removeAttr('disabled');
}
} else if (key == 'title') { } else if (key == 'title') {
self.$title.options({title: value}); self.$title.options({title: value});
} }

View file

@ -205,10 +205,11 @@ Ox.Input = function(options, self) {
self.$input = $(self.options.type == 'textarea' ? '<textarea>' : '<input>') self.$input = $(self.options.type == 'textarea' ? '<textarea>' : '<input>')
.addClass('OxInput OxMedium Ox' + Ox.toTitleCase(self.options.style)) .addClass('OxInput OxMedium Ox' + Ox.toTitleCase(self.options.style))
.attr({ .attr(Ox.extend({
disabled: self.options.disabled ? 'disabled' : '',
type: self.options.type == 'password' ? 'password' : 'text' type: self.options.type == 'password' ? 'password' : 'text'
}) }, self.options.disabled ? {
disabled: 'disabled'
} : {})
.css(Ox.extend({ .css(Ox.extend({
width: self.inputWidth + 'px', width: self.inputWidth + 'px',
textAlign: self.options.textAlign textAlign: self.options.textAlign
@ -793,9 +794,11 @@ Ox.Input = function(options, self) {
} }
self.bindKeyboard = self.options.autocomplete || self.options.autovalidate; self.bindKeyboard = self.options.autocomplete || self.options.autovalidate;
} else if (key == 'disabled') { } else if (key == 'disabled') {
self.$input.attr({ if (value) {
disabled: value ? 'disabled' : '' self.$input.attr({disabled: 'disabled'});
}); } else {
self.$input.removeAttr('disabled');
}
} else if (key == 'height') { } else if (key == 'height') {
that.css({ that.css({
height: value + 'px' height: value + 'px'