stash
This commit is contained in:
parent
b3ff77a1fa
commit
0d231b0e65
2 changed files with 9 additions and 4 deletions
|
@ -1,6 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div contenteditable>
|
<div contenteditable>
|
||||||
<pre>{{ value }}</pre>
|
|
||||||
<span v-html="rawhtml(value)"></span>
|
<span v-html="rawhtml(value)"></span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
<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 in messageTemplates" :key="template.id">
|
||||||
{{ template.name }}<br>
|
|
||||||
<pre>{{ template.message }}</pre>
|
<pre>{{ template.message }}</pre>
|
||||||
<FormatedText :value="template.message"/>
|
<FormatedText :value="template.message" :format="formatText"/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h3 class="text-center">Message Template Variables</h3>
|
<h3 class="text-center">Message Template Variables</h3>
|
||||||
|
@ -24,7 +23,14 @@ export default {
|
||||||
name: 'Settings',
|
name: 'Settings',
|
||||||
components: {FormatedText, Table},
|
components: {FormatedText, Table},
|
||||||
computed: mapState(['messageTemplates', 'messageTemplateVariables']),
|
computed: mapState(['messageTemplates', 'messageTemplateVariables']),
|
||||||
methods: mapActions(['fetchMessageTemplates', 'fetchMessageTemplateVariables']),
|
methods: {
|
||||||
|
...mapActions(['fetchMessageTemplates', 'fetchMessageTemplateVariables']),
|
||||||
|
formatText(value) {
|
||||||
|
return value.replace(/{{(.*?)}}/g, (match, key) => {
|
||||||
|
return `<span class="text-primary">{{ ${key} }}</span>`;
|
||||||
|
}).replace(/\n/g, '<br>').replace(/\t/g, ' ');
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchMessageTemplates();
|
this.fetchMessageTemplates();
|
||||||
this.fetchMessageTemplateVariables();
|
this.fetchMessageTemplateVariables();
|
||||||
|
|
Loading…
Reference in a new issue