From bdbb0737d6aed864361c85de546227188fb88d94 Mon Sep 17 00:00:00 2001
From: ulrich <not disclosed>
Date: Sat, 27 Jan 2018 13:20:38 +0000
Subject: [PATCH] Sender loeschen

---
 app.js |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/app.js b/app.js
index d442e63..80a295c 100644
--- a/app.js
+++ b/app.js
@@ -5,6 +5,7 @@
 var TPL_DLG_INFO = 'dlg-info';
 var TPL_DLG_SENDER_NEU = 'dlg-sender-neu';
 var TPL_DLG_SENDER_EDIT = 'dlg-sender-edit';
+var TPL_DLG_SENDER_DEL = 'dlg-sender-del';
 var TPL_SENDER_EDIT_FORM = 'sender-edit-form';
 var TPL_SENDER_KACHEL = 'sender-kachel';
 var TPL_ABSPIELER = 'abspieler';
@@ -37,6 +38,7 @@
   app_get_template('data/tpl/sender.tpl', TPL_SENDER);
   app_get_template('data/tpl/dlg-sender-neu.tpl', TPL_DLG_SENDER_NEU);
   app_get_template('data/tpl/dlg-sender-edit.tpl', TPL_DLG_SENDER_EDIT);
+  app_get_template('data/tpl/dlg-sender-loeschen.tpl', TPL_DLG_SENDER_DEL);
   app_get_template('data/tpl/dlg-sender-edit-form.tpl', TPL_SENDER_EDIT_FORM);
   app_get_template('data/tpl/kachel.tpl', TPL_SENDER_KACHEL);
   app_get_template('data/tpl/abspieler.tpl', TPL_ABSPIELER);
@@ -155,6 +157,10 @@
   kachel.on('click', app_kachel_klick);
 }
 
+function app_kachel_entfernen(sender) {
+  $( "div[sid='" + sender.id + "']" ).remove();
+}
+
 function app_kachel_klick() {
   var kachel = $( this );
   var senderId = kachel.attr("sid");
@@ -178,6 +184,16 @@
         });
         break;
       case "3":
+        $(".dlg-behaelter").html(
+          Mustache.render(templateCache[TPL_DLG_SENDER_DEL], s)
+        );
+        $('#sender-loeschen').on('click', function() {
+          $('#sender-loeschen').off('click');
+          app_kachel_entfernen(s);
+          app_dialog_schliessen();
+          app_meldung_mit_timeout('Loeschen gewaehlt ' + s.name, 1500);
+        });
+        app_menue_umschalten();
         break;
       default:
         app_meldung_mit_timeout(
@@ -219,7 +235,8 @@
 }
 
 function app_sender_loeschen() {
-  app_meldung_mit_timeout('Nicht implementiert: Sender loeschen.', 1500);
+  senderKlickModus = "3"; // loeschen
+  app_dialog_laden_und_zeigen(templateCache[TPL_DLG_SENDER_EDIT], '');
   app_menue_umschalten();
 }
 

--
Gitblit v1.9.3