stash
This commit is contained in:
parent
d234b73e6f
commit
3ebe51645a
1 changed files with 18 additions and 4 deletions
|
@ -1,10 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<h3 class="text-center">Message Templates</h3>
|
<h3 class="text-center">Message Templates</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="template in messageTemplates" :key="template.id">
|
<li v-for="[template, index] in localChanges" :key="template.id">
|
||||||
<b>{{ template.name }}</b><br>
|
<b>{{ template.name }}</b><br>
|
||||||
<FormatedText :value="template.message" :format="formatText" class="template-message"
|
<FormatedText :value="template.message" :format="formatText" class="template-message"
|
||||||
@input="changeMessageTemplate(template.id, $event)"/>
|
@input="changeMessageTemplate(template.id, $event)"/><br>
|
||||||
|
<button class="btn btn-primary"
|
||||||
|
:disabled="template.message !== messageTemplates[index].message">Reset
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-success"
|
||||||
|
:disabled="template.message !== messageTemplates[index].message">Save
|
||||||
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h3 class="text-center">Message Template Variables</h3>
|
<h3 class="text-center">Message Template Variables</h3>
|
||||||
|
@ -23,6 +29,11 @@ import FormatedText from "@/components/inputs/FormatedText.vue";
|
||||||
export default {
|
export default {
|
||||||
name: 'Settings',
|
name: 'Settings',
|
||||||
components: {FormatedText, Table},
|
components: {FormatedText, Table},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
localChanges: []
|
||||||
|
};
|
||||||
|
},
|
||||||
computed: mapState(['messageTemplates', 'messageTemplateVariables']),
|
computed: mapState(['messageTemplates', 'messageTemplateVariables']),
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['fetchMessageTemplates', 'fetchMessageTemplateVariables']),
|
...mapActions(['fetchMessageTemplates', 'fetchMessageTemplateVariables']),
|
||||||
|
@ -33,7 +44,7 @@ export default {
|
||||||
},
|
},
|
||||||
changeMessageTemplate(id, message) {
|
changeMessageTemplate(id, message) {
|
||||||
console.log(id, message);
|
console.log(id, message);
|
||||||
this.messageTemplates.forEach(template => {
|
this.localChanges.forEach(template => {
|
||||||
if (template.id === id) {
|
if (template.id === id) {
|
||||||
template.message = message;
|
template.message = message;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +54,9 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchMessageTemplates();
|
this.fetchMessageTemplates();
|
||||||
this.fetchMessageTemplateVariables();
|
this.fetchMessageTemplateVariables();
|
||||||
|
this.localChanges = this.messageTemplates.map(template => {
|
||||||
|
return {id: template.id, message: template.message, name: template.name};
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -56,7 +70,7 @@ pre {
|
||||||
|
|
||||||
.template-message {
|
.template-message {
|
||||||
border: none;
|
border: none;
|
||||||
margin-left: 8em;
|
margin-left: 4em;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue