add 'overlap' option to ButtonGroup

This commit is contained in:
rolux 2012-12-09 01:43:33 +01:00
parent 568119cae8
commit 7dac327396

View file

@ -21,6 +21,7 @@ Ox.ButtonGroup = function(options, self) {
buttons: [],
max: 1,
min: 1,
overlap: 'none',
selectable: false,
size: 'medium',
style: 'default',
@ -44,12 +45,18 @@ Ox.ButtonGroup = function(options, self) {
}
}
})
.addClass('OxButtonGroup');
.addClass(
'OxButtonGroup'
+ (self.options.overlap != 'none' ? ' OxOverlap' + Ox.toTitleCase(self.options.overlap) : '')
);
self.options.buttons = self.options.buttons.map(function(button) {
self.options.buttons = self.options.buttons.map(function(button, i) {
return Ox.extend({
disabled: button.disabled,
id: button.id || button,
overlap: self.options.overlap == 'left' && i == 0 ? 'left'
: self.options.overlap == 'right' && i == self.options.buttons.length - 1 ? 'right'
: 'none',
title: button.title || button,
tooltip: button.tooltip,
width: button.width
@ -75,6 +82,7 @@ Ox.ButtonGroup = function(options, self) {
disabled: button.disabled || false, // FIXME: getset should handle undefined
group: true,
id: button.id,
overlap: button.overlap,
selectable: self.options.selectable,
size: self.options.size,
style: self.options.style,