Mercurial > gemma
comparison client/src/components/fairway/AvailableFairwayDepth.vue @ 4677:fa55e48bbca1
client: improve filename generation for downloads
* unify filename for the generated csv files
* move function to mixins.js
* mark strings in filename for translations
* replace whitespace with "-"
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Tue, 15 Oct 2019 17:16:36 +0200 |
parents | c47c8085cc7e |
children | b3f65cff13e8 |
comparison
equal
deleted
inserted
replaced
4676:5b9ba358a4e7 | 4677:fa55e48bbca1 |
---|---|
205 dataLink() { | 205 dataLink() { |
206 return `data:text/csv;charset=utf-8, ${encodeURIComponent(this.csv)}`; | 206 return `data:text/csv;charset=utf-8, ${encodeURIComponent(this.csv)}`; |
207 }, | 207 }, |
208 csvFileName() { | 208 csvFileName() { |
209 if (!this.frequencyD) return; | 209 if (!this.frequencyD) return; |
210 return `${this.$gettext("fairwayavailability")}-${ | 210 return ( |
211 this.featureName | 211 this.downloadFilename( |
212 }-${filters.surveyDate(this.fromDate)}-${filters.surveyDate( | 212 this.$gettext("FairwayAvailability"), |
213 this.toDate | 213 this.featureName |
214 )}-${this.$gettext(this.frequencyD)}-.csv`; | 214 ) + ".csv" |
215 ); | |
215 }, | 216 }, |
216 frequencyToRange() { | 217 frequencyToRange() { |
217 if (!this.frequencyD) return; | 218 if (!this.frequencyD) return; |
218 const frequencies = { | 219 const frequencies = { |
219 [FREQUENCIES.MONTHLY]: [-33, 33], | 220 [FREQUENCIES.MONTHLY]: [-33, 33], |
281 }`; | 282 }`; |
282 this.generatePDF({ | 283 this.generatePDF({ |
283 templateData: this.templateData, | 284 templateData: this.templateData, |
284 diagramTitle: title | 285 diagramTitle: title |
285 }); | 286 }); |
286 this.pdf.doc.save(`Available Fairway Depth: ${this.featureName}`); | 287 this.pdf.doc.save( |
288 this.downloadFilename( | |
289 this.$gettext("FairwayAvailability"), | |
290 this.featureName | |
291 ) + ".pdf" | |
292 ); | |
287 }, | 293 }, |
288 addDiagramLegend(position, offset, color) { | 294 addDiagramLegend(position, offset, color) { |
289 let x = offset.x, | 295 let x = offset.x, |
290 y = offset.y; | 296 y = offset.y; |
291 this.pdf.doc.setFontSize(10); | 297 this.pdf.doc.setFontSize(10); |