diff 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
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepth.vue	Tue Oct 15 16:28:46 2019 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepth.vue	Tue Oct 15 17:16:36 2019 +0200
@@ -207,11 +207,12 @@
     },
     csvFileName() {
       if (!this.frequencyD) return;
-      return `${this.$gettext("fairwayavailability")}-${
-        this.featureName
-      }-${filters.surveyDate(this.fromDate)}-${filters.surveyDate(
-        this.toDate
-      )}-${this.$gettext(this.frequencyD)}-.csv`;
+      return (
+        this.downloadFilename(
+          this.$gettext("FairwayAvailability"),
+          this.featureName
+        ) + ".csv"
+      );
     },
     frequencyToRange() {
       if (!this.frequencyD) return;
@@ -283,7 +284,12 @@
         templateData: this.templateData,
         diagramTitle: title
       });
-      this.pdf.doc.save(`Available Fairway Depth: ${this.featureName}`);
+      this.pdf.doc.save(
+        this.downloadFilename(
+          this.$gettext("FairwayAvailability"),
+          this.featureName
+        ) + ".pdf"
+      );
     },
     addDiagramLegend(position, offset, color) {
       let x = offset.x,