ensure slugs don't start or end with a dash
This commit is contained in:
parent
3e91931dc6
commit
0c9b8ab9ce
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user