Skip to content

Commit

Permalink
Allow buttons to have configurable containers
Browse files Browse the repository at this point in the history
Fixes #64
  • Loading branch information
jbalsas authored and ipeychev committed Jan 30, 2015
1 parent 744fcf7 commit 7de72c0
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/ui/yui/src/buttons/button-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,7 @@ YUI.add('button-base', function(Y) {
*/
_renderButtonUI: function() {
var btnInst,
btnSrcNode,
buttonsContainer;

buttonsContainer = this.get('host').get('buttonsContainer');
btnSrcNode;

btnSrcNode = YNode.create(
Lang.sub(this.TPL_BUTTON, {
Expand All @@ -225,7 +222,7 @@ YUI.add('button-base', function(Y) {
on: {
click: Y.bind(this._onClick, this)
},
render: buttonsContainer,
render: this.get('container'),
srcNode: btnSrcNode
});
},
Expand All @@ -234,6 +231,20 @@ YUI.add('button-base', function(Y) {
};

ButtonBase.ATTRS = {
/**
* Container where the button UI should be rendered.
*
* @attribute container
* @default null
* @type Node
*/
container: {
getter: function(value) {
return value || this.get('host').get('buttonsContainer');
},
setter: Y.one
},

/**
* Collection of strings used to label elements of the button's UI.
* ButtonBase provides string properties to specify the label of the button.
Expand Down

0 comments on commit 7de72c0

Please sign in to comment.