mirror of
https://github.com/Hopiu/wagtail-modeltranslation.git
synced 2026-05-17 19:51:13 +00:00
Fix diacritics downcoding in slugs
This change correctly downcodes diacritics to ASCII if user has WAGTAIL_ALLOW_UNICODE_SLUGS = False (e.g. abčďéfg -> abcdefg) Without this change, the slug simply strips all diacritics which is not ideal (e.g. abčďěfg -> abfg)
This commit is contained in:
parent
e7adf51d2a
commit
4614b5faa4
1 changed files with 2 additions and 2 deletions
|
|
@ -8,13 +8,13 @@ $(document).ready(function () {
|
|||
$('#id_title_' + lang_code).on('focus', function () {
|
||||
/* slug should only follow the title field if its value matched the title's value at the time of focus */
|
||||
var currentSlug = $('#id_slug_' + lang_code).val();
|
||||
var slugifiedTitle = cleanForSlug(this.value);
|
||||
var slugifiedTitle = cleanForSlug(this.value, true);
|
||||
slugFollowsTitle = (currentSlug == slugifiedTitle);
|
||||
});
|
||||
|
||||
$('#id_title_' + lang_code).on('keyup keydown keypress blur', function () {
|
||||
if (slugFollowsTitle) {
|
||||
var slugifiedTitle = cleanForSlug(this.value);
|
||||
var slugifiedTitle = cleanForSlug(this.value, true);
|
||||
$('#id_slug_' + lang_code).val(slugifiedTitle);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue