Hide element types depending on feature set
This commit is contained in:
parent
3b3d485c76
commit
0060889a63
|
|
@ -14,6 +14,7 @@
|
||||||
:checked="localContentBlock.isAssignment"
|
:checked="localContentBlock.isAssignment"
|
||||||
class="content-block-form__task-toggle"
|
class="content-block-form__task-toggle"
|
||||||
label="Inhaltsblock als Auftrag formatieren"
|
label="Inhaltsblock als Auftrag formatieren"
|
||||||
|
v-if="hasDefaultFeatures"
|
||||||
@input="localContentBlock.isAssignment=$event"
|
@input="localContentBlock.isAssignment=$event"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
@ -139,8 +140,12 @@
|
||||||
import {CHOOSER, transformInnerContents} from '@/components/content-block-form/helpers.js';
|
import {CHOOSER, transformInnerContents} from '@/components/content-block-form/helpers.js';
|
||||||
import ContentElementActions from '@/components/content-block-form/ContentElementActions.vue';
|
import ContentElementActions from '@/components/content-block-form/ContentElementActions.vue';
|
||||||
import {ContentBlock, numberOrUndefined} from "@/@types";
|
import {ContentBlock, numberOrUndefined} from "@/@types";
|
||||||
|
import {DEFAULT_FEATURES} from "@/consts/features.consts";
|
||||||
|
|
||||||
// TODO: refactor this file, it's huuuuuge!
|
// TODO: refactor this file, it's huuuuuge!
|
||||||
|
interface ContentBlockFormData {
|
||||||
|
localContentBlock: any;
|
||||||
|
}
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: {
|
props: {
|
||||||
|
|
@ -152,6 +157,15 @@
|
||||||
type: Object as PropType<ContentBlock>,
|
type: Object as PropType<ContentBlock>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
features: {
|
||||||
|
type: String,
|
||||||
|
default: DEFAULT_FEATURES
|
||||||
|
}
|
||||||
|
},
|
||||||
|
provide(): object {
|
||||||
|
return {
|
||||||
|
features: this.features
|
||||||
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
ContentElementActions,
|
ContentElementActions,
|
||||||
|
|
@ -161,7 +175,7 @@
|
||||||
ContentFormSection,
|
ContentFormSection,
|
||||||
Toggle,
|
Toggle,
|
||||||
},
|
},
|
||||||
data() {
|
data(): ContentBlockFormData {
|
||||||
return {
|
return {
|
||||||
localContentBlock: Object.assign({}, {
|
localContentBlock: Object.assign({}, {
|
||||||
title: this.contentBlock.title,
|
title: this.contentBlock.title,
|
||||||
|
|
@ -176,6 +190,9 @@
|
||||||
isValid(): boolean {
|
isValid(): boolean {
|
||||||
return this.localContentBlock.title > '';
|
return this.localContentBlock.title > '';
|
||||||
},
|
},
|
||||||
|
hasDefaultFeatures(): boolean {
|
||||||
|
return this.features === DEFAULT_FEATURES;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
update(index: number, element: any, parent?: number) {
|
update(index: number, element: any, parent?: number) {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
Neuer Inhalt
|
Neuer Inhalt
|
||||||
</h3>
|
</h3>
|
||||||
<template
|
<template
|
||||||
v-if="includeListOption"
|
v-if="includeListOption && hasDefaultFeatures"
|
||||||
>
|
>
|
||||||
<checkbox
|
<checkbox
|
||||||
class="content-block-element-chooser-widget__list-toggle"
|
class="content-block-element-chooser-widget__list-toggle"
|
||||||
|
|
@ -46,6 +46,8 @@
|
||||||
import formElementIcons from '@/components/ui/form-element-icons';
|
import formElementIcons from '@/components/ui/form-element-icons';
|
||||||
import CrossIcon from '@/components/icons/CrossIcon';
|
import CrossIcon from '@/components/icons/CrossIcon';
|
||||||
import ChooserElement from '@/components/content-forms/ChooserElement';
|
import ChooserElement from '@/components/content-forms/ChooserElement';
|
||||||
|
import {DEFAULT_FEATURES} from '@/consts/features.consts';
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
|
@ -61,6 +63,8 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
inject: ['features'],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
ChooserElement,
|
ChooserElement,
|
||||||
CrossIcon,
|
CrossIcon,
|
||||||
|
|
@ -69,6 +73,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
const hasDefaultFeatures = this.features === DEFAULT_FEATURES;
|
||||||
return {
|
return {
|
||||||
convertToList: false,
|
convertToList: false,
|
||||||
chooserTypes: [
|
chooserTypes: [
|
||||||
|
|
@ -77,6 +82,7 @@
|
||||||
block: 'subtitle',
|
block: 'subtitle',
|
||||||
title: 'Untertitel',
|
title: 'Untertitel',
|
||||||
icon: 'title-icon',
|
icon: 'title-icon',
|
||||||
|
show: hasDefaultFeatures
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'link',
|
type: 'link',
|
||||||
|
|
@ -102,11 +108,13 @@
|
||||||
block: 'assignment',
|
block: 'assignment',
|
||||||
icon: 'speech-bubble-icon',
|
icon: 'speech-bubble-icon',
|
||||||
title: 'Aufgabe & Ergebnis',
|
title: 'Aufgabe & Ergebnis',
|
||||||
|
show: !this.hideAssignment && hasDefaultFeatures
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'document',
|
type: 'document',
|
||||||
block: 'document_block',
|
block: 'document_block',
|
||||||
title: 'Dokument',
|
title: 'Dokument',
|
||||||
|
show: hasDefaultFeatures
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -118,6 +126,9 @@
|
||||||
filteredChooserTypes() {
|
filteredChooserTypes() {
|
||||||
return this.chooserTypes.filter(type => !("show" in type) || type.show ); // display element if `show` is not set or if `show` evaluates to true
|
return this.chooserTypes.filter(type => !("show" in type) || type.show ); // display element if `show` is not set or if `show` evaluates to true
|
||||||
},
|
},
|
||||||
|
hasDefaultFeatures() {
|
||||||
|
return this.features === DEFAULT_FEATURES;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
export const DEFAULT_FEATURES = 'default';
|
||||||
|
export const ROOMS_FEATURES = 'rooms';
|
||||||
Loading…
Reference in New Issue