From 56852df8849316a72d1c9287f0232983849e4262 Mon Sep 17 00:00:00 2001 From: ulrich <not disclosed> Date: Sat, 06 Jan 2018 09:57:17 +0000 Subject: [PATCH] Ablauf Sender bearbeiten gebaut --- data/tpl/dlg-sender-edit.tpl | 1 - app.js | 41 ++++++++++++++++++++++++++++++----------- data/tpl/dlg-sender-edit-form.tpl | 1 + data/tpl/sender.tpl | 4 +++- 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/app.js b/app.js index 69bfac2..3de1288 100644 --- a/app.js +++ b/app.js @@ -5,8 +5,10 @@ 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(); @@ -22,6 +24,7 @@ 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() { @@ -52,15 +55,9 @@ } 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() { @@ -79,6 +76,7 @@ } function app_dialog_schliessen() { + senderKlickModus = "0"; $('.close-btn').off('click'); $('.dialog').slideUp(300); } @@ -106,14 +104,35 @@ 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; + } }); }); } diff --git a/data/tpl/dlg-sender-edit-form.tpl b/data/tpl/dlg-sender-edit-form.tpl index 12546da..09fd1b6 100644 --- a/data/tpl/dlg-sender-edit-form.tpl +++ b/data/tpl/dlg-sender-edit-form.tpl @@ -1,3 +1,4 @@ +<div class="dlg-sender-titel">Sender bearbeiten</div> <form> <input id="sender-name" placeholder="Name" type="text" class="sender-eingabe"></br> <input id="sender-logo" placeholder="Logo" type="text" class="sender-eingabe"></br> diff --git a/data/tpl/dlg-sender-edit.tpl b/data/tpl/dlg-sender-edit.tpl index 6652a65..523dc6a 100644 --- a/data/tpl/dlg-sender-edit.tpl +++ b/data/tpl/dlg-sender-edit.tpl @@ -1,7 +1,6 @@ <div class="dlg-sender-edit"> <span class="close-btn pointer-cursor">✖</span> <div class="dlg-behaelter"> - <div class="dlg-sender-titel">Sender bearbeiten</div> <div class="dlg-sender-text">Sender zum Bearbeiten antippen...</div> </div> </div> diff --git a/data/tpl/sender.tpl b/data/tpl/sender.tpl index 09fea3c..f08ca94 100644 --- a/data/tpl/sender.tpl +++ b/data/tpl/sender.tpl @@ -3,7 +3,9 @@ {{#inhalt}} <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 class="sender-bild-behaelter"> + <img class="sender-bild" src="{{senderlogo}}"> + </div> </div> {{/inhalt}} {{/senderliste}} -- Gitblit v1.9.3