From 4ce7cf9403f4b3436259bc032e9599ee796db8a1 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 16 Sep 2007 02:01:34 +0000 Subject: [PATCH] elofgren: Fix Trac Ticket: 'Page name and Navigation label improvements' http://support.silverstripe.com/gsoc/ticket/35 by making it so that 'If you type in Page name, the Navigation Label and Meta Title should automatically update the first time' (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42035 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/UpdateURL.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/javascript/UpdateURL.js b/javascript/UpdateURL.js index b5f0df880..e2c8b309c 100755 --- a/javascript/UpdateURL.js +++ b/javascript/UpdateURL.js @@ -15,6 +15,15 @@ Behaviour.register({ if( newSuggestion == urlSegmentField.value || isNew || confirm( 'Would you like me to change the URL to:\n\n' + newSuggestion + '/\n\nClick Ok to change the URL, click Cancel to leave it as:\n\n' + urlSegmentField.value ) ) urlSegmentField.value = newSuggestion; + // If you type in Page name, the Navigation Label and Meta Title should automatically update the first time + // @todo: Change file name from UpdateURL to something more geneneric since we now do more than update the URL. + if( $('Form_EditForm_MenuTitle').value.indexOf("New") == 0 ) { + $('Form_EditForm_MenuTitle').value = this.value; + } + // @todo see if updating this is confusing (Q: why isn't my page title changing? A: Check the Meta-Data tab) + if( $('Form_EditForm_MetaTitle').value.length == 0 ) { + $('Form_EditForm_MetaTitle').value = this.value; + } } } -}); \ No newline at end of file +});