Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2015b4b3

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID 2015b4b39c078152726dfd57215f602e4a4ce668
  • Vorgänger fe7ed06d
  • Nachfolger a81e9e42

Pflichtenheftitems: RETURN in Zeitschätzungs-Input via AJAX submitten gefixt

Unterschiede anzeigen:

SL/Controller/RequirementSpec.pm
261 261

  
262 262
  $::auth->assert('sales_quotation_edit');
263 263
  $::request->{layout}->use_stylesheet("${_}.css") for qw(jquery.contextMenu requirement_spec);
264
  $::request->{layout}->use_javascript("${_}.js") for qw(jquery.jstree jquery/jquery.contextMenu requirement_spec);
264
  $::request->{layout}->use_javascript("${_}.js")  for qw(jquery.jstree jquery/jquery.contextMenu jquery/jquery.hotkeys requirement_spec);
265 265
  $self->init_visible_section;
266 266

  
267 267
  return 1;
SL/Controller/RequirementSpecItem.pm
258 258
    ->hide($content_top_id)
259 259
    ->remove("#${id_base}_form")
260 260
    ->insertAfter($html, $content_top_id)
261
    ->on("#${id_base}_form INPUT[type=text]", "keydown", "kivi.requirement_spec.text_block_input_key_down")
261
    ->run('kivi.requirement_spec.init_function_block_keypress_events', "${id_base}_form")
262 262
    ->jstree->select_node('#tree', '#fb-' . $self->item->id)
263 263
    ->focus("#${id_base}_description")
264 264
    ->val('#current_content_type', $self->item->item_type)
......
601 601

  
602 602
  return $self->js
603 603
    ->action($params{insert_position}, $html, $params{display_reference})
604
    ->run('kivi.requirement_spec.init_function_block_keypress_events', "${id_base}_form")
604 605
    ->focus("#${id_base}_description");
605 606
}
606 607

  
js/requirement_spec.js
178 178
  return true;
179 179
};
180 180

  
181
ns.text_block_input_key_down = function(event) {
182
  if(event.keyCode == 13) {
183
    event.preventDefault();
184
    var prefix = $(this).attr('id').match("^edit_function_block_\\d+")[0];
185
    $("#" + prefix + "_submit").click();
186
    return false;
187
  }
188
};
189

  
190 181
ns.find_text_block_picture_id = function(clicked_elt) {
191 182
  var id    = $(clicked_elt).attr('id');
192 183
  var match = id.match(/^text-block-picture-(\d+)$/);
......
350 341
  return ns.handle_item_popup_menu_markings(opt, false);
351 342
};
352 343

  
344
ns.submit_function_block = function(event) {
345
  event.preventDefault();
346

  
347
  var prefix = $(this).attr('id').match("^(?:edit|new)_function_block_[\\d_]+\\d")[0];
348
  kivi.submit_ajax_form('controller.pl?action=RequirementSpecItem/ajax_update', '#' + prefix + '_form');
349

  
350
  return false;
351
};
352

  
353
ns.init_function_block_keypress_events = function(form_id) {
354
  $("#" + form_id + " INPUT[type=text]").bind("keypress", "return", ns.submit_function_block);
355
};
356

  
353 357
// -------------------------------------------------------------------------
354 358
// ------------------------------- templates -------------------------------
355 359
// -------------------------------------------------------------------------

Auch abrufbar als: Unified diff