Skip to content

Commit

Permalink
feat(admin-ui): Validate slug pattern in product detail form
Browse files Browse the repository at this point in the history
Relates to #103
  • Loading branch information
michaelbromley committed May 29, 2019
1 parent 220d861 commit 29509d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@
(input)="updateSlug($event.target.value)"
/>
</vdr-form-field>
<vdr-form-field [label]="'catalog.slug' | translate" for="slug">
<input id="slug" type="text" formControlName="slug" />
<vdr-form-field
[label]="'catalog.slug' | translate"
for="slug"
[errors]="{ pattern: 'catalog.slug-pattern-error' | translate }"
>
<input id="slug" type="text" formControlName="slug" pattern="[a-z0-9_-]+" />
</vdr-form-field>
<vdr-rich-text-editor
formControlName="description"
Expand Down
1 change: 1 addition & 0 deletions admin-ui/src/i18n-messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"set-as-featured-asset": "Set as featured asset",
"sku": "SKU",
"slug": "Slug",
"slug-pattern-error": "The slug may only contain letters, numbers, - and _",
"stock-on-hand": "Stock",
"tax-category": "Tax category",
"taxes": "Taxes",
Expand Down

0 comments on commit 29509d8

Please sign in to comment.