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