Skip to content
Snippets Groups Projects
Commit b1e00e78 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

META: refactor to slugify function

parent 78226917
No related branches found
No related tags found
No related merge requests found
......@@ -75,6 +75,7 @@
<script>
import prettyDate from '../mixins/prettyDate'
import slugify from '../mixins/slugify'
import axios from 'axios'
/*
......@@ -87,7 +88,7 @@ function debugErrorResponse (data) {
*/
export default {
mixins: [ prettyDate ],
mixins: [ prettyDate, slugify ],
props: {
show: { type: Object, required: true },
showAggregate: { type: Object, required: true }
......@@ -109,12 +110,7 @@ export default {
},
computed: {
slug: function () {
return this.title.toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w-]+/g, '') // Remove all non-word chars
.replace(/--+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, '') // Trim - from end of text
return this.slugify(this.title)
},
hosts: function () {
// for the vue bootstrap select component we need an array of objects
......
......@@ -138,7 +138,7 @@ export default {
computed: {
temporarySlug: function () {
return this.slug(this.newShow.name)
return this.slugify(this.newShow.name)
},
showTypeSelector: function () {
......
export default {
methods: {
slug: function (title) {
slugify: function (title) {
return title.toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w-]+/g, '') // Remove all non-word chars
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment