Mercurial > gemma
changeset 2214:5a4b0c85e7a8 pdf-export
values in template select are now the actual objects
instead of just the name of the template. Therefore no need for a find by name in the templates array.
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Thu, 07 Feb 2019 10:38:17 +0100 |
parents | 9bf8562df42f |
children | 82867a69e10e |
files | client/src/components/Pdftool.vue |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/Pdftool.vue Wed Feb 06 16:32:16 2019 +0100 +++ b/client/src/components/Pdftool.vue Thu Feb 07 10:38:17 2019 +0100 @@ -23,7 +23,7 @@ > <option v-for="template in pdfTemplates" - :value="template.name" + :value="template" :key="template.name" > <translate>{{ template.name }}</translate> @@ -153,11 +153,10 @@ // When a template is chosen from the dropdown, its propoerties are // applied to the rest of the form. applyTemplateToForm() { - let template = this.pdfTemplates.find(t => t.name === this.form.template); - if (template) { - this.form.format = template.properties.format; - this.form.paperSize = template.properties.paperSize; - this.form.resolution = template.properties.resolution; + if (this.form.template) { + this.form.format = this.form.template.properties.format; + this.form.paperSize = this.form.template.properties.paperSize; + this.form.resolution = this.form.template.properties.resolution; } }, // If there's a template that matches all the form values, this template @@ -170,12 +169,13 @@ this.form.paperSize === t.properties.paperSize && this.form.resolution === t.properties.resolution ) { - this.form.template = t.name; + this.form.template = t; } }); }, download() { - let template = this.pdfTemplates.find(t => t.name === this.form.template); + let template = this.form.template; + // disable button while working on it this.readyToGenerate = false; @@ -533,7 +533,7 @@ }, mounted() { this.$store.dispatch("application/loadPdfTemplates").then(() => { - this.form.template = this.pdfTemplates[0].name; + this.form.template = this.pdfTemplates[0]; }); } };