Slug dependent field with accented characters
Hi.
In one of my models i needed a slug (linked) field.
The problem was that i'm using spanish texts, and a title like "Sólo una prueba más" was "slugified" as "slo-una-prueba-ms".
All accented chars disappear.
Just by adding this line...
text = text.normalize('NFD');
...as the first line of the url_title function in linked_field_formatters.js (or fuel.min.js), did the job.
Maybe it's a good thing to add in the future for all the non-english titles.
I hope this helps!
Comments
// standard slugify borrowed from http://www.milesj.me/resources/snippet/13
function url_title(text) {
text = text.normalize('NFD');
text = text.replace(/([^_-a-zA-Z0-9\s]|\,|\&)+/gi, '');
text = text.replace(/\s+/gi, "-");
text = text.toLowerCase();
return text;
}
Maybe there's a better place for doing this?
EDIT: OK, I found the problem, it starts working when I edit likewise fuel/modules/fuel/assets/js/fuel/fuel.min.js file.