Refactor contents form modal and add new component for room entries
This commit is contained in:
parent
1aec0662f4
commit
1ef4c6d8e1
|
|
@ -11,6 +11,7 @@
|
||||||
import Modal from '@/components/Modal';
|
import Modal from '@/components/Modal';
|
||||||
import NewContentBlockWizard from '@/components/content-block-form/NewContentBlockWizard';
|
import NewContentBlockWizard from '@/components/content-block-form/NewContentBlockWizard';
|
||||||
import EditContentBlockWizard from '@/components/content-block-form/EditContentBlockWizard';
|
import EditContentBlockWizard from '@/components/content-block-form/EditContentBlockWizard';
|
||||||
|
import NewRoomEntryWizard from '@/components/rooms/room-entries/NewRoomEntryWizard';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
|
|
@ -20,7 +21,8 @@
|
||||||
SimpleLayout,
|
SimpleLayout,
|
||||||
Modal,
|
Modal,
|
||||||
NewContentBlockWizard,
|
NewContentBlockWizard,
|
||||||
EditContentBlockWizard
|
EditContentBlockWizard,
|
||||||
|
NewRoomEntryWizard
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="content-block-title-input">
|
<div class="modal-input">
|
||||||
<input placeholder="Titel für Inhaltsblock erfassen"
|
<input :placeholder="placeholder"
|
||||||
class="content-block-title-input__inputfield skillbox-input"
|
class="modal-input__inputfield skillbox-input"
|
||||||
:class="{'skillbox-input--error': error}"
|
:class="{'skillbox-input--error': error}"
|
||||||
:value="title"
|
:value="value"
|
||||||
v-on:input="$emit('update-title', $event.target.value)">
|
v-on:input="$emit('input', $event.target.value)">
|
||||||
<div class="content-block-title-input__error" v-if="error">
|
<div class="modal-input__error" v-if="error">
|
||||||
Für Inhaltsblöcke muss zwingend ein Titel erfasst werden.
|
Für Inhaltsblöcke muss zwingend ein Titel erfasst werden.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: ['title', 'error']
|
props: ['value', 'error', 'placeholder']
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
@import "@/styles/_variables.scss";
|
@import "@/styles/_variables.scss";
|
||||||
@import "@/styles/_functions.scss";
|
@import "@/styles/_functions.scss";
|
||||||
|
|
||||||
.content-block-title-input {
|
.modal-input {
|
||||||
&__inputfield {
|
&__inputfield {
|
||||||
width: $modal-input-width;
|
width: $modal-input-width;
|
||||||
}
|
}
|
||||||
|
|
@ -1,16 +1,25 @@
|
||||||
<template>
|
<template>
|
||||||
<modal>
|
<modal>
|
||||||
<content-block-title-input slot="header" v-on:update-title="updateTitle" :title="localContentBlock.title"
|
<template slot="header">
|
||||||
:error="error"></content-block-title-input>
|
<modal-input v-on:input="updateTitle"
|
||||||
<add-content-element class="content-block-form__add"
|
:placeholder="titlePlaceholder"
|
||||||
|
:value="localContentBlock.title"
|
||||||
|
:error="error"></modal-input>
|
||||||
|
|
||||||
|
<modal-input v-if="blockType === 'RoomEntry'"
|
||||||
|
placeholder="Untertitel für Raumeintrag erfassen"
|
||||||
|
v-model="localContentBlock.subtitle"></modal-input>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<add-content-element class="contents-form__add"
|
||||||
v-on:add-element="addElement"
|
v-on:add-element="addElement"
|
||||||
:index="-1"
|
:index="-1"
|
||||||
></add-content-element>
|
></add-content-element>
|
||||||
<div v-for="(element, index) in localContentBlock.contents" :key="index" class="content-block-form__element">
|
<div v-for="(element, index) in localContentBlock.contents" :key="index" class="contents-form__element">
|
||||||
<component
|
<component
|
||||||
class="content-block-form__element-component"
|
class="contents-form__element-component"
|
||||||
:is="type(element)"
|
:is="type(element)"
|
||||||
:class="{'content-block-form__chooser': type(element) === 'content-block-element-chooser-widget'}"
|
:class="{'contents-form__chooser': type(element) === 'content-block-element-chooser-widget'}"
|
||||||
:element="element" v-bind="element" :index="index"
|
:element="element" v-bind="element" :index="index"
|
||||||
v-on:change-type="changeType"
|
v-on:change-type="changeType"
|
||||||
v-on:link-change-url="changeLinkUrl"
|
v-on:link-change-url="changeLinkUrl"
|
||||||
|
|
@ -20,12 +29,12 @@
|
||||||
v-on:image-change-url="changeImageUrl"
|
v-on:image-change-url="changeImageUrl"
|
||||||
v-on:video-change-url="changeVideoUrl">
|
v-on:video-change-url="changeVideoUrl">
|
||||||
</component>
|
</component>
|
||||||
<a class="content-block-form__remove" v-on:click="removeElement(index)">
|
<a class="contents-form__remove" v-on:click="removeElement(index)">
|
||||||
<trash-icon v-if="type(element) !== 'content-block-element-chooser-widget'"
|
<trash-icon v-if="type(element) !== 'content-block-element-chooser-widget'"
|
||||||
class="content-block-form__trash-icon"></trash-icon>
|
class="contents-form__trash-icon"></trash-icon>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<add-content-element class="content-block-form__add"
|
<add-content-element class="contents-form__add"
|
||||||
v-on:add-element="addElement"
|
v-on:add-element="addElement"
|
||||||
:index="index"
|
:index="index"
|
||||||
></add-content-element>
|
></add-content-element>
|
||||||
|
|
@ -41,7 +50,7 @@
|
||||||
<script>
|
<script>
|
||||||
import Modal from '@/components/Modal';
|
import Modal from '@/components/Modal';
|
||||||
import ContentBlockElementChooserWidget from '@/components/content-forms/ContentBlockElementChooserWidget';
|
import ContentBlockElementChooserWidget from '@/components/content-forms/ContentBlockElementChooserWidget';
|
||||||
import ContentBlockTitleInput from '@/components/ContentBlockTitleInput';
|
import ModalInput from '@/components/ModalInput';
|
||||||
import AddContentElement from '@/components/AddContentElement';
|
import AddContentElement from '@/components/AddContentElement';
|
||||||
import LinkForm from '@/components/content-forms/LinkForm';
|
import LinkForm from '@/components/content-forms/LinkForm';
|
||||||
import VideoForm from '@/components/content-forms/VideoForm';
|
import VideoForm from '@/components/content-forms/VideoForm';
|
||||||
|
|
@ -52,12 +61,18 @@
|
||||||
import TrashIcon from '@/components/icons/TrashIcon';
|
import TrashIcon from '@/components/icons/TrashIcon';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['content-block'],
|
props: {
|
||||||
|
'content-block': Object,
|
||||||
|
'block-type': {
|
||||||
|
type: String,
|
||||||
|
default: 'ContentBlock'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
Modal,
|
Modal,
|
||||||
ContentBlockElementChooserWidget,
|
ContentBlockElementChooserWidget,
|
||||||
ContentBlockTitleInput,
|
ModalInput,
|
||||||
AddContentElement,
|
AddContentElement,
|
||||||
LinkForm,
|
LinkForm,
|
||||||
VideoForm,
|
VideoForm,
|
||||||
|
|
@ -74,11 +89,18 @@
|
||||||
localContentBlock: Object.assign({}, {
|
localContentBlock: Object.assign({}, {
|
||||||
title: this.contentBlock.title,
|
title: this.contentBlock.title,
|
||||||
contents: [...this.contentBlock.contents],
|
contents: [...this.contentBlock.contents],
|
||||||
id: this.contentBlock.id || undefined
|
id: this.contentBlock.id || undefined,
|
||||||
|
subtitle: this.contentBlock.subtitle
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
titlePlaceholder() {
|
||||||
|
return this.blockType === 'RoomEntry' ? 'Titel für Raumeintrag erfassen' : 'Titel für Inhaltsblock erfassen';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
type(element) {
|
type(element) {
|
||||||
switch (element.type) {
|
switch (element.type) {
|
||||||
|
|
@ -200,7 +222,7 @@
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "@/styles/_variables.scss";
|
@import "@/styles/_variables.scss";
|
||||||
|
|
||||||
.content-block-form {
|
.contents-form {
|
||||||
/* top level does not exist, because of the modal */
|
/* top level does not exist, because of the modal */
|
||||||
|
|
||||||
&__element {
|
&__element {
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<content-block-form
|
<contents-form
|
||||||
:content-block="contentBlock"
|
:content-block="contentBlock"
|
||||||
@save="saveContentBlock"
|
@save="saveContentBlock"
|
||||||
@hide="hideModal"
|
@hide="hideModal"
|
||||||
></content-block-form>
|
></contents-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ContentBlockForm from '@/components/content-block-form/ContentBlockForm';
|
import ContentsForm from '@/components/content-block-form/ContentsForm';
|
||||||
|
|
||||||
import store from '@/store/index';
|
import store from '@/store/index';
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ContentBlockForm
|
ContentsForm
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<content-block-form
|
<contents-form
|
||||||
:content-block="contentBlock"
|
:content-block="contentBlock"
|
||||||
@save="saveContentBlock"
|
@save="saveContentBlock"
|
||||||
@hide="hideModal"
|
@hide="hideModal"
|
||||||
></content-block-form>
|
></contents-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ContentBlockForm from '@/components/content-block-form/ContentBlockForm';
|
import ContentsForm from '@/components/content-block-form/ContentsForm';
|
||||||
|
|
||||||
import store from '@/store/index';
|
import store from '@/store/index';
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ContentBlockForm
|
ContentsForm
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<template>
|
||||||
|
<contents-form
|
||||||
|
:content-block="entry"
|
||||||
|
@save="saveEntry"
|
||||||
|
block-type="RoomEntry"
|
||||||
|
@hide="hideModal"
|
||||||
|
></contents-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ContentsForm from '@/components/content-block-form/ContentsForm';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
ContentsForm
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
entry: {
|
||||||
|
title: '',
|
||||||
|
subtitle: '',
|
||||||
|
contents: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
saveEntry(entry) {
|
||||||
|
console.log(entry);
|
||||||
|
},
|
||||||
|
hideModal() {
|
||||||
|
this.$store.dispatch('hideModal');
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue