From 14638bbf3f495dcacc1ef8d7c6ecd7dabf3d17b2 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Fri, 09 Apr 2021 14:11:52 +0000
Subject: [PATCH] JavaScript aufgeraeumt

---
 www/ui/js/app.js |  129 +++++++++---------------------------------
 1 files changed, 28 insertions(+), 101 deletions(-)

diff --git a/www/ui/js/app.js b/www/ui/js/app.js
index 6c6d41b..c13a6b1 100644
--- a/www/ui/js/app.js
+++ b/www/ui/js/app.js
@@ -105,35 +105,6 @@
     }
   };
   
-  /*
-   * url: '../api/store/Ablageort/liste/'
-   * tpl: "data/tpl/ablageort_liste.tpl"
-   * storeUrl: '../api/store/Ablageort/'
-   * formFunc: "self.ablageort_form"
-   * cb: etwas wie
-   * 
-   * function(responseText){
-   *   var ablageort = JSON.parse(responseText);
-   *   self.ablageort_form(ablageort);
-   * });
-   */
-  this.entitaet_liste = function(listUrl, tpl, storeUrl, formFunc, cb) {
-    self.reset_top_buttons();
-    self.http_get(listUrl, function (responseText) {
-      self.vorlage_laden_und_fuellen(tpl, JSON.parse(responseText), function (html) {
-        document.querySelector(".zentraler-inhalt").innerHTML = html;
-        self.addEvtListener('.entity-eintrag', 'click', function (event) {
-          var t = event.target;
-          self.http_get(storeUrl + t.textContent, cb);
-        });
-        //self.addEvtListener('#neu-btn', 'click', function (event) {
-        self.addEvtListener('#top-neu-btn', 'click', function(event) {
-          eval(formFunc + "(this)");
-        });        
-      });
-    });
-  };
-  
   this.ablageort_liste = function() {
     self.entitaet_liste('../api/store/Ablageort/liste/', 
       "data/tpl/ablageort_liste.tpl", '../api/store/Ablageort/', 
@@ -141,25 +112,6 @@
         var ablageort = JSON.parse(responseText);
         self.ablageort_form(ablageort);
       });
-    /*
-    self.reset_top_buttons();
-    self.http_get('../api/store/Ablageort/liste/', function (responseText) {
-      self.vorlage_laden_und_fuellen("data/tpl/ablageort_liste.tpl", JSON.parse(responseText), function (html) {
-        document.querySelector(".zentraler-inhalt").innerHTML = html;
-        self.addEvtListener('.entity-eintrag', 'click', function (event) {
-          var t = event.target;
-          self.http_get('../api/store/Ablageort/' + t.textContent, function(responseText){
-            var ablageort = JSON.parse(responseText);
-            self.ablageort_form(ablageort);
-          });
-        });
-        //self.addEvtListener('#neu-btn', 'click', function (event) {
-        self.addEvtListener('#top-neu-btn', 'click', function(event) {
-          eval("self.ablageort_form" + "(this)");
-        });        
-      });
-    });
-    */
   };
 
   this.prefs_liste = function() {
@@ -169,24 +121,6 @@
         var einstellung = JSON.parse(responseText);
         self.prefs_form(einstellung);
       });
-    /*
-    self.reset_top_buttons();
-    self.http_get('../api/store/Einstellung/liste/', function (responseText) {
-      self.vorlage_laden_und_fuellen("data/tpl/einstellung_liste.tpl", JSON.parse(responseText), function (html) {
-        document.querySelector(".zentraler-inhalt").innerHTML = html;
-        self.addEvtListener('.entity-eintrag', 'click', function (event) {
-          var t = event.target;
-          self.http_get('../api/store/Einstellung/' + t.textContent, function(responseText){
-            var einstellung = JSON.parse(responseText);
-            self.prefs_form(einstellung);
-          });
-        });
-        self.addEvtListener('#top-neu-btn', 'click', function(event) {
-          eval("self.prefs_form" + "(this)");
-        });        
-      });
-    });
-    */
   };
 
   this.abspieler_liste = function() {
@@ -196,24 +130,6 @@
         var abspieler = JSON.parse(responseText);
         self.abspieler_form(abspieler);
       });
-    /*
-    self.http_get('../api/store/Abspieler/liste/', function (responseText) {
-      self.vorlage_laden_und_fuellen("data/tpl/abspieler_liste.tpl", JSON.parse(responseText), function (html) {
-        document.querySelector(".zentraler-inhalt").innerHTML = html;
-        self.addEvtListener('.entity-eintrag', 'click', function (event) {
-          var t = event.target;
-          self.http_get('../api/store/Abspieler/' + t.textContent, function(responseText){
-            var abspieler = JSON.parse(responseText);
-            self.abspieler_form(abspieler);
-          });
-        });
-        //self.addEvtListener('#neu-btn', 'click', function(event) {
-        self.addEvtListener('#top-neu-btn', 'click', function(event) {
-          eval("self.abspieler_form" + "(this)");
-        });           
-      });
-    });
-    */
   };
   
   this.abspielliste_liste = function() {
@@ -223,23 +139,6 @@
         var abspielliste = JSON.parse(responseText);
         self.abspielliste_form(abspielliste);
       });
-    /*
-    self.http_get('../api/store/Abspielliste/liste/', function (responseText) {
-      self.vorlage_laden_und_fuellen("data/tpl/abspielliste_liste.tpl", JSON.parse(responseText), function (html) {
-        document.querySelector(".zentraler-inhalt").innerHTML = html;
-        self.addEvtListener('.entity-eintrag', 'click', function (event) {
-          var t = event.target;
-          self.http_get('../api/store/Abspielliste/' + t.textContent, function(responseText){
-            var abspielliste = JSON.parse(responseText);
-            self.abspielliste_form(abspielliste);
-          });
-        });
-        self.addEvtListener('#top-neu-btn', 'click', function(event) {
-          eval("self.abspielliste_form" + "(this)");
-        });            
-      });
-    });
-    */
   };
   
   /* -------------------- Entitaets-Formulare ------------------ */
@@ -419,6 +318,34 @@
   };  
   
   /* ------------- Helfer fuer Entitaets-Formulare ----------------------- */
+  
+  /*
+   * url: '../api/store/Ablageort/liste/'
+   * tpl: "data/tpl/ablageort_liste.tpl"
+   * storeUrl: '../api/store/Ablageort/'
+   * formFunc: "self.ablageort_form"
+   * cb: etwas wie
+   *   function(responseText){
+   *     var ablageort = JSON.parse(responseText);
+   *     self.ablageort_form(ablageort);
+   *   });
+   */
+  this.entitaet_liste = function(listUrl, tpl, storeUrl, formFunc, cb) {
+    self.reset_top_buttons();
+    self.http_get(listUrl, function (responseText) {
+      self.vorlage_laden_und_fuellen(tpl, JSON.parse(responseText), function (html) {
+        document.querySelector(".zentraler-inhalt").innerHTML = html;
+        self.addEvtListener('.entity-eintrag', 'click', function (event) {
+          var t = event.target;
+          self.http_get(storeUrl + t.textContent, cb);
+        });
+        //self.addEvtListener('#neu-btn', 'click', function (event) {
+        self.addEvtListener('#top-neu-btn', 'click', function(event) {
+          eval(formFunc + "(this)");
+        });        
+      });
+    });
+  };  
       
   /*
    * existingKey: wenn die Entitaet existiert und geandert werden soll

--
Gitblit v1.9.3