From e2e7e282c5c085a59e6ca334b0340f8dfa613417 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 31 Jul 2013 13:03:32 +0200 Subject: [PATCH] =?utf8?q?Pflichtenheftitems:=20bei=20RETURN=20in=20Zeitab?= =?utf8?q?sch=C3=A4tzung=20per=20AJAX=20abschicken?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/RequirementSpecItem.pm | 1 + js/requirement_spec.js | 9 +++++++++ .../requirement_spec_item/_function_block_form.html | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/SL/Controller/RequirementSpecItem.pm b/SL/Controller/RequirementSpecItem.pm index 0797a3ffd..7b1ed8194 100644 --- a/SL/Controller/RequirementSpecItem.pm +++ b/SL/Controller/RequirementSpecItem.pm @@ -258,6 +258,7 @@ sub action_ajax_edit { ->hide($content_top_id) ->remove("#${id_base}_form") ->insertAfter($html, $content_top_id) + ->on("#${id_base}_form INPUT[type=text]", "keydown", "kivi.requirement_spec.text_block_input_key_down") ->jstree->select_node('#tree', '#fb-' . $self->item->id) ->focus("#${id_base}_description") ->val('#current_content_type', $self->item->item_type) diff --git a/js/requirement_spec.js b/js/requirement_spec.js index 3e4c485fc..567f893a4 100644 --- a/js/requirement_spec.js +++ b/js/requirement_spec.js @@ -174,6 +174,15 @@ ns.ask_delete_text_block = function(key, opt) { return true; }; +ns.text_block_input_key_down = function(event) { + if(event.keyCode == 13) { + event.preventDefault(); + var prefix = $(this).attr('id').match("^edit_function_block_\\d+")[0]; + $("#" + prefix + "_submit").click(); + return false; + } +}; + // -------------------------------------------------------------------------------- // ------------------------------ sections and items ------------------------------ // -------------------------------------------------------------------------------- diff --git a/templates/webpages/requirement_spec_item/_function_block_form.html b/templates/webpages/requirement_spec_item/_function_block_form.html index 363141046..3c5429533 100644 --- a/templates/webpages/requirement_spec_item/_function_block_form.html +++ b/templates/webpages/requirement_spec_item/_function_block_form.html @@ -50,7 +50,7 @@

- [% L.ajax_submit_tag('controller.pl?action=RequirementSpecItem/ajax_' _ (SELF.item.id ? 'update' : 'create'), '#' _ id_base _ '_form', LxERP.t8('Save')) %] + [% L.ajax_submit_tag('controller.pl?action=RequirementSpecItem/ajax_' _ (SELF.item.id ? 'update' : 'create'), '#' _ id_base _ '_form', LxERP.t8('Save'), id=id_base _ '_submit') %] [%- LxERP.t8("Cancel") %]

-- 2.20.1