Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

Commit

Permalink
Slugify the url
Browse files Browse the repository at this point in the history
  • Loading branch information
alecritson committed Aug 13, 2019
1 parent 81415f4 commit 079a017
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@
},
routes() {
return this.product.routes ? this.product.routes.data : null;
}
},
},
methods: {
sanitize: _.debounce(function (index) {
const slug = this.slugs[index].new;
this.slugs[index].new = _.kebabCase(slug);
}, 1000),
fetch(showFetch) {
this.skus = [];
this.slugs = [];
Expand Down Expand Up @@ -107,11 +111,10 @@
</template>

</div>

<div class="form-group">
<label>URL<span v-if="routes.length > 1">'s</span></label>
<template v-for="(slug, index) in slugs">
<input :key="slug.current" v-model="slug.new" class="form-control" :placeholder="slug.current" />
<input @keyup="sanitize(index)" :key="slug.current" v-model="slug.new" class="form-control" :placeholder="slug.current" />
<template v-if="errors[`routes.${index}.new`]">
<br><p class="text-danger" v-for="(error, index) in errors[`routes.${index}.new`]">{{ error }}</p>
</template>
Expand Down

0 comments on commit 079a017

Please sign in to comment.