X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fgenerate_client_js_actions.tpl;h=50a427c458964ff2c1decd910140a24fed5e2fbf;hb=07c884e5ac2318a9a67947faa88ecd1d4ca0629e;hp=6572e22c338d2cc62214706b6d9251f422024a87;hpb=2473bd32292484336637336bc6968a0f329d9ad4;p=kivitendo-erp.git diff --git a/scripts/generate_client_js_actions.tpl b/scripts/generate_client_js_actions.tpl index 6572e22c3..50a427c45 100644 --- a/scripts/generate_client_js_actions.tpl +++ b/scripts/generate_client_js_actions.tpl @@ -4,10 +4,33 @@ // "scripts/generate_client_js_actions.pl". See the documentation for // SL/ClientJS.pm for instructions. -function eval_json_result(data) { +namespace("kivi", function(ns) { +ns.display_flash = function(type, message) { + $('#flash_' + type + '_content').text(message); + $('#flash_' + type).show(); + $('#frame-header')[0].scrollIntoView(); +}; + +ns.display_flash_detail = function(type, message) { + $('#flash_' + type + '_detail').html(message); + $('#flash_' + type + '_disp').show(); +}; + +ns.eval_json_result = function(data) { if (!data) return; + 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.js || '') != '') eval(data.js); @@ -19,4 +42,10 @@ function eval_json_result(data) { }); // console.log("current_content_type " + $('#current_content_type').val() + ' ID ' + $('#current_content_id').val()); -} +}; + +}); + +// Local Variables: +// mode: js +// End: