diff --git a/source/Ox.UI/js/Panel/CollapsePanel.js b/source/Ox.UI/js/Panel/CollapsePanel.js index 36569aba..73937d64 100644 --- a/source/Ox.UI/js/Panel/CollapsePanel.js +++ b/source/Ox.UI/js/Panel/CollapsePanel.js @@ -44,6 +44,17 @@ Ox.CollapsePanel = function(options, self) { } }); + var index = Ox.indexOf(self.options.extras, Ox.isEmpty); + self.extras = index > -1 + ? [ + self.options.extras.slice(0, index), + self.options.extras.slice(index + 1) + ] + : [ + [], + self.options.extras + ]; + self.$titlebar = Ox.Bar({ orientation: 'horizontal', size: self.options.size @@ -71,18 +82,30 @@ Ox.CollapsePanel = function(options, self) { }) .appendTo(self.$titlebar); + self.$extras = []; + + if (self.extras[0].length) { + self.$extras[0] = Ox.Element() + .addClass('OxExtras') + .css({width: self.extras[0].length * 16 + 2 + 'px'}) + .appendTo(self.$titlebar); + self.extras[0].forEach(function($extra) { + $extra.appendTo(self.$extras[0]); + }); + } + self.$title = Ox.Element() .addClass('OxTitle') .html(self.options.title) .appendTo(self.$titlebar); - if (self.options.extras.length) { - self.$extras = Ox.Element() + if (self.extras[1].length) { + self.$extras[1] = Ox.Element() .addClass('OxExtras') - .css({width: self.options.extras.length * 16 + 'px'}) + .css({width: self.extras[1].length * 16 + 'px'}) .appendTo(self.$titlebar); - self.options.extras.forEach(function($extra) { - $extra.appendTo(self.$extras); + self.extras[1].forEach(function($extra) { + $extra.appendTo(self.$extras[1]); }); }