changeset 4213:36ee7e621133 stylesconfig

styles-config: impelement rest-send buttons for all style changes
author Fadi Abbud <fadi.abbud@intevation.de>
date Fri, 16 Aug 2019 10:29:17 +0200
parents b0bb1b624678
children 77b28832bb64
files client/src/components/systemconfiguration/ColorSettings.vue
diffstat 1 files changed, 35 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/systemconfiguration/ColorSettings.vue	Thu Aug 15 16:58:39 2019 +0200
+++ b/client/src/components/systemconfiguration/ColorSettings.vue	Fri Aug 16 10:29:17 2019 +0200
@@ -36,6 +36,18 @@
             </a>
           </div>
         </div>
+        <div class="col-sm-2 px-3 align-self-end">
+          <a @click.prevent="resetAll" class="btn btn-outline-info btn-sm w-100"
+            >Reset all to defaults
+          </a>
+          <div class="d-flex mt-2">
+            <a
+              @click.prevent="saveAll"
+              class="btn btn-info btn-sm text-white w-100"
+              >Send all
+            </a>
+          </div>
+        </div>
       </div>
     </div>
   </div>
@@ -132,6 +144,16 @@
     "compact-picker": Compact
   },
   methods: {
+    saveAll() {
+      this.features.forEach(f => {
+        this.submit(f);
+      });
+    },
+    resetAll() {
+      this.features.forEach(f => {
+        this.reset(f);
+      });
+    },
     reset(feature) {
       switch (feature.name) {
         case "Bottlenecks": {
@@ -177,17 +199,17 @@
         }
       }
     },
-    noChangeMsg(name) {
-      displayInfo({
-        title: name + ":",
-        message: this.$gettext("No style-changes")
-      });
-    },
     submit(feature) {
       let strokeC = feature.strokeColor.hex8 || feature.strokeColor,
         fillC = feature.fillColor
           ? feature.fillColor.hex8 || feature.fillColor
           : initFColor;
+      let noChangeMsg = name => {
+        displayInfo({
+          title: name + ":",
+          message: this.$gettext("No style-changes")
+        });
+      };
       switch (feature.name) {
         case "Bottlenecks": {
           // send values only if they changed
@@ -202,7 +224,7 @@
               })
               .finally(() => this.$store.dispatch("application/loadConfig"));
           } else {
-            this.noChangeMsg(feature.name);
+            noChangeMsg(feature.name);
           }
           break;
         }
@@ -218,7 +240,7 @@
               })
               .finally(() => this.$store.dispatch("application/loadConfig"));
           } else {
-            this.noChangeMsg(feature.name);
+            noChangeMsg(feature.name);
           }
           break;
         }
@@ -234,7 +256,7 @@
               })
               .finally(() => this.$store.dispatch("application/loadConfig"));
           } else {
-            this.noChangeMsg(feature.name);
+            noChangeMsg(feature.name);
           }
           break;
         }
@@ -250,7 +272,7 @@
               })
               .finally(() => this.$store.dispatch("application/loadConfig"));
           } else {
-            this.noChangeMsg(feature.name);
+            noChangeMsg(feature.name);
           }
           break;
         }
@@ -266,7 +288,7 @@
               })
               .finally(() => this.$store.dispatch("application/loadConfig"));
           } else {
-            this.noChangeMsg(feature.name);
+            noChangeMsg(feature.name);
           }
           break;
         }
@@ -282,7 +304,7 @@
               })
               .finally(() => this.$store.dispatch("application/loadConfig"));
           } else {
-            this.noChangeMsg(feature.name);
+            noChangeMsg(feature.name);
           }
           break;
         }
@@ -296,7 +318,7 @@
                 this.$store.dispatch("application/loadConfig");
               });
           } else {
-            this.noChangeMsg(feature.name);
+            noChangeMsg(feature.name);
           }
           break;
         }