Add button for removal of chooser widget

This commit is contained in:
Ramon Wenger 2022-02-17 12:36:29 +01:00
parent 10dc8361ff
commit c6b1117778
9 changed files with 55 additions and 28 deletions

View File

@ -30,7 +30,7 @@
</template> </template>
<script> <script>
const Cross = () => import(/* webpackChunkName: "icons" */'@/components/icons/Cross'); const Cross = () => import(/* webpackChunkName: "icons" */'@/components/icons/CrossIcon');
export default { export default {
props: { props: {

View File

@ -24,7 +24,7 @@
import sidebarMixin from '@/mixins/sidebar'; import sidebarMixin from '@/mixins/sidebar';
const Cross = () => import(/* webpackChunkName: "icons" */'@/components/icons/Cross'); const Cross = () => import(/* webpackChunkName: "icons" */'@/components/icons/CrossIcon');
export default { export default {
mixins: [sidebarMixin], mixins: [sidebarMixin],

View File

@ -63,7 +63,7 @@
:element="content" :element="content"
class="content-block-form__segment" class="content-block-form__segment"
@update="update(index, $event, outer)" @update="update(index, $event, outer)"
@remove="remove(outer, index)" @remove="remove(outer, index, $event)"
@up="up(outer, index)" @up="up(outer, index)"
@down="down(outer, index)" @down="down(outer, index)"
@top="top(outer, index)" @top="top(outer, index)"
@ -83,7 +83,7 @@
class="content-block-form__segment" class="content-block-form__segment"
v-else v-else
@update="update(outer, $event)" @update="update(outer, $event)"
@remove="remove(outer)" @remove="remove(outer, undefined, $event)"
@up="up(outer)" @up="up(outer)"
@down="down(outer)" @down="down(outer)"
@top="top(outer)" @top="top(outer)"
@ -220,14 +220,18 @@
]; ];
} }
}, },
remove(outer, inner) { remove(outer, inner, askForConfirmation = true) {
this.$modal.open('confirm') if(askForConfirmation) {
.then(() => { this.$modal.open('confirm')
this.executeRemoval(outer, inner); .then(() => {
}) this.executeRemoval(outer, inner);
.catch(() => { })
.catch(() => {
}); });
} else {
this.executeRemoval(outer, inner);
}
}, },
shift(outer, inner, distance) { shift(outer, inner, distance) {
if (inner === undefined) { if (inner === undefined) {

View File

@ -6,6 +6,7 @@
v-bind="element" v-bind="element"
v-if="isChooser" v-if="isChooser"
@change-type="changeType" @change-type="changeType"
@remove="$emit('remove', false)"
/> />
<!-- Content Forms --> <!-- Content Forms -->
<content-form-section <content-form-section
@ -159,9 +160,6 @@
}, },
}); });
}, },
debug(arg) {
console.log(arg);
},
changeUrl(value) { changeUrl(value) {
this._updateProperty(value, 'url'); this._updateProperty(value, 'url');
}, },

View File

@ -1,14 +1,21 @@
<template> <template>
<div class="content-block-element-chooser-widget__wrapper"> <div class="content-block-element-chooser-widget__wrapper">
<button
class="content-block-element-chooser-widget__remove-button icon-button"
@click="remove"
>
<cross-icon class="icon-button__icon" />
</button>
<h3 class="content-block-element-chooser-widget__heading">
Neuer Inhalt
</h3>
<template <template
v-if="includeListOption" v-if="includeListOption"
> >
<h3 class="content-block-element-chooser-widget__heading">
Neuer Inhalt
</h3>
<checkbox <checkbox
class="content-block-element-chooser-widget__list-toggle" class="content-block-element-chooser-widget__list-toggle"
:checked="convertToList" :checked="convertToList"
data-cy="convert-to-list-checkbox"
label="Neues Aufzählungszeichen hinzufügen" label="Neues Aufzählungszeichen hinzufügen"
@input="convertToList=$event" @input="convertToList=$event"
/> />
@ -98,6 +105,7 @@
import formElementIcons from '@/components/ui/form-element-icons'; import formElementIcons from '@/components/ui/form-element-icons';
import TitleIcon from '@/components/icons/TitleIcon'; import TitleIcon from '@/components/icons/TitleIcon';
import CrossIcon from '@/components/icons/CrossIcon';
export default { export default {
props: { props: {
@ -105,30 +113,34 @@
index: {}, index: {},
hideAssignment: { hideAssignment: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
includeListOption: { includeListOption: {
type: Boolean, type: Boolean,
default: false default: false,
} },
}, },
components: { components: {
CrossIcon,
TitleIcon, TitleIcon,
Checkbox, Checkbox,
...formElementIcons ...formElementIcons,
}, },
data: () => ({ data: () => ({
convertToList: false convertToList: false,
}), }),
methods: { methods: {
changeType(type) { changeType(type) {
this.$emit('change-type', { this.$emit('change-type', {
type, type,
convertToList: this.convertToList convertToList: this.convertToList,
}); });
},
remove() {
this.$emit('remove');
} }
}, },
}; };
@ -148,10 +160,11 @@
grid-column-gap: 0px; grid-column-gap: 0px;
font-family: $sans-serif-font-family; font-family: $sans-serif-font-family;
text-align: center; text-align: center;
//border: 2px solid $color-silver-dark;
//border-radius: 12px;
position: relative; position: relative;
// grid position in wrapper element
grid-column: 1 / span 2;
/*IE10+*/ /*IE10+*/
& > :nth-child(1) { & > :nth-child(1) {
-ms-grid-column: 1; -ms-grid-column: 1;
@ -182,13 +195,25 @@
-ms-grid-columns: 1fr 1fr 1fr 1fr 1fr; -ms-grid-columns: 1fr 1fr 1fr 1fr 1fr;
} }
&__wrapper {
display: grid;
grid-template-columns: 1fr 50px;
}
&__remove-button {
grid-column: 2;
}
&__heading { &__heading {
@include heading-4; @include heading-4;
margin-bottom: $medium-spacing; margin-bottom: $medium-spacing;
grid-column: 1;
grid-row: 1;
} }
&__list-toggle { &__list-toggle {
margin-bottom: $medium-spacing; margin-bottom: $medium-spacing;
grid-column: 1;
} }
&__link { &__link {

View File

@ -84,7 +84,7 @@
import me from '@/mixins/me'; import me from '@/mixins/me';
import LogoutWidget from '@/components/LogoutWidget'; import LogoutWidget from '@/components/LogoutWidget';
import {MY_TEAM} from '@/router/me.names'; import {MY_TEAM} from '@/router/me.names';
const Cross = () => import(/* webpackChunkName: "icons" */'@/components/icons/Cross'); const Cross = () => import(/* webpackChunkName: "icons" */'@/components/icons/CrossIcon');
export default { export default {

View File

@ -15,7 +15,7 @@
</template> </template>
<script> <script>
const Cross = () => import(/* webpackChunkName: "icons" */'@/components/icons/Cross'); const Cross = () => import(/* webpackChunkName: "icons" */'@/components/icons/CrossIcon');
export default { export default {
components: { components: {

View File

@ -20,7 +20,7 @@
<script> <script>
import SimpleFooter from '@/layouts/SimpleFooter'; import SimpleFooter from '@/layouts/SimpleFooter';
import enableFooter from '@/helpers/footer'; import enableFooter from '@/helpers/footer';
const Cross = () => import(/* webpackChunkName: "icons" */'@/components/icons/Cross'); const Cross = () => import(/* webpackChunkName: "icons" */'@/components/icons/CrossIcon');
export default { export default {
components: { components: {