ensure slugs don't start or end with a dash

This commit is contained in:
John Bintz 2013-04-03 06:59:46 -04:00
parent 3e91931dc6
commit 0c9b8ab9ce
1 changed files with 1 additions and 1 deletions

View File

@ -47,7 +47,7 @@ class SlugInput < Formtastic::Inputs::StringInput
var setSlug = function(text) { var setSlug = function(text) {
var i, k; var i, k;
var originalSlug = text.toLowerCase().replace(/[^a-z0-9]+/g, '-'); var originalSlug = text.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/, '');
var newSlug = originalSlug; var newSlug = originalSlug;
var index = 0; var index = 0;