From 47a970ab16fb42d62734ab53ae5fa113c9b47165 Mon Sep 17 00:00:00 2001 From: ulrich <not disclosed> Date: Tue, 02 Jan 2018 12:59:21 +0000 Subject: [PATCH] Senderübersicht wird jetzt dynamisch aus einer JSON-Beschreibung gelesen. --- app.js | 28 ++++++++++++++++++++++------ 1 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app.js b/app.js index fed1134..1d258d7 100644 --- a/app.js +++ b/app.js @@ -1,17 +1,33 @@ var TPL_HOME = 'home'; var TPL_PREFS = 'prefs'; -var templateCache = {}; // mustache templates 'home', 'prefs' +var TPL_SENDER = 'sender'; +var templateCache = {}; // mustache templates 'home', 'prefs', 'sender' var prefsRendered = false; function app_init() { $('.ost').hide(); - //app_menu_init("menu/", "hauptmenue.json", "../jslib/app-menu/app-menu.tpl", ".west"); - //app_get_template('tpl/home.tpl', 'home'); + app_menu_init("menu/", "hauptmenue.json", "../jslib/app-menu/app-menu.tpl", ".west"); + app_get_template('tpl/sender.tpl', TPL_SENDER); //app_get_template('tpl/prefs.tpl', 'prefs'); $('.sued').text('Bereit.'); - /* setTimeout(function() { - app_seitenwechsel('home', 'vor'); + $("#sender").html(Mustache.render(templateCache[TPL_SENDER], '')); }, 200); - */ +} + +/* --- Ajax-Aufrufe --- */ + +/* + Ein Template vom Server in den Cache laden + template_url - home.tpl, prefs.tpl, sender.tpl + tname - 'home', 'prefs', 'sender' +*/ +function app_get_template(template_url, tname) { + $.ajax({ + url: template_url, + type: "GET", + dataType : "text" + }).done(function( template ) { + templateCache[tname] = template; + }); } -- Gitblit v1.9.3