From 447ef16294e8dd5aa905f3817f62d9d282345a20 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 18 Jun 2012 17:34:35 +1200 Subject: [PATCH] BUGFIX: Update the tree w/ javascript when MenuTitle is updated, not Title (Trac #7496) --- javascript/CMSMain.EditForm.js | 35 ++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/javascript/CMSMain.EditForm.js b/javascript/CMSMain.EditForm.js index b04fca9e..35d8e44a 100644 --- a/javascript/CMSMain.EditForm.js +++ b/javascript/CMSMain.EditForm.js @@ -41,7 +41,7 @@ } else { $('.update', self.parent()).show(); } - self.updatePanelLabels(title); + self.updateBreadcrumbLabel(title); }); } @@ -78,18 +78,16 @@ }, /** - * Function: updatePanelLabels + * Function: updateBreadcrumbLabel * - * Update the breadcrumb and tree + * Update the breadcrumb * (String) title */ - updatePanelLabels: function(title) { + updateBreadcrumbLabel: function(title) { var pageID = $('.cms-edit-form input[name=ID]').val(); var panelCrumb = $('span.cms-panel-link.crumb'); - var treeItem = $('.item', $('.cms-tree').find("[data-id='" + pageID + "']")); if (title && title != "") { panelCrumb.text(title); - treeItem.text(title); } }, @@ -118,6 +116,31 @@ updateURLFromTitle.hide(); } }); + + /** + * MenuTitle + */ + $('.cms-edit-form input[name=MenuTitle]').entwine({ + onchange: function() { + var menuTitle = this.val(); + this.updateTreeLabel(menuTitle); + }, + + /** + * Function: updatePanelLabels + * + * Update the tree + * (String) title + */ + updateTreeLabel: function(title) { + var pageID = $('.cms-edit-form input[name=ID]').val(); + var treeItem = $('.item', $('.cms-tree').find("[data-id='" + pageID + "']")); + if (title && title != "") { + treeItem.text(title); + } + } + + }); /** * Class: .cms-edit-form .parentTypeSelector