Implement filtering of ContentBlocks
This commit is contained in:
parent
4a964b3e81
commit
2db6464f8d
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<add-content-block-button :parent="chapter.id"></add-content-block-button>
|
||||
|
||||
<content-block :contentBlock="contentBlock" :key="contentBlock.id" v-for="contentBlock in chapter.contentBlocks">
|
||||
<content-block v-if="shouldBeVisible(contentBlock, 'VXNlckdyb3VwTm9kZTo2')" :contentBlock="contentBlock" :key="contentBlock.id" v-for="contentBlock in chapter.contentBlocks">
|
||||
</content-block>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -19,6 +19,13 @@
|
|||
components: {
|
||||
ContentBlock,
|
||||
AddContentBlockButton
|
||||
},
|
||||
|
||||
methods: {
|
||||
shouldBeVisible(contentBlock, userGroup) {
|
||||
const userGroups = contentBlock.hiddenFor.map(entry => entry.id)
|
||||
return !userGroups.includes(userGroup)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -37,6 +37,14 @@ query ModulesQuery($slug: String!) {
|
|||
title
|
||||
type
|
||||
contents
|
||||
hiddenFor {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue