Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #601: Unexpected Y.WidgetStdMod + Y.WidgetButtons behavior #602

Open
wants to merge 7 commits into
base: dev-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/widget-buttons/widget-buttons-coverage.js

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion build/widget-buttons/widget-buttons-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,17 @@ WidgetButtons.prototype = {

// Search for an existing buttons container within the section.
containerSelector = '.' + sectionClassName + ' .' + buttonsClassName;
container = contentBox.one(containerSelector);

// Search only inside the current widget
contentBox.all(containerSelector).some(function(node){
var widget = Y.Widget.getByNode(node),
isBelongs = !widget || widget === this;

if (isBelongs) {
container = node;
}
return isBelongs;
}, this);

// Create the `container` if it doesn't already exist.
if (!container && create) {
Expand Down
4 changes: 2 additions & 2 deletions build/widget-buttons/widget-buttons-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion build/widget-buttons/widget-buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,17 @@ WidgetButtons.prototype = {

// Search for an existing buttons container within the section.
containerSelector = '.' + sectionClassName + ' .' + buttonsClassName;
container = contentBox.one(containerSelector);

// Search only inside the current widget
contentBox.all(containerSelector).some(function(node){
var widget = Y.Widget.getByNode(node),
isBelongs = !widget || widget === this;

if (isBelongs) {
container = node;
}
return isBelongs;
}, this);

// Create the `container` if it doesn't already exist.
if (!container && create) {
Expand Down
4 changes: 2 additions & 2 deletions build/widget-stdmod/widget-stdmod-coverage.js

Large diffs are not rendered by default.

23 changes: 13 additions & 10 deletions build/widget-stdmod/widget-stdmod-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,17 @@ YUI.add('widget-stdmod', function (Y, NAME) {
_syncUIStdMod : function() {
var stdModParsed = this._stdModParsed;

if (!stdModParsed || !stdModParsed[HEADER_CONTENT]) {
this._uiSetStdMod(STD_HEADER, this.get(HEADER_CONTENT));
}
Y.Array.each([STD_HEADER, STD_BODY, STD_FOOTER], function(section) {
var content;

if (!stdModParsed || !stdModParsed[BODY_CONTENT]) {
this._uiSetStdMod(STD_BODY, this.get(BODY_CONTENT));
}
if (!stdModParsed || !stdModParsed[section + CONTENT_SUFFIX]) {
content = this.get(section + CONTENT_SUFFIX);

if (!stdModParsed || !stdModParsed[FOOTER_CONTENT]) {
this._uiSetStdMod(STD_FOOTER, this.get(FOOTER_CONTENT));
}
if (content) {
this._uiSetStdMod(section, content, this._getStdModContent(section) ? Y.WidgetStdMod.BEFORE : false);
}
}
}, this);

this._uiSetFillHeight(this.get(FILL_HEIGHT));
},
Expand Down Expand Up @@ -460,7 +460,10 @@ YUI.add('widget-stdmod', function (Y, NAME) {

this.set(section + CONTENT_SUFFIX, this._getStdModContent(section), {src:UI});
} else {
this._eraseStdMod(section);
if (!this._getStdModContent(section)) {
//remove the section if it is empty
this._eraseStdMod(section);
}
}
this.fire(ContentUpdate);
},
Expand Down
Loading