mirror of
https://github.com/aelve/guide.git
synced 2024-12-26 22:34:42 +03:00
428c17048d
* TestCafe added to project. First test written * Search input test added * Seacth input test changed, travis job for testcafe tests added * Travis bugfix test * Travis testcafe bugfix test try 2 * Travis testcafe bugfix test ry 3 * Travis testcafe test sleep increased to 10 * Test adding category added but bug with click occurs - check!!! * Category test (testing the group where test was creating) added - bug fix * Article component rewrite * Article component rewritten * Big with rendering content.html in v-for * Collapse bug fix * MInor category visual changes/fixes * Description, reactivity bug fix * merge * Refactoring after code review * Conflict in styles resolved * Item add/delete feature in category * merge with vue * minor code fix * Update ArticleContent.vue * Merge bug fix * Minor merge bug fix * Code review fixes
84 lines
1.6 KiB
Vue
84 lines
1.6 KiB
Vue
<template>
|
|
<v-dialog
|
|
:value="value"
|
|
@input="close"
|
|
max-width="500px"
|
|
>
|
|
<slot slot="activator" />
|
|
|
|
<v-card>
|
|
<v-card-text>
|
|
<v-form
|
|
lazy-validation
|
|
v-model="isValid"
|
|
@keydown.native.enter="submit"
|
|
>
|
|
<v-text-field
|
|
class="mb-2"
|
|
label="Item name"
|
|
autofocus
|
|
:rules="itemValidationRules"
|
|
v-model="itemName"
|
|
/>
|
|
</v-form>
|
|
</v-card-text>
|
|
<v-card-actions>
|
|
<v-spacer />
|
|
<v-btn
|
|
flat
|
|
color="primary"
|
|
class="add-cat-submit"
|
|
:disabled="!isValid"
|
|
@click.native="submit"
|
|
>
|
|
Submit
|
|
</v-btn>
|
|
<v-btn
|
|
flat
|
|
color="primary"
|
|
@click.native="close"
|
|
>
|
|
Cancel
|
|
</v-btn>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import Vue from 'vue'
|
|
import Component from 'vue-class-component';
|
|
import { Prop, Watch } from 'vue-property-decorator';
|
|
|
|
@Component
|
|
export default class AddItemDialog extends Vue {
|
|
@Prop(Boolean) value!: boolean
|
|
|
|
itemName: string = ''
|
|
|
|
itemValidationRules: Function[] = [
|
|
(x: string) => !!x || 'Item name can not be empty'
|
|
]
|
|
|
|
isValid: boolean = false
|
|
|
|
@Watch('value')
|
|
onOpen(newVal: string) {
|
|
this.itemName = ''
|
|
}
|
|
|
|
close() {
|
|
this.$emit('input', false)
|
|
}
|
|
|
|
async submit() {
|
|
await this.$store.dispatch('categoryItem/createItem', {
|
|
category: 'sth6l9jl',
|
|
name: this.itemName
|
|
})
|
|
|
|
this.close()
|
|
}
|
|
}
|
|
</script>
|