From c9780f06a29dec6878d6d485ff65e859834e11df Mon Sep 17 00:00:00 2001 From: ulrich <not disclosed> Date: Thu, 04 Jan 2018 10:26:02 +0000 Subject: [PATCH] nicht mehr benötigte Dateien gelöscht --- app.js | 37 ++++++++++++++++++++++++++----------- 1 files changed, 26 insertions(+), 11 deletions(-) diff --git a/app.js b/app.js index 6d38c15..dde105d 100644 --- a/app.js +++ b/app.js @@ -2,6 +2,7 @@ var TPL_PREFS = 'prefs'; var TPL_SENDER = 'sender'; var TPL_DLG_MSG = 'dlg-msg'; +var TPL_DLG_INFO = 'dlg-info'; var templateCache = {}; // mustache templates 'home', 'prefs', 'sender' var prefsRendered = false; @@ -10,6 +11,7 @@ $('.ost').hide(); app_menu_init("menu/", "hauptmenue.json", "../jslib/app-menu/app-menu.tpl", ".west"); app_get_template('tpl/dlg-msg.tpl', TPL_DLG_MSG); + app_get_template('tpl/dlg-info.tpl', TPL_DLG_INFO); app_get_template('tpl/sender.tpl', TPL_SENDER); //app_get_template('tpl/prefs.tpl', 'prefs'); $('.sued').text('Bereit.'); @@ -19,34 +21,47 @@ } function app_nachricht_test() { - app_get_nachricht('api/msg-test.json'); + app_nachricht_zeigen(templateCache[TPL_DLG_MSG], 'data/msg-test.json'); +} + +function app_info_dialog_zeigen() { + app_nachricht_zeigen(templateCache[TPL_DLG_INFO], ''); } /* --- Ajax-Aufrufe --- */ function app_get_sender() { $.ajax({ - url: "api/sender.json", + url: "data/sender.json", type: "GET", dataType : "json" }).done(function( senderliste ) { - $("#sender").html(Mustache.render(templateCache[TPL_SENDER], senderliste)); + $(".sender-behaelter").html(Mustache.render(templateCache[TPL_SENDER], senderliste)); }); } -function app_get_nachricht(addr) { - $.ajax({ - url: addr, - type: "GET", - dataType : "json" - }).done(function( msg ) { - $(".dialog").html(Mustache.render(templateCache[TPL_DLG_MSG], msg)); +function app_nachricht_zeigen(vorlage, adresse) { + if(adresse !== '') { + $.ajax({ + url: adresse, + type: "GET", + dataType : "json" + }).done(function( msg ) { + $(".dialog").html(Mustache.render(vorlage, msg)); + $(".close-btn").on('click', function() { + $('.close-btn').attr('onclick','').unbind('click'); + $('.dialog').slideUp(300); + }); + $('.dialog').slideDown(300); + }); + } else { + $(".dialog").html(Mustache.render(vorlage, '')); $(".close-btn").on('click', function() { $('.close-btn').attr('onclick','').unbind('click'); $('.dialog').slideUp(300); }); $('.dialog').slideDown(300); - }); + } } /* -- Gitblit v1.9.3