| | |
| | | var TPL_DLG_INFO = 'dlg-info'; |
| | | var TPL_DLG_SENDER_NEU = 'dlg-sender-neu'; |
| | | var TPL_DLG_SENDER_EDIT = 'dlg-sender-edit'; |
| | | var TPL_SENDER_EDIT_FORM = 'sender-edit-form'; |
| | | var templateCache = {}; // mustache templates |
| | | var prefsRendered = false; |
| | | var senderKlickModus = "0"; // 1=abspielen, 2=bearbeiten, 3=loeschen |
| | | |
| | | function app_init() { |
| | | $('.dialog').hide(); |
| | |
| | | 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-edit-form.tpl', TPL_SENDER_EDIT_FORM); |
| | | //app_get_template('tpl/prefs.tpl', 'prefs'); |
| | | $('.sued').text('Bereit.'); |
| | | setTimeout(function() { |
| | |
| | | } |
| | | |
| | | function app_sender_bearbeiten() { |
| | | senderKlickModus = "2"; // bearbeiten |
| | | app_dialog_laden_und_zeigen(templateCache[TPL_DLG_SENDER_EDIT], ''); |
| | | app_menu_toggle(); |
| | | /* |
| | | $('#sender-speichern').on('click', function() { |
| | | $('#sender-speichern').attr('onclick','').unbind('click'); |
| | | app_dialog_schliessen(); |
| | | app_meldung_mit_timeout('Speichern gewaehlt', 1500); |
| | | }); |
| | | */ |
| | | } |
| | | |
| | | function app_sender_loeschen() { |
| | |
| | | } |
| | | |
| | | function app_dialog_schliessen() { |
| | | senderKlickModus = "0"; |
| | | $('.close-btn').off('click'); |
| | | $('.dialog').slideUp(300); |
| | | } |
| | |
| | | type: "GET", |
| | | dataType : "json" |
| | | }).done(function( senderliste ) { |
| | | $(".sender-behaelter").html(Mustache.render(templateCache[TPL_SENDER], senderliste)); |
| | | $(".sender-kachel").off("click"); |
| | | $(".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); |
| | | switch (senderKlickModus) { |
| | | case "1": |
| | | break; |
| | | case "2": |
| | | $(".dlg-behaelter").html( |
| | | Mustache.render(templateCache[TPL_SENDER_EDIT_FORM], '') |
| | | ); |
| | | $('#sender-speichern').on('click', function() { |
| | | $('#sender-speichern').off('click'); |
| | | app_dialog_schliessen(); |
| | | app_meldung_mit_timeout('Speichern gewaehlt', 1500); |
| | | }); |
| | | break; |
| | | case "3": |
| | | break; |
| | | default: |
| | | app_meldung_mit_timeout( |
| | | 'Sender ' + senderName + ', ID ' + senderId, |
| | | 1500 |
| | | ); |
| | | break; |
| | | } |
| | | }); |
| | | }); |
| | | } |