remove refs

This commit is contained in:
Oleg Zharkov
2021-06-02 20:24:10 +02:00
parent a664b9d8f1
commit 275cc67562
2 changed files with 16 additions and 4 deletions
@@ -65,6 +65,7 @@
:is-expanded="item.isExpanded"
:is-edit-mode="item.editMode"
:text="item.description"
:changed-value.sync="item[newDescriptionProperty]"
/>
</template>
<template v-slot:cell(synopsis)="{ item }">
@@ -74,6 +75,7 @@
:is-expanded="item.isExpanded"
:is-edit-mode="item.editMode"
:text="item.synopsis"
:changed-value.sync="item[newSynopsisProperty]"
/>
</template>
<template v-slot:cell(is_unrestricted)="row">
@@ -207,6 +209,8 @@ export default {
data() {
const galaxy = getGalaxyInstance();
return {
newDescriptionProperty: "newDescription",
newSynopsisProperty: "newSynopsis",
isNewLibFormVisible: false,
currentPage: 1,
fields: fields,
@@ -244,8 +248,14 @@ export default {
this.$refs.libraries_list.refresh();
},
saveChanges(item) {
item.description = this.$refs[`description-${item.id}`].textField;
item.synopsis = this.$refs[`synopsis-${item.id}`].textField;
const description = item[this.newDescriptionProperty];
const synopsis = item[this.newSynopsisProperty];
if (description) {
item.description = description;
}
if (synopsis) {
item.synopsis = synopsis;
}
this.services.saveChanges(
item,
() => {
@@ -45,6 +45,9 @@ export default {
text: {
type: String,
},
changedValue: {
type: String,
},
isEditMode: {
type: Boolean,
},
@@ -55,12 +58,11 @@ export default {
data() {
return {
maxDescriptionLength: MAX_DESCRIPTION_LENGTH,
textField: this.text,
};
},
methods: {
updateValue(value) {
this.textField = value;
this.$emit('update:changedValue', value)
},
toggleDescriptionExpand() {
this.$emit("toggleDescriptionExpand");