From 136220b85a36ebeb1f1cc3598e15297e1275b636 Mon Sep 17 00:00:00 2001
From: ulrich <not disclosed>
Date: Sat, 06 Jan 2018 09:12:30 +0000
Subject: [PATCH] Sender-ID und Klick-Funktion für Senderkacheln hinzugefügt

---
 app.js              |   19 ++++++++++++++++---
 data/sender.json    |    4 ++++
 data/tpl/sender.tpl |    2 +-
 app.css             |    1 +
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/app.css b/app.css
index 97cb96f..5b587c3 100644
--- a/app.css
+++ b/app.css
@@ -149,6 +149,7 @@
   margin: 0.4em;
   padding: 0.4em;
   background-color: white;
+  cursor: pointer;
 }
 
 .sender-name {
diff --git a/app.js b/app.js
index 718c27d..69bfac2 100644
--- a/app.js
+++ b/app.js
@@ -11,7 +11,12 @@
 function app_init() {
   $('.dialog').hide();
   $('.ost').hide();
-  app_menu_init("data/menu/", "hauptmenue.json", "../jslib/app-menu/app-menu.tpl", ".west", "8em");
+  app_menu_init(
+    "data/menu/",
+    "hauptmenue.json",
+    "../jslib/app-menu/app-menu.tpl",
+    ".west",
+    "8em");
   app_get_template('data/tpl/dlg-msg.tpl', TPL_DLG_MSG);
   app_get_template('data/tpl/dlg-info.tpl', TPL_DLG_INFO);
   app_get_template('data/tpl/sender.tpl', TPL_SENDER);
@@ -39,7 +44,7 @@
 function app_neuer_sender() {
   app_dialog_laden_und_zeigen(templateCache[TPL_DLG_SENDER_NEU], '');
   $('#sender-speichern').on('click', function() {
-    $('#sender-speichern').attr('onclick','').unbind('click');
+    $('#sender-speichern').off('click');
     app_dialog_schliessen();
     app_meldung_mit_timeout('Speichern gewaehlt', 1500);
   });
@@ -74,7 +79,7 @@
 }
 
 function app_dialog_schliessen() {
-  $('.close-btn').attr('onclick','').unbind('click');
+  $('.close-btn').off('click');
   $('.dialog').slideUp(300);
 }
 
@@ -102,6 +107,14 @@
     dataType : "json"
   }).done(function( senderliste ) {
     $(".sender-behaelter").html(Mustache.render(templateCache[TPL_SENDER], senderliste));
+    $('.sender-kachel').on('click', function() {
+      var kachel = $( this );
+      var senderId = kachel.attr("sid");
+      var senderName = $(kachel).find(".sender-name").text();
+      app_meldung_mit_timeout(
+        'Sender ' + senderName + ', ID ' + senderId,
+        1500);
+    });
   });
 }
 
diff --git a/data/sender.json b/data/sender.json
index 6bb7fde..260208e 100644
--- a/data/sender.json
+++ b/data/sender.json
@@ -3,21 +3,25 @@
     "titel": "Senderliste",
     "inhalt":  [
       {
+        "senderid": 1,
         "sendername": "hr info",
         "senderurl": "http://hr-hrinfo-live.cast.addradio.de/hr/hrinfo/live/mp3/128/stream.mp3",
         "senderlogo": "../bilder/hr-info.png"
       },
       {
+        "senderid": 2,
         "sendername": "radiobob",
         "senderurl": "http://bob.hoerradar.de/radiobob-live-mp3-hq",
         "senderlogo": "../bilder/radio-bob-logo-80.png"
       },
       {
+        "senderid": 3,
         "sendername": "hr3",
         "senderurl": "http://hr-hrinfo-live.cast.addradio.de/hr/hrinfo/live/mp3/128/stream.mp3",
         "senderlogo": "../bilder/hr3.png"
       },
       {
+        "senderid": 4,
         "sendername": "FFH",
         "senderurl": "http://mp3.ffh.de/radioffh/hqlivestream.mp3",
         "senderlogo": "../bilder/ffh.svg"
diff --git a/data/tpl/sender.tpl b/data/tpl/sender.tpl
index da27a94..09fea3c 100644
--- a/data/tpl/sender.tpl
+++ b/data/tpl/sender.tpl
@@ -1,7 +1,7 @@
 <div id="sender" class="sender">
 {{#senderliste}}
   {{#inhalt}}
-  <div class="sender-kachel" data-verweis="{{senderurl}}">
+  <div class="sender-kachel" sid="{{senderid}}" data-verweis="{{senderurl}}">
     <div class="sender-name">{{sendername}}</div>
     <div class="sender-bild-behaelter"><img class="sender-bild" src="{{senderlogo}}"></div>
   </div>

--
Gitblit v1.9.3