Fix button below chapter title

This commit is contained in:
Ramon Wenger 2022-02-02 16:23:55 +01:00
parent 228def84b4
commit b6ef5b2e34
5 changed files with 31 additions and 8 deletions

View File

@ -18,26 +18,48 @@
const AddPointer = () => import(/* webpackChunkName: "icons" */'@/components/icons/AddPointer');
export default {
props: ['after', 'parent'],
props: {
where: {
type: Object,
validator(prop) {
return Object.prototype.hasOwnProperty.call(prop, 'after' )
|| Object.prototype.hasOwnProperty.call(prop, 'parent');
}
},
},
components: {
AddPointer
},
computed: {
parent() {
return this.where.parent;
},
after() {
return this.where.after;
},
isObjectiveGroup() {
return this.parent && this.parent.__typename === 'ObjectiveGroupNode';
},
slug() {
return this.$route.params.slug;
}
},
methods: {
addContent() {
if (this.parent && this.parent.__typename === 'ObjectiveGroupNode') {
if (this.isObjectiveGroup) {
this.$store.dispatch('addObjective', this.parent.id);
} else {
let route;
const slug = this.$route.params.slug;
if (this.after.id) {
if (this.after && this.after.id) {
route = {
name: CREATE_CONTENT_BLOCK_AFTER_PAGE,
params: {
after: this.after.id,
slug
slug: this.slug
}
};
} else {

View File

@ -51,7 +51,7 @@
</div>
<add-content-button
:parent="chapter"
:where="{parent: chapter}"
v-if="editMode"
/>

View File

@ -65,7 +65,7 @@
</div>
<add-content-button
:after="contentBlock"
:where="{after: contentBlock}"
v-if="canEditModule"
/>
</div>

View File

@ -58,7 +58,7 @@
</script>
<style scoped lang="scss">
@import "@/styles/_variables.scss";
@import "~styles/variables";
.document-form {
&__uploaded {

View File

@ -23,6 +23,7 @@
</ul>
<add-content-button
:parent="group"
:where="{parent: group}"
v-if="editMode"
/>
</div>