You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2013/05/15 19:06:42 UTC
svn commit: r1482960 - in
/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script:
tobago-menu.js tobago.js
Author: weber
Date: Wed May 15 17:06:42 2013
New Revision: 1482960
URL: http://svn.apache.org/r1482960
Log:
TOBAGO-1268 - Dropdown Menu actions don't work after partial reload
Modified:
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js?rev=1482960&r1=1482959&r2=1482960&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js Wed May 15 17:06:42 2013
@@ -320,7 +320,18 @@ Tobago.Menu.init = function(elements) {
subMenu.data("super-menu", superMenu);
});
- jQuery(".tobago-page-menuStore").append(menus.children("ol"));
+ menus.children("ol").each(function() {
+ var subMenuContainer = jQuery(this);
+ jQuery(".tobago-page-menuStore").append(subMenuContainer);
+ if (elements) {
+ // this is ajax case: the commands are just removed from elements and therefore not handled by Tobago.initDom,
+ // so do it here
+ Tobago.Utils.selectWidthJQuery(subMenuContainer, '[data-tobago-commands]')
+ .each(function () {Tobago.initCommand(jQuery(this));});
+ }
+ });
+
+// jQuery(".tobago-page-menuStore").append(menus.children("ol"));
var toolBarMenu = Tobago.Utils.selectWidthJQuery(
elements, ".tobago-toolBar-menu, .tobago-boxToolBar-menu, .tobago-tabGroupToolBar-menu");
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1482960&r1=1482959&r2=1482960&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Wed May 15 17:06:42 2013
@@ -1028,87 +1028,89 @@ var Tobago = {
}
},
- initDom: function(elements) {
-
- // focus
- var autofocus = Tobago.Utils.selectWidthJQuery(elements, '[autofocus]');
- autofocus.each(function () {
- // setupFocus
- Tobago.focusId = jQuery(this).attr("id");
- Tobago.setFocus();
- });
-
- // commands
- var commandButtons = Tobago.Utils.selectWidthJQuery(elements, '[data-tobago-commands]');
- commandButtons.each(function () {
- // setupInputFacetCommand
- var command = jQuery(this);
- var commands = command.data("tobago-commands");
-
- if (commands.click) {
- command.click(function(event) {
- if (commands.click.omit != true) {
- if (commands.click.confirmation == null || confirm(commands.click.confirmation)) {
- var popup = commands.click.popup;
- if (popup && popup.command == "close" && popup.immediate) {
- Tobago.Popup.close(this);
- } else {
- if (popup && popup.command == "close") {
- Tobago.Popup.unlockBehind();
- }
- var action = commands.click.action ? commands.click.action : jQuery(this).attr("id");
- if (commands.click.partially) {
- if (popup && popup.command == "open") {
- Tobago.Popup.openWithAction(this, commands.click.partially, action);
- } else {
- Tobago.reloadComponent(this, commands.click.partially, action, commands.click);
- }
- } else if (commands.click.url) {
- Tobago.navigateToUrl(commands.click.url);
- } else if (commands.click.script) { // XXX this case is deprecated.
- // not allowed with Content Security Policy (CSP)
- new Function('event' , commands.click.script)(event);
+ initCommand: function(command) {
+ // command is jQuery object
+ // setupInputFacetCommand
+ var commands = command.data("tobago-commands");
+
+ if (commands.click) {
+ command.click(function(event) {
+ if (commands.click.omit != true) {
+ if (commands.click.confirmation == null || confirm(commands.click.confirmation)) {
+ var popup = commands.click.popup;
+ if (popup && popup.command == "close" && popup.immediate) {
+ Tobago.Popup.close(this);
+ } else {
+ if (popup && popup.command == "close") {
+ Tobago.Popup.unlockBehind();
+ }
+ var action = commands.click.action ? commands.click.action : jQuery(this).attr("id");
+ if (commands.click.partially) {
+ if (popup && popup.command == "open") {
+ Tobago.Popup.openWithAction(this, commands.click.partially, action);
} else {
- Tobago.submitAction(this, action, commands.click);
- }
- if (popup && popup.command == "close") {
- Tobago.Popup.close(this);
+ Tobago.reloadComponent(this, commands.click.partially, action, commands.click);
}
+ } else if (commands.click.url) {
+ Tobago.navigateToUrl(commands.click.url);
+ } else if (commands.click.script) { // XXX this case is deprecated.
+ // not allowed with Content Security Policy (CSP)
+ new Function('event' , commands.click.script)(event);
+ } else {
+ Tobago.submitAction(this, action, commands.click);
+ }
+ if (popup && popup.command == "close") {
+ Tobago.Popup.close(this);
}
}
}
- });
- }
- if (commands.change) {
- command.change(function() {
- if (commands.change.partially) {
- Tobago.reloadComponent(this, commands.change.partially, commands.change.action, commands.change);
- } else {
- Tobago.submitAction(this, commands.change.action, commands.change);
- }
- });
- }
- if (commands.complete) {
- if (commands.complete.partially) {
- Tobago.reloadComponent(this, commands.complete.partially, commands.complete.action, commands.complete);
+ }
+ });
+ }
+ if (commands.change) {
+ command.change(function() {
+ if (commands.change.partially) {
+ Tobago.reloadComponent(this, commands.change.partially, commands.change.action, commands.change);
} else {
- Tobago.submitAction(this, commands.complete.action, commands.complete);
+ Tobago.submitAction(this, commands.change.action, commands.change);
}
+ });
+ }
+ if (commands.complete) {
+ if (commands.complete.partially) {
+ Tobago.reloadComponent(this, commands.complete.partially, commands.complete.action, commands.complete);
+ } else {
+ Tobago.submitAction(this, commands.complete.action, commands.complete);
}
- if (commands.resize) {
- Tobago.resizeAction = function() {
- Tobago.submitAction(this, commands.resize.action, commands.resize);
- }
+ }
+ if (commands.resize) {
+ Tobago.resizeAction = function() {
+ Tobago.submitAction(this, commands.resize.action, commands.resize);
}
- if (commands.action) {
- var delay = 100;
- if (commands.action.delay) {
- delay = commands.action.delay;
- }
- setTimeout(Tobago.submitAction(this, commands.action.action, commands.action), delay);
+ }
+ if (commands.action) {
+ var delay = 100;
+ if (commands.action.delay) {
+ delay = commands.action.delay;
}
+ setTimeout(Tobago.submitAction(this, commands.action.action, commands.action), delay);
+ }
+ },
+
+ initDom: function(elements) {
+
+ // focus
+ var autofocus = Tobago.Utils.selectWidthJQuery(elements, '[autofocus]');
+ autofocus.each(function () {
+ // setupFocus
+ Tobago.focusId = jQuery(this).attr("id");
+ Tobago.setFocus();
});
+ // commands
+ Tobago.Utils.selectWidthJQuery(elements, '[data-tobago-commands]')
+ .each(function () {Tobago.initCommand(jQuery(this));});
+
// access keys
var accesskeys = Tobago.Utils.selectWidthJQuery(elements, '[accesskey]');
accesskeys.each(function () {