From: Sven Schöling Date: Wed, 3 Jul 2013 17:55:26 +0000 (+0200) Subject: mehr code nach js/ verlagert X-Git-Tag: release-3.1.0beta1~185 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c2d1e374b4f8a2b4802ea6348539da7ec10a227a;p=kivitendo-erp.git mehr code nach js/ verlagert --- diff --git a/js/autocomplete_part.js b/js/autocomplete_part.js index 66123e8af..61280fd93 100644 --- a/js/autocomplete_part.js +++ b/js/autocomplete_part.js @@ -78,6 +78,10 @@ namespace('kivi', function(k){ }); }; + function close_popup() { + $('#part_selection').jqmClose() + }; + $dummy.autocomplete({ source: function(req, rsp) { $.ajax($.extend(o, { @@ -145,13 +149,31 @@ namespace('kivi', function(k){ picker.addClass('icon16 CRM--Schnellsuche').click(open_dialog); return { - real: function() { return $real }, - dummy: function() { return $dummy }, - type: function() { return $type }, - column: function() { return $column }, + real: function() { return $real }, + dummy: function() { return $dummy }, + type: function() { return $type }, + column: function() { return $column }, update_results: update_results, - set_item: set_item, - reset: make_defined_state, + set_item: set_item, + reset: make_defined_state, + init_results: function () { + $('div.part_picker_part').each(function(){ + $(this).click(function(){ + set_item({ + name: $(this).children('input.part_picker_description').val(), + id: $(this).children('input.part_picker_id').val(), + }); + close_popup(); + return true; + }); + }); + $('#part_selection').keypress(function(e){ + if (e.keyCode == 27) { // escape + close_popup(); + $dummy.focus(); + } + }); + } } } }); diff --git a/templates/webpages/part/_part_picker_result.html b/templates/webpages/part/_part_picker_result.html index c6a814335..0512b49ad 100644 --- a/templates/webpages/part/_part_picker_result.html +++ b/templates/webpages/part/_part_picker_result.html @@ -27,14 +27,5 @@