X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fgenerate_client_js_actions.tpl;h=9e2180289895405366ebe851edf7f91ba71471da;hb=0cb0a30142224785c73b545b6729b1d5b8892fca;hp=7fa7baf95ec113f9a9d804525b1ac85bf936f35a;hpb=b9740e8a9a77eafcaf7aacd530af23fa8dbcb9f9;p=kivitendo-erp.git diff --git a/scripts/generate_client_js_actions.tpl b/scripts/generate_client_js_actions.tpl index 7fa7baf95..9e2180289 100644 --- a/scripts/generate_client_js_actions.tpl +++ b/scripts/generate_client_js_actions.tpl @@ -4,20 +4,23 @@ // "scripts/generate_client_js_actions.pl". See the documentation for // SL/ClientJS.pm for instructions. -function display_flash(type, message) { +namespace("kivi", function(ns) { +ns.display_flash = function(type, message) { $('#flash_' + type + '_content').text(message); $('#flash_' + type).show(); -} +}; -function eval_json_result(data) { +ns.eval_json_result = function(data) { if (!data) return; if (data.error) - return display_flash('error', data.error); + return ns.display_flash('error', data.error); - $('#flash_error').hide(); - $('#flash_error_content').empty(); + $(['info', 'warning', 'error']).each(function(idx, category) { + $('#flash_' + category).hide(); + $('#flash_' + category + '_content').empty(); + }); if ((data.js || '') != '') eval(data.js); @@ -30,7 +33,9 @@ function eval_json_result(data) { }); // console.log("current_content_type " + $('#current_content_type').val() + ' ID ' + $('#current_content_id').val()); -} +}; + +}); // Local Variables: // mode: js