diff --git a/core/src/main/resources/lib/layout/breadcrumbs.jelly b/core/src/main/resources/lib/layout/breadcrumbs.jelly index b36db929f1ff4893e732af3deb5323e11417ad19..04c902b150730b74e79ff8c73b7ef01974dbedeb 100644 --- a/core/src/main/resources/lib/layout/breadcrumbs.jelly +++ b/core/src/main/resources/lib/layout/breadcrumbs.jelly @@ -55,7 +55,7 @@ THE SOFTWARE. -
+
diff --git a/core/src/main/resources/lib/layout/breadcrumbs_.js b/core/src/main/resources/lib/layout/breadcrumbs_.js index 73e885f9c646001ed74fc4401898319bd1361720..0539b0b685657ea0d8d5232cf18e958298b35d02 100644 --- a/core/src/main/resources/lib/layout/breadcrumbs_.js +++ b/core/src/main/resources/lib/layout/breadcrumbs_.js @@ -1,42 +1,52 @@ -/** @type {YAHOO.widget.Menu} */ -var oMenu; +var breadcrumb = (function() { + /** @type {YAHOO.widget.Menu} */ + var menu; -var xhr; + /** + * Used for fetching the content of the menu asynchronously from the server + */ + var xhr; -/** - * @param {HTMLElement} e - * The LI tag that the mouse has wondered into. - */ -function foo(e) { - function showMenu(items) { - oMenu.hide(); - oMenu.cfg.setProperty("context",[e,"tl","bl"]); - oMenu.clearContent(); - oMenu.addItems(items); - oMenu.render("rendertarget"); - oMenu.show(); - } + /** + * Activates the context menu for the specified breadcrumb element. + * + * @param {HTMLElement} e + * The LI tag that the mouse has wondered into. + */ + function activate(e) { + function showMenu(items) { + menu.hide(); + menu.cfg.setProperty("context",[e,"tl","bl"]); + menu.clearContent(); + menu.addItems(items); + menu.render("breadcrumb-menu-target"); + menu.show(); + } - if (xhr) - xhr.options.onComplete = function() {}; // ignore the currently pending call + if (xhr) + xhr.options.onComplete = function() {}; // ignore the currently pending call - if (e.items) {// use what's already loaded - showMenu(e.items); - } else {// fetch menu on demand - xhr = new Ajax.Request(e.firstChild.getAttribute("href")+"contextMenu", { - onComplete : function (x) { - var a = x.responseText.evalJSON().items; - a.each(function(e) { - e.text = " "+e.displayName; + if (e.items) {// use what's already loaded + showMenu(e.items); + } else {// fetch menu on demand + xhr = new Ajax.Request(e.firstChild.getAttribute("href")+"contextMenu", { + onComplete : function (x) { + var a = x.responseText.evalJSON().items; + a.each(function(e) { + e.text = " "+e.displayName; + }); + e.items = a; + showMenu(a); + } }); - e.items = a; - showMenu(a); } + + return false; + } + + window.addEventListener("load",function(){ + menu = new YAHOO.widget.Menu("breadcrumb-menu", {position:"dynamic", hidedelay:1000}); }); - } - return false; -} -window.addEventListener("load",function(){ - oMenu = new YAHOO.widget.Menu("breadcrumb-menu", {position:"dynamic", hidedelay:1000}); -}) + return { activate : activate }; +})();