From 8881caa05f19299ddcc775b30b8c3c8ada2108b1 Mon Sep 17 00:00:00 2001 From: ulrich <not disclosed> Date: Thu, 04 Jan 2018 10:59:41 +0000 Subject: [PATCH] Vorlagen nach data verschoben --- app.js | 33 ++++++++++++++++++--------------- data/tpl/dlg-info.tpl | 0 data/tpl/dlg-msg.tpl | 0 data/tpl/sender.tpl | 0 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/app.js b/app.js index ac8ca41..2c6bd4d 100644 --- a/app.js +++ b/app.js @@ -10,9 +10,9 @@ $('.dialog').hide(); $('.ost').hide(); app_menu_init("data/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('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); //app_get_template('tpl/prefs.tpl', 'prefs'); $('.sued').text('Bereit.'); setTimeout(function() { @@ -20,12 +20,25 @@ }, 200); } +/* --- Menüfunktionen --- */ + function app_nachricht_test() { app_nachricht_zeigen(templateCache[TPL_DLG_MSG], 'data/msg-test.json'); } function app_info_dialog_zeigen() { app_nachricht_zeigen(templateCache[TPL_DLG_INFO], ''); +} + +/* --- Sonstiges --- */ + +function app_dialog_zeigen(vorlage, inhalt) { + $(".dialog").html(Mustache.render(vorlage, inhalt)); + $(".close-btn").on('click', function() { + $('.close-btn').attr('onclick','').unbind('click'); + $('.dialog').slideUp(300); + }); + $('.dialog').slideDown(300); } /* --- Ajax-Aufrufe --- */ @@ -47,20 +60,10 @@ 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); + app_dialog_zeigen(vorlage, msg); }); } else { - $(".dialog").html(Mustache.render(vorlage, '')); - $(".close-btn").on('click', function() { - $('.close-btn').attr('onclick','').unbind('click'); - $('.dialog').slideUp(300); - }); - $('.dialog').slideDown(300); + app_dialog_zeigen(vorlage, ''); } } diff --git a/tpl/dlg-info.tpl b/data/tpl/dlg-info.tpl similarity index 100% rename from tpl/dlg-info.tpl rename to data/tpl/dlg-info.tpl diff --git a/tpl/dlg-msg.tpl b/data/tpl/dlg-msg.tpl similarity index 100% rename from tpl/dlg-msg.tpl rename to data/tpl/dlg-msg.tpl diff --git a/tpl/sender.tpl b/data/tpl/sender.tpl similarity index 100% rename from tpl/sender.tpl rename to data/tpl/sender.tpl -- Gitblit v1.9.3