Add computed property for permission check

This commit is contained in:
Christian Cueni 2019-08-26 14:49:05 +02:00
parent 046599af81
commit a9de457e35
1 changed files with 10 additions and 8 deletions

View File

@ -10,7 +10,7 @@
</div>
<div class="content-block__visibility">
<visibility-action
v-if="!contentBlock.indent && editModule"
v-if="canEditModule"
:block="contentBlock"></visibility-action>
</div>
@ -25,8 +25,7 @@
</div>
<add-content-button :after="contentBlock"
v-if="!contentBlock.indent && editModule"></add-content-button>
<add-content-button :after="contentBlock" v-if="canEditModule"></add-content-button>
</div>
@ -104,16 +103,19 @@
computed: {
...mapGetters(['editModule']),
canEditModule() {
return !this.contentBlock.indent && this.editModule;
},
specialClass() {
return `content-block--${this.contentBlock.type.toLowerCase()}`
return `content-block--${this.contentBlock.type.toLowerCase()}`;
},
instrumentLabel() {
const contentType = this.contentBlock.type.toLowerCase()
const contentType = this.contentBlock.type.toLowerCase();
if (!(contentType in instruments)) {
return ''
return '';
}
return `Instrument - ${instruments[contentType]}`
return `Instrument - ${instruments[contentType]}`;
},
canEditContentBlock() {
return this.contentBlock.mine && !this.contentBlock.indent;
@ -159,7 +161,7 @@
contentList = [];
return newContents;
} else {
return [...newContents, content]
return [...newContents, content];
}
}
}, []);