Skip to content

Commit

Permalink
BUGFIX: Updating URLSegment from Title field when new page is created
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwachtl committed May 10, 2012
1 parent 1863bb0 commit 2945f9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion javascript/CMSMain.EditForm.js
Expand Up @@ -34,7 +34,7 @@
self.updatePageTitleHeading();
self.parents('form').find('input[name=MetaTitle], input[name=MenuTitle]').val(self.val());
// update the URLSegment
URLSegment.closest('.urlsegment').update(self);
URLSegment.closest('.field.urlsegment').update(self);
} else {
return;
}
Expand Down
17 changes: 8 additions & 9 deletions javascript/SiteTreeURLSegmentField.js
Expand Up @@ -26,9 +26,9 @@
* Return URLSegemnt val()
*
* Parameters:
* (Bool) external (optional)
* (DOMElement) other (optional)
*/
edit: function(external) {
edit: function(other) {

var field = this.find(':text'),
holder = this.find('.preview'),
Expand Down Expand Up @@ -59,7 +59,7 @@

// field updated from another fields value
// reset to original state
if (external) this.edit();
if (other) this.edit();

return field.val();
},
Expand All @@ -78,11 +78,10 @@
holder = this.find('.preview'),
currentVal = holder.text(),
updateVal,
external = null;
other = arguments[0];

if (field && field.val() !== "") {
updateVal = field.val();
external = true;
if (other && other.val() !== "") {
updateVal = other.val();
} else {
updateVal = field.val();
}
Expand All @@ -91,7 +90,7 @@
self.suggest(updateVal, function(data) {
var newVal = decodeURIComponent(data.value);
field.val(newVal);
self.edit(external);
self.edit(other);
});
} else {
self.edit();
Expand Down Expand Up @@ -201,7 +200,7 @@
*/
_autoInputWidth: function() {
var field = this.find(':text');
field.width((field.width() + 9) - this.find('.prefix').width());
field.width((field.width() + 15) - this.find('.prefix').width());
}
});
});
Expand Down

0 comments on commit 2945f9d

Please sign in to comment.