# HG changeset patch # User Fadi Abbud # Date 1572012763 -7200 # Node ID a2b5021de297c9f41b9950e5b15f0f9efc1a2816 # Parent d6d73ca5496acbde1a68dcf39641cb55dbed14f2 client: waterlevel: improve button style and downloaded file naming diff -r d6d73ca5496a -r a2b5021de297 client/src/components/gauge/Waterlevel.vue --- a/client/src/components/gauge/Waterlevel.vue Fri Oct 25 15:09:10 2019 +0200 +++ b/client/src/components/gauge/Waterlevel.vue Fri Oct 25 16:12:43 2019 +0200 @@ -60,7 +60,7 @@ { disabled: !waterlevels.length } ]" :href="csvLink" - :download="csvFileName" + :download="`${fileName}.csv`" > Export as CSV @@ -68,10 +68,10 @@ @click="downloadImage" id="downloadimage" :class="[ - 'btn btn-sm btn-info d-block w-100 mt-2', + 'btn btn-sm btn-info text-white d-block w-100 mt-2', { disabled: !waterlevels.length } ]" - :download="imageFilename" + :download="`${fileName}.png`" > Export as Image @@ -194,21 +194,10 @@ "data:text/csv;charset=utf-8," + encodeURIComponent(this.waterlevelsCSV) ); }, - imageFilename() { - return ( - this.downloadFilename( - this.$gettext("Waterlevel"), - this.selectedGauge.properties.objname - ) + ".png" - ); - }, - csvFileName() { - if (!this.dateFromD || !this.dateToD) return ""; - return ( - this.downloadFilename( - this.$gettext("Waterlevel"), - this.selectedGauge.properties.objname - ) + ".csv" + fileName() { + return this.downloadFilename( + this.$gettext("Waterlevel"), + this.selectedGauge.properties.objname ); }, hasPredictions() { @@ -241,7 +230,6 @@ : "DEFAULT" ); }, - downloadSVG() { let svg = document.getElementById(this.containerId).firstElementChild; let svgXML = new XMLSerializer().serializeToString(svg); @@ -260,12 +248,7 @@ templateData: this.templateData, diagramTitle: diagramTitle }); - this.pdf.doc.save( - this.downloadFilename( - this.$gettext("Waterlevel"), - this.selectedGauge.properties.objname - ) + ".pdf" - ); + this.pdf.doc.save(this.fileName + ".pdf"); }, applyChange() { if (this.form.template.hasOwnProperty("properties")) {