diff client/src/components/systemconfiguration/PDFTemplates.vue @ 3594:63322cd63a57

client: configuration: pdf templates: replaced select and button with two buttons, saves two clicks
author Markus Kottlaender <markus@intevation.de>
date Tue, 04 Jun 2019 14:42:12 +0200
parents b3333311de42
children d1bbfb9635ca
line wrap: on
line diff
--- a/client/src/components/systemconfiguration/PDFTemplates.vue	Tue Jun 04 14:32:55 2019 +0200
+++ b/client/src/components/systemconfiguration/PDFTemplates.vue	Tue Jun 04 14:42:12 2019 +0200
@@ -45,29 +45,36 @@
           </div>
         </template>
       </UITableBody>
-      <div class="d-flex flex-column mt-2 w-25 mr-auto">
-        <select
-          v-model="type"
-          class="form-control d-block custom-select-sm w-75 h-25"
+      <div class="mt-2">
+        <button
+          class="btn btn-info btn-sm mr-2"
+          @click="
+            type = 'map';
+            $refs.uploadTemplate.click();
+          "
         >
-          <option :value="null">
-            Select template type
-          </option>
-          <option value="map">
-            Map-template
-          </option>
-          <option value="diagram">
-            Diagram-template
-          </option>
-        </select>
-        <button class="btn btn-info btn-sm mt-1 w-75" @click="checkUpload">
           <font-awesome-icon
             icon="spinner"
             class="fa-spin fa-fw"
             v-if="uploading"
           />
           <font-awesome-icon icon="upload" class="fa-fw" v-else />
-          <translate>Upload new template</translate>
+          <translate>Upload new map template</translate>
+        </button>
+        <button
+          class="btn btn-info btn-sm"
+          @click="
+            type = 'diagram';
+            $refs.uploadTemplate.click();
+          "
+        >
+          <font-awesome-icon
+            icon="spinner"
+            class="fa-spin fa-fw"
+            v-if="uploading"
+          />
+          <font-awesome-icon icon="upload" class="fa-fw" v-else />
+          <translate>Upload new diagram template</translate>
         </button>
       </div>
     </div>
@@ -128,17 +135,6 @@
     }
   },
   methods: {
-    // check if template type is selceted
-    checkUpload() {
-      if (this.type) {
-        this.$refs.uploadTemplate.click();
-      } else {
-        displayError({
-          title: this.$gettext("Error"),
-          message: this.$gettext("Please select template type")
-        });
-      }
-    },
     downloadTemplate(template) {
       if (template) {
         var templateData = "";