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

View File

@ -47,7 +47,7 @@ class SlugInput < Formtastic::Inputs::StringInput
var setSlug = function(text) {
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 index = 0;