Revision c21cba95
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
js/requirement_spec.js | ||
---|---|---|
491 | 491 |
return true; |
492 | 492 |
}; |
493 | 493 |
|
494 |
// ------------------------------------------------------------------------- |
|
495 |
// ------------------------------- tab widget ------------------------------ |
|
496 |
// ------------------------------------------------------------------------- |
|
497 |
var content_div_ids_for_tab_headers = { |
|
498 |
'tab-header-function-block': 'function-blocks-tab' |
|
499 |
, 'tab-header-basic-settings': 'ui-tabs-1' |
|
500 |
, 'tab-header-time-cost-estimate': 'ui-tabs-2' |
|
501 |
, 'tab-header-versions': 'ui-tabs-3' |
|
502 |
, 'tab-header-quotations-orders': 'ui-tabs-4' |
|
503 |
}; |
|
504 |
|
|
505 |
ns.tabs_before_activate = function(event, ui) { |
|
506 |
if (!ui.oldTab) |
|
507 |
return true; |
|
508 |
|
|
509 |
var content_div_id = content_div_ids_for_tab_headers[ $(ui.oldTab).attr('id') ]; |
|
510 |
if (!content_div_id || (content_div_id == 'function-blocks-tab')) |
|
511 |
return true; |
|
512 |
|
|
513 |
var inputs = $('#' + content_div_id).find('input,select,textarea').filter('[type!=hidden]'); |
|
514 |
if (!inputs.size() || confirm(kivi.t8("If you switch to a different tab without saving you will lose the data you've entered in the current tab."))) |
|
515 |
return true; |
|
516 |
|
|
517 |
var new_focus = $(inputs).filter(':focusable')[0]; |
|
518 |
if (new_focus) |
|
519 |
$(new_focus).focus(); |
|
520 |
|
|
521 |
return false; |
|
522 |
}; |
|
523 |
|
|
494 | 524 |
// ------------------------------------------------------------------------- |
495 | 525 |
// ----------------------------- context menus ----------------------------- |
496 | 526 |
// ------------------------------------------------------------------------- |
Auch abrufbar als: Unified diff
Pflichtenhefte: vor Tabwechseln mit Datenverlust nachfragen