Hallo,
ich habe folgenden Aufbau
src\Resources\app\administration\src\module\kk-qanda\index.js
import './page/kk-qanda-list';
import './page/kk-qanda-detail';
import './page/kk-qanda-create';
//...
routes: {
list: {
component: 'kk-qanda-list',
path: 'list'
},
detail: {
component: 'kk-qanda-detail',
path: 'detail/:id',
meta: {
parentPath: 'kk.qanda.list'
}
},
create: {
component: 'kk-qanda-create',
path: 'create',
meta: {
parentPath: 'kk.qanda.list'
}
}
},
//...
src\Resources\app\administration\src\module\kk-qanda\page\kk-qanda-create\index.js
const { Component } = Shopware;
Component.extend('kk-qanda-create', 'kk-qanda-detail', {
methods: {
getQanda() {
this.qanda = this.repository.create(Shopware.Context.api);
},
onClickSave() {
this.isLoading = true;
this.repository
.save(this.qanda, Shopware.Context.api)
.then(() => {
this.isLoading = false;
this.$router.push({ name: 'kk.qanda.detail', params: { id: this.qanda.id } });
}).catch((exception) => {
this.isLoading = false;
this.createNotificationError({
title: this.$t('kk-qanda.detail.errorTitle'),
message: exception
});
});
}
}
});
src\Resources\app\administration\src\module\kk-qanda\page\kk-qanda-detail\index.js
import template from './kk-qanda-detail.html.twig';
const { Component, Mixin } = Shopware;
Component.register('kk-qanda-detail', {
template,
inject: [
'repositoryFactory'
],
mixins: [
Mixin.getByName('notification')
],
metaInfo() {
return {
title: this.$createTitle()
};
},
data() {
return {
qanda: null,
isLoading: false,
processSuccess: false,
repository: null
};
},
created() {
this.repository = this.repositoryFactory.create('kk_qanda');
this.getQanda();
},
methods: {
getQanda() {
this.repository
.get(this.$route.params.id, Shopware.Context.api)
.then((entity) => {
this.qanda = entity;
});
},
onClickSave() {
this.isLoading = true;
this.repository
.save(this.qanda, Shopware.Context.api)
.then(() => {
this.getQanda();
this.isLoading = false;
this.processSuccess = true;
}).catch((exception) => {
this.isLoading = false;
this.createNotificationError({
title: this.$t('kk-qanda.detail.errorTitle'),
message: exception
});
});
},
saveFinish() {
this.processSuccess = false;
}
}
});
src\Resources\app\administration\src\module\kk-qanda\page\kk-qanda-detail\kk-qanda-detail.html.twig
foobar
{% block kk_qanda_detail %}
{{ $t('kk-qanda.detail.cancelButtonText') }}
{{ $t('kk-qanda.detail.saveButtonText') }}
{% endblock %}
Die Seite mit dem Listing funktioniert soweit. Die create/detail Seite gibt nur den foobar
Tag aus, sonst nichts.
Es gibt auch keine Errors im dev log. Hat jemand eine Idee?