Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUG Restrict URLSegment preview to editable fields

This fixes a bug where the Translatable module
would have a duplicate preview because it had
another ".urlsegment" field showing the value in its
original language.

See silverstripe/silverstripe-translatable#43
  • Loading branch information...
commit 2923e55c712530241ba79bdbca1ca793ae003588 1 parent f5007a5
Ingo Schommer chillu authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 javascript/SiteTreeURLSegmentField.js
10 javascript/SiteTreeURLSegmentField.js
View
@@ -11,9 +11,13 @@
* Constructor: onmatch
*/
onmatch : function() {
- this._addActions(); // add elements and actions for editing
- this.edit(); // toggle
- this._autoInputWidth(); // set width of input field
+ // Only initialize the field if it contains an editable field.
+ // This ensures we don't get bogus previews on readonly fields.
+ if(this.find(':text').length) {
+ this._addActions(); // add elements and actions for editing
+ this.edit(); // toggle
+ this._autoInputWidth(); // set width of input field
+ }
this._super();
},
Please sign in to comment.
Something went wrong with that request. Please try again.