mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-03-14 12:10:18 +03:00
fix: category create validation (#552)
This commit is contained in:
parent
66dc741825
commit
edc0330baf
10 changed files with 19 additions and 38 deletions
|
@ -7,10 +7,10 @@
|
|||
</v-toolbar-title>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-form ref="categoryForm" v-model="valid" lazy-validation class="px-6 mt-3">
|
||||
<v-form ref="categoryForm" v-model="valid" class="px-6 mt-3">
|
||||
<v-container>
|
||||
<v-text-field v-model="category.name" :rules="nameRules" :counter="15" :label="$t('modals.newCategory.categoryName')" required :disabled="hasInitialCategory" />
|
||||
<v-text-field v-model="category.savePath" :rules="PathRules" :counter="40" :label="$t('path')" required />
|
||||
<v-text-field v-model="category.name" :rules="nameRules" :label="$t('modals.newCategory.categoryName')" required :disabled="hasInitialCategory" />
|
||||
<v-text-field v-model="category.savePath" :rules="PathRules" :label="$t('path')" required />
|
||||
</v-container>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
|
@ -48,7 +48,7 @@ export default {
|
|||
mdiCancel,
|
||||
mdiTagPlus,
|
||||
mdiPencil,
|
||||
valid: true
|
||||
valid: false
|
||||
}),
|
||||
computed: {
|
||||
...mapGetters(['getSelectedCategory']),
|
||||
|
@ -56,10 +56,10 @@ export default {
|
|||
return !!(this.initialCategory && this.initialCategory.name)
|
||||
},
|
||||
nameRules() {
|
||||
return [v => !!v || this.$i18n.t('modals.newCategory.tipOnNoName'), v => (v && v.length <= 15) || this.$i18n.t('modals.newCategory.tipOnNameTooLong')]
|
||||
return [v => !!v || this.$i18n.t('modals.newCategory.tipOnNoName')]
|
||||
},
|
||||
PathRules() {
|
||||
return [v => !!v || this.$i18n.t('modals.newCategory.tipOnNoPath'), v => (v && v.length <= 40) || this.$i18n.t('modals.newCategory.TipOnPathTooLong')]
|
||||
return [v => !!v || this.$i18n.t('modals.newCategory.tipOnNoPath')]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -70,10 +70,6 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
create() {
|
||||
this.$refs.categoryForm.validate()
|
||||
|
||||
return
|
||||
|
||||
qbit.createCategory(this.category)
|
||||
this.cancel()
|
||||
},
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
</v-toolbar-title>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-form class="px-6 mt-3">
|
||||
<v-form ref="tagForm" v-model="valid" class="px-6 mt-3">
|
||||
<v-container>
|
||||
<v-text-field v-model="tagname" :rules="rules" :counter="10" :label="$t('modals.newTag.tagName')" required />
|
||||
<v-text-field v-model="tagname" :rules="rules" :label="$t('modals.newTag.tagName')" required />
|
||||
</v-container>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
<v-divider />
|
||||
<v-card-actions class="justify-end">
|
||||
<v-btn class="accent white--text elevation-0 px-4" @click="create">
|
||||
<v-btn class="accent white--text elevation-0 px-4" @click="create" :disabled="!valid">
|
||||
{{ $t('create') }}
|
||||
</v-btn>
|
||||
<v-btn class="error white--text elevation-0 px-4" @click="cancel">
|
||||
|
@ -34,7 +34,8 @@ export default {
|
|||
mixins: [Modal],
|
||||
data: () => ({
|
||||
tagname: '',
|
||||
rules: [v => !!v || 'Tag is required', v => v.length <= 10 || 'Tag must be less than 10 characters']
|
||||
rules: [v => !!v || 'Tag is required'],
|
||||
valid: false
|
||||
}),
|
||||
methods: {
|
||||
create() {
|
||||
|
|
|
@ -283,9 +283,7 @@ const locale = {
|
|||
categoryName: 'Category name',
|
||||
Path: 'Path',
|
||||
tipOnNoName: 'Category name is required',
|
||||
tipOnNameTooLong: 'Category name must be less than 15 characters',
|
||||
tipOnNoPath: 'Path is required',
|
||||
TipOnPathTooLong: 'Path must be less than 40 characters'
|
||||
tipOnNoPath: 'Path is required'
|
||||
},
|
||||
newTag: {
|
||||
createNewTag: 'Create New Tag',
|
||||
|
|
|
@ -226,9 +226,7 @@ const locale = {
|
|||
categoryName: 'Nom de la catégorie',
|
||||
Path: "Chemin d'accès",
|
||||
tipOnNoName: 'Le nom de la catégorie est obligatoire',
|
||||
tipOnNameTooLong: 'Le nom de la catégorie doit comporter moins de 15 caractères',
|
||||
tipOnNoPath: "Le chemin d'accès est requis",
|
||||
TipOnPathTooLong: "Le chemin d'accès doit comporter moins de 40 caractères"
|
||||
tipOnNoPath: "Le chemin d'accès est requis"
|
||||
},
|
||||
newTag: {
|
||||
createNewTag: 'Créer un nouveau tag',
|
||||
|
|
|
@ -275,9 +275,7 @@ const locale = {
|
|||
categoryName: 'Nama kategori',
|
||||
Path: 'Path',
|
||||
tipOnNoName: 'Nama kategori diperlukan',
|
||||
tipOnNameTooLong: 'Nama kategori harus kurang dari 15 karakter',
|
||||
tipOnNoPath: 'Path is required',
|
||||
TipOnPathTooLong: 'Path harus kurang dari 40 karakter'
|
||||
tipOnNoPath: 'Path is required'
|
||||
},
|
||||
newTag: {
|
||||
createNewTag: 'Buat Tag Baru',
|
||||
|
|
|
@ -269,9 +269,7 @@ const locale = {
|
|||
categoryName: 'カテゴリ名',
|
||||
Path: 'パス',
|
||||
tipOnNoName: 'カテゴリ名が必要です',
|
||||
tipOnNameTooLong: 'カテゴリ名は15字以内である必要があります',
|
||||
tipOnNoPath: 'パスが必要です',
|
||||
TipOnPathTooLong: 'パスは40文字以内である必要があります'
|
||||
tipOnNoPath: 'パスが必要です'
|
||||
},
|
||||
newTag: {
|
||||
createNewTag: 'タグを作成',
|
||||
|
|
|
@ -269,9 +269,7 @@ const locale = {
|
|||
categoryName: 'Название категории',
|
||||
Path: 'Путь',
|
||||
tipOnNoName: 'Требуется название категории',
|
||||
tipOnNameTooLong: 'Название категории должно содержать менее 15 символов',
|
||||
tipOnNoPath: 'Нужный путь',
|
||||
TipOnPathTooLong: 'Путь должен быть менее 40 символов'
|
||||
tipOnNoPath: 'Нужный путь'
|
||||
},
|
||||
newTag: {
|
||||
createNewTag: 'Создать новый тег',
|
||||
|
|
|
@ -226,9 +226,7 @@ const locale = {
|
|||
categoryName: 'Назва категорії',
|
||||
Path: 'Шлях',
|
||||
tipOnNoName: 'Потрібна назва категорії',
|
||||
tipOnNameTooLong: 'Назва категорії має містити менше 15 символів',
|
||||
tipOnNoPath: 'Потрібний шлях',
|
||||
TipOnPathTooLong: 'Шлях має бути менше 40 символів'
|
||||
tipOnNoPath: 'Потрібний шлях'
|
||||
},
|
||||
newTag: {
|
||||
createNewTag: 'Створити новий тег',
|
||||
|
|
|
@ -269,9 +269,7 @@ const locale = {
|
|||
categoryName: '分类名称',
|
||||
Path: '路径',
|
||||
tipOnNoName: '分类名称是必须的',
|
||||
tipOnNameTooLong: '分类名称必须小于 15 个字符',
|
||||
tipOnNoPath: '路径是必须的',
|
||||
TipOnPathTooLong: '路径必须小于 40 个字符'
|
||||
tipOnNoPath: '路径是必须的'
|
||||
},
|
||||
newTag: {
|
||||
createNewTag: '新建标签',
|
||||
|
|
|
@ -283,9 +283,7 @@ const locale = {
|
|||
categoryName: '分類名稱',
|
||||
Path: '路徑',
|
||||
tipOnNoName: '必須填寫分類名稱',
|
||||
tipOnNameTooLong: '分類名稱必須少於 15 個字符',
|
||||
tipOnNoPath: '必須填寫路徑',
|
||||
TipOnPathTooLong: '路徑必須少於 40 個字符'
|
||||
tipOnNoPath: '必須填寫路徑'
|
||||
},
|
||||
newTag: {
|
||||
createNewTag: '新增標籤',
|
||||
|
|
Loading…
Add table
Reference in a new issue