Pflichtenheftitems: bei RETURN in Zeitabschätzung per AJAX abschicken
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 31 Jul 2013 11:03:32 +0000 (13:03 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:09:08 +0000 (13:09 +0200)
SL/Controller/RequirementSpecItem.pm
js/requirement_spec.js
templates/webpages/requirement_spec_item/_function_block_form.html

index 0797a3f..7b1ed81 100644 (file)
@@ -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)
index 3e4c485..567f893 100644 (file)
@@ -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 ------------------------------
 // --------------------------------------------------------------------------------
index 3631410..3c54295 100644 (file)
@@ -50,7 +50,7 @@
  </div>
 
  <p>
-  [% 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') %]
   <a href="#" onclick="kivi.requirement_spec.cancel_edit_item_form('[% id_base %]', { [% a_options %] })">[%- LxERP.t8("Cancel") %]</a>
  </p>
 </form>