diff --git a/client/cypress/integration/frontend/instruments/module-page.spec.js b/client/cypress/integration/frontend/instruments/module-page.spec.js
index a2594cfc..c858ed41 100644
--- a/client/cypress/integration/frontend/instruments/module-page.spec.js
+++ b/client/cypress/integration/frontend/instruments/module-page.spec.js
@@ -26,7 +26,11 @@ describe('Instruments on Module page', () => {
title: 'Some Chapter',
contentBlocks: [
{
- 'type': 'base_communication',
+ 'type': 'instrument',
+ instrumentCategory: {
+ id: 'category-id',
+ name: 'Sprache & Kommunikation'
+ },
'title': 'Das Interview',
'contents': [
{
@@ -40,6 +44,7 @@ describe('Instruments on Module page', () => {
{
'type': 'normal',
'title': 'Normaler Block',
+ instrumentCategory: null,
'contents': [
{
type: 'text_block',
diff --git a/client/src/components/ContentBlock.vue b/client/src/components/ContentBlock.vue
index 98ce4c37..77cd254f 100644
--- a/client/src/components/ContentBlock.vue
+++ b/client/src/components/ContentBlock.vue
@@ -5,6 +5,7 @@
>
@@ -43,6 +44,7 @@
{{ instrumentLabel }}
@@ -129,13 +131,37 @@
specialClass() {
return `content-block--${this.contentBlock.type.toLowerCase()}`;
},
+ isInstrumentBlock() {
+ return !!this.contentBlock.instrumentCategory;
+ },
+ // todo: use dynamic css class with v-bind once we're on Vue 3: https://vuejs.org/api/sfc-css-features.html#v-bind-in-css
+ instrumentStyle() {
+ if (this.isInstrumentBlock) {
+ return {
+ backgroundColor: this.contentBlock.instrumentCategory.background
+ };
+ }
+ return {};
+ },
instrumentLabel() {
const contentType = this.contentBlock.type.toLowerCase();
- if (contentType.startsWith('base')) { // all instruments start with `base`
+ if (contentType.startsWith('base')) { // all legacy instruments start with `base`
return instrumentCategory(contentType);
}
+ if (this.isInstrumentBlock) {
+ return instrumentCategory(this.contentBlock.instrumentCategory.name);
+ }
return '';
},
+ // todo: use dynamic css class with v-bind once we're on Vue 3: https://vuejs.org/api/sfc-css-features.html#v-bind-in-css
+ instrumentLabelStyle() {
+ if (this.isInstrumentBlock) {
+ return {
+ color: this.contentBlock.instrumentCategory.foreground
+ };
+ }
+ return {};
+ },
canEditContentBlock() {
return this.contentBlock.mine && !this.contentBlock.indent;
},
@@ -316,6 +342,10 @@
}
}
+ &--instrument {
+ @include content-box-base;
+ }
+
/deep/ p {
line-height: 1.5;
margin-bottom: 1em;
diff --git a/client/src/components/content-blocks/InstrumentWidget.vue b/client/src/components/content-blocks/InstrumentWidget.vue
index 85c1e684..f199d9d9 100644
--- a/client/src/components/content-blocks/InstrumentWidget.vue
+++ b/client/src/components/content-blocks/InstrumentWidget.vue
@@ -8,6 +8,9 @@
{{ $flavor.textInstrument }} anzeigen
@@ -15,6 +18,7 @@