isobar-nz / silverstripe-seo-editor

SEO Editor Administration for SilverStripe
MIT License
13 stars 7 forks source link

Translatable query string conflict #12

Open thats4shaw opened 7 years ago

thats4shaw commented 7 years ago

Ran into a small issue today on a site using Translatable.

Translatable adds a query string which is visible in the url attribute of a gridfield fieldset. This proves problematic as this module appends to the url attribute value and we end up with an ajax post request like "admin/seo-editor/SiteTree/EditForm/field/SiteTree?Locale=en_NZ/update/1" which results in a bad request.

To get around it quickly i've just made an extension and included a tweaked javascript file where it deals with the creating the request url.

var url = $this.closest('.ss-gridfield').attr('data-url');
if(url.indexOf('?Locale=') != -1) {
    url = url.replace('?Locale=', '/update/' + id + '?Locale=');
} else {
    url = url + "/update/" + id;
}

Was done in a bit of rush so i'm sure there's a nicer way of dealing with this. Feel free to close if it's considered something not worth worrying about.

brasileric commented 7 years ago

@thats4shaw Hi. I had the same issue when using Translatable. I fixed it with your solution. Thanks for sharing!