Change models, new migrations, fix front and make tests work

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-01-13 23:33:03 +01:00
parent 92d2045735
commit 20cd1bb579
186 changed files with 2982 additions and 3214 deletions

View File

@@ -4,11 +4,10 @@
<v-form>
<v-text-field
label="Name of the category"
v-model="category.name"
v-model="category.title"
:counter="100"
required
></v-text-field>
<input type="file" @change="processFile($event.target)">
</v-form>
<v-btn color="primary" @click="create">Create category</v-btn>
</div>
@@ -22,32 +21,20 @@
data() {
return {
category: {
name: '',
imageDataUri: null,
title: '',
},
};
},
methods: {
create() {
const router = this.$router;
eventFetch('/categories', this.$store, { method: 'POST', body: JSON.stringify(this.category) })
eventFetch('/categories', this.$store, { method: 'POST', body: JSON.stringify({ category: this.category }) })
.then(response => response.json())
.then(() => {
this.loading = false;
router.push('/category')
});
},
processFile(target) {
const reader = new FileReader();
const file = target.files[0];
reader.addEventListener('load', () => {
this.category.imageDataUri = reader.result;
});
if (file) {
reader.readAsDataURL(file);
}
}
},
};
</script>

View File

@@ -11,7 +11,7 @@
</v-card-media>
<v-card-title primary-title>
<div>
<h3 class="headline mb-0">{{ category.name }}</h3>
<h3 class="headline mb-0">{{ category.title }}</h3>
<div>{{ category.description }}</div>
</div>
</v-card-title>
@@ -49,9 +49,9 @@
fetchData() {
eventFetch('/categories', this.$store)
.then(response => response.json())
.then((data) => {
.then((response) => {
this.loading = false;
this.categories = data['hydra:member'];
this.categories = response.data;
});
},
deleteCategory(categoryId) {