From 40fc1b5c157cea8cedea29ba152c0a42e54a3698 Mon Sep 17 00:00:00 2001 From: "Martin Helmling martin.helmling@octosoft.eu" Date: Wed, 9 Nov 2016 17:24:02 +0100 Subject: [PATCH] =?utf8?q?Automatisches=20L=C3=B6schen=20von=20Flashanzeig?= =?utf8?q?e=20unterdr=C3=BCckbar(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Nun mit angepasstem Template und SL/ClientJS.pm --- SL/ClientJS.pm | 2 +- js/client_js.js | 19 ++++++++++--------- scripts/generate_client_js_actions.tpl | 17 +++++++++-------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/SL/ClientJS.pm b/SL/ClientJS.pm index 91a12576b..7f8bee011 100644 --- a/SL/ClientJS.pm +++ b/SL/ClientJS.pm @@ -116,7 +116,7 @@ my %supported_methods = ( flash => 2, # kivi.display_flash(, ) flash_detail => 2, # kivi.display_flash_detail(, ) - clear_flash => 2, # kivi.display_flash_detail(, ) + clear_flash => 2, # kivi.clear_flash(, ) reinit_widgets => 0, # kivi.reinit_widgets() run => -1, # kivi.run(, ) run_once_for => 3, # kivi.run_once_for(, ) diff --git a/js/client_js.js b/js/client_js.js index c1331a275..3f2bde585 100644 --- a/js/client_js.js +++ b/js/client_js.js @@ -35,14 +35,15 @@ ns.eval_json_result = function(data) { if (data.error) return ns.display_flash('error', data.error); - $(['info', 'warning', 'error']).each(function(idx, category) { - $('#flash_' + category).hide(); - $('#flash_detail_' + category).hide(); - $('#flash_' + category + '_disp').hide(); - $('#flash_' + category + '_content').empty(); - $('#flash_' + category + '_detail').empty(); - }); - + if (!data.no_flash_clear) { + $(['info', 'warning', 'error']).each(function(idx, category) { + $('#flash_' + category).hide(); + $('#flash_detail_' + category).hide(); + $('#flash_' + category + '_disp').hide(); + $('#flash_' + category + '_content').empty(); + $('#flash_' + category + '_detail').empty(); + }); + } if ((data.js || '') != '') eval(data.js); @@ -150,7 +151,7 @@ ns.eval_json_result = function(data) { else if (action[0] == 'redirect_to') window.location.href = action[1]; else if (action[0] == 'flash') kivi.display_flash(action[1], action[2]); else if (action[0] == 'flash_detail') kivi.display_flash_detail(action[1], action[2]); - else if (action[0] == 'clear_flash') kivi.display_flash_detail(action[1], action[2]); + else if (action[0] == 'clear_flash') kivi.clear_flash(action[1], action[2]); else if (action[0] == 'reinit_widgets') kivi.reinit_widgets(); else if (action[0] == 'run') kivi.run(action[1], action.slice(2, action.length)); else if (action[0] == 'run_once_for') kivi.run_once_for(action[1], action[2], action[3]); diff --git a/scripts/generate_client_js_actions.tpl b/scripts/generate_client_js_actions.tpl index a29b32587..274076a7a 100644 --- a/scripts/generate_client_js_actions.tpl +++ b/scripts/generate_client_js_actions.tpl @@ -35,14 +35,15 @@ ns.eval_json_result = function(data) { if (data.error) return ns.display_flash('error', data.error); - $(['info', 'warning', 'error']).each(function(idx, category) { - $('#flash_' + category).hide(); - $('#flash_detail_' + category).hide(); - $('#flash_' + category + '_disp').hide(); - $('#flash_' + category + '_content').empty(); - $('#flash_' + category + '_detail').empty(); - }); - + if (!data.no_flash_clear) { + $(['info', 'warning', 'error']).each(function(idx, category) { + $('#flash_' + category).hide(); + $('#flash_detail_' + category).hide(); + $('#flash_' + category + '_disp').hide(); + $('#flash_' + category + '_content').empty(); + $('#flash_' + category + '_detail').empty(); + }); + } if ((data.js || '') != '') eval(data.js); -- 2.20.1