entite image is now editable, add, delete. remains the alt field

This commit is contained in:
2024-03-19 15:33:40 +01:00
parent d4797e75dc
commit e9b6b90816
8 changed files with 235 additions and 40 deletions

View File

@@ -3,15 +3,17 @@
import REST from '@api/rest-axios'
import { mapActions, mapState } from 'pinia'
import { ConcernementsStore } from '@stores/concernements'
import { UserStore } from '@stores/user'
export default {
props: {
checked: Boolean,
label: String,
data: Object
},
// emits: ['returned'],
emits: ['updated'],
data(){
return {
@@ -21,12 +23,13 @@ export default {
...mapState(UserStore,['csrf_token']),
},
created () {
console.log('ContentEditable created');
console.log('CheckboxEditable created');
},
mounted () {
},
methods: {
...mapActions(ConcernementsStore, ['reloadConcernements']),
onInput(e){
// console.log('onInput checkbox e', e);
let checked = e.target.checked;
@@ -47,6 +50,8 @@ export default {
.then(({ data }) => {
console.log('user REST post node data', data)
// TODO if success update the data in pinia
// this.reloadConcernements();
this.$emit('updated');
})
.catch(error => {
console.warn(`Issue with patch node ${this.data.bundle}`, error)
@@ -59,6 +64,6 @@ export default {
<template>
<section class="editable">
<label><input type="checkbox" @input="onInput"> {{ label }}</label>
<label><input type="checkbox" :checked="checked" @input="onInput"> {{ label }}</label>
</section>
</template>