0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-28 08:48:04 +01:00

Merge branch 'master' of https://github.com/benemery/wagtail into benemery-master

This commit is contained in:
Matt Westcott 2014-04-08 17:11:44 +01:00
commit b22d9755f6

View File

@ -239,8 +239,8 @@ function InlinePanel(opts) {
return self; return self;
} }
function cleanForSlug(val){ function cleanForSlug(val, useURLify){
if(URLify != undefined) { // Check to be sure that URLify function exists if(URLify != undefined && useURLify !== false) { // Check to be sure that URLify function exists, and that we want to use it.
return URLify(val, val.length); return URLify(val, val.length);
} else { // If not just do the "replace" } else { // If not just do the "replace"
return val.replace(/\s/g,"-").replace(/[^A-Za-z0-9\-]/g,"").toLowerCase(); return val.replace(/\s/g,"-").replace(/[^A-Za-z0-9\-]/g,"").toLowerCase();
@ -262,7 +262,8 @@ function initSlugAutoPopulate(){
function initSlugCleaning(){ function initSlugCleaning(){
$('#id_slug').blur(function(){ $('#id_slug').blur(function(){
$(this).val(cleanForSlug($(this).val())); // if a user has just set the slug themselves, don't remove stop words etc, just illegal characters
$(this).val(cleanForSlug($(this).val(), false));
}); });
} }