Trim hyphens from start/end of slug

This commit is contained in:
Toby Zerner 2015-03-24 19:16:26 +10:30
parent c35b472e66
commit 3362a8c092

View File

@ -23,7 +23,7 @@ export default Subject.extend(HasItemLists, {
title: DS.attr('string'),
slug: Ember.computed('title', function() {
return this.get('title').toLowerCase().replace(/[^a-z0-9]/gi, '-').replace(/-+/g, '-');
return this.get('title').toLowerCase().replace(/[^a-z0-9]/gi, '-').replace(/-+/g, '-').replace(/-$|^-/g, '');
}),
startTime: DS.attr('date'),