This commit is contained in:
2020-06-25 12:59:20 +00:00
parent a8f2972850
commit 6840586e76

View File

@@ -12,12 +12,16 @@
<v-container>
<v-row>
<v-col cols="12">
<v-text-field :label="$ay.t('Find')" required></v-text-field>
<v-text-field
v-model="find"
:label="$ay.t('Find')"
required
></v-text-field>
</v-col>
bind find and replace to fields so is sticky
add OK button bound method to do the replace
<v-col cols="12">
<v-text-field
v-model="replace"
:label="$ay.t('Replace')"
required
></v-text-field>
@@ -30,7 +34,7 @@
<v-btn color="blue darken-1" text @click="replaceDialog = false">{{
$ay.t("Cancel")
}}</v-btn>
<v-btn color="blue darken-1" text @click="replaceDialog = false">{{
<v-btn color="blue darken-1" text @click="doReplace()">{{
$ay.t("OK")
}}</v-btn>
</v-card-actions>
@@ -205,6 +209,8 @@ export default {
return {
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
search: "",
find: "",
replace: "",
replaceDialog: false,
editingActiveTranslation: false,
obj: {},
@@ -261,20 +267,21 @@ export default {
}
},
methods: {
doReplace() {
if (this.find && this.replace) {
// alert(`stub: find ${this.find} and replace ${this.replace}`);
//str.split(searchStr).join(replaceStr)
for (let i = 0; i < this.obj.translationItems.length; i++) {
this.obj.translationItems[i].display = this.obj.translationItems[
i
].display
.split(this.find)
.join(this.replace);
}
}
this.replaceDialog = false;
},
saveItem(updatedItem) {
// if (!updatedItem.display) {
// console.log("display empty setting to key");
// updatedItem.display = updatedItem.key;
// for (let i = 0; i < this.obj.translationItems.length; i++) {
// if (this.obj.translationItems[i].key == updatedItem.key) {
// this.obj.translationItems[i].display = this.obj.translationItems[
// i
// ].key;
// break;
// }
// }
// }
//just called to flag as dirty
window.$gz.form.setFormState({
vm: this,