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>
|
<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>
|
</content-block>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -19,6 +19,13 @@
|
||||||
components: {
|
components: {
|
||||||
ContentBlock,
|
ContentBlock,
|
||||||
AddContentBlockButton
|
AddContentBlockButton
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
shouldBeVisible(contentBlock, userGroup) {
|
||||||
|
const userGroups = contentBlock.hiddenFor.map(entry => entry.id)
|
||||||
|
return !userGroups.includes(userGroup)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,14 @@ query ModulesQuery($slug: String!) {
|
||||||
title
|
title
|
||||||
type
|
type
|
||||||
contents
|
contents
|
||||||
|
hiddenFor {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue