Fix instrument label bug
This commit is contained in:
parent
7a090cfced
commit
328a34d6d0
|
|
@ -91,12 +91,6 @@
|
|||
|
||||
const ContentComponent = () => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/ContentComponent');
|
||||
|
||||
const instruments = {
|
||||
base_communication: 'Sprache & Kommunikation',
|
||||
base_society: 'Gesellschaft',
|
||||
base_interdisciplinary: 'Überfachliches Instrument',
|
||||
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'ContentBlock',
|
||||
|
|
@ -135,10 +129,7 @@
|
|||
},
|
||||
instrumentLabel() {
|
||||
const contentType = this.contentBlock.type.toLowerCase();
|
||||
if (!(contentType in instruments)) {
|
||||
return '';
|
||||
}
|
||||
return instrumentCategory(this.instrument);
|
||||
return instrumentCategory(contentType);
|
||||
},
|
||||
canEditContentBlock() {
|
||||
return this.contentBlock.mine && !this.contentBlock.indent;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,18 @@
|
|||
export const LANGUAGE_COMMUNICATION = 'LANGUAGE_COMMUNICATION';
|
||||
export const LANGUAGE_COMMUNICATION_BASE = 'base_communication';
|
||||
export const LANGUAGE_COMMUNICATION_VALUE = 'Sprache & Kommunikation';
|
||||
export const SOCIETY = 'SOCIETY';
|
||||
export const SOCIETY_BASE = 'base_society';
|
||||
export const SOCIETY_VALUE = 'Gesellschaft';
|
||||
export const INTERDISCIPLINARY = 'INTERDISCIPLINARY';
|
||||
export const INTERDISCIPLINARY_BASE = 'base_interdisciplinary';
|
||||
export const INTERDISCIPLINARY_VALUE = 'Überfachliches Instrument';
|
||||
|
||||
export const typeDictionary = {
|
||||
[LANGUAGE_COMMUNICATION]: LANGUAGE_COMMUNICATION_VALUE,
|
||||
[LANGUAGE_COMMUNICATION_BASE]: LANGUAGE_COMMUNICATION_VALUE,
|
||||
[SOCIETY]: SOCIETY_VALUE,
|
||||
[SOCIETY_BASE]: SOCIETY_VALUE,
|
||||
[INTERDISCIPLINARY]: INTERDISCIPLINARY_VALUE,
|
||||
[INTERDISCIPLINARY_BASE]: INTERDISCIPLINARY_VALUE,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,23 +1,22 @@
|
|||
import {LANGUAGE_COMMUNICATION, SOCIETY} from '@/consts/instrument.consts';
|
||||
import {typeDictionary} from '@/consts/instrument.consts';
|
||||
import flavor from '@/helpers/app-flavor';
|
||||
|
||||
const instrumentType = ({type: {category}}) => {
|
||||
if (category === LANGUAGE_COMMUNICATION) {
|
||||
return 'Sprache & Kommunikation';
|
||||
} else if (category === SOCIETY) {
|
||||
return 'Gesellschaft';
|
||||
const instrumentType = (instrument) => {
|
||||
let category;
|
||||
if (typeof instrument === 'string') {
|
||||
category = instrument;
|
||||
} else {
|
||||
return 'Überfachliches Instrument';
|
||||
category = instrument.type.category;
|
||||
}
|
||||
return typeDictionary[category] || '';
|
||||
};
|
||||
|
||||
const instrumentCategory = (instrument) => {
|
||||
if (flavor.appFlavor === 'my-kv') {
|
||||
return flavor.textInstruments;
|
||||
} else {
|
||||
return instrumentType(instrument);
|
||||
return `${flavor.textInstruments} - ${instrumentType(instrument)}`;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export default instrumentType;
|
||||
|
|
|
|||
Loading…
Reference in New Issue