Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e822adb3

Von Moritz Bunkus vor etwa 10 Jahren hinzugefügt

  • ID e822adb3f7c61a1148cd6f73be2bb302ab704e0f
  • Vorgänger 1947cd9a
  • Nachfolger eecee9b5

Pflichtenhefte: Funktion Abschnitte/Funktionsblöcke neu nummerieren

Unterschiede anzeigen:

js/requirement_spec.js
413 413
    .bind('keypress', 'shift+return', function(event) { return ns.submit_function_block.apply(this, [ event, true ]); });
414 414
};
415 415

  
416
ns.renumber_callback = function(accepted) {
417
  console.log(accepted ? "yay :)" : "oh no :(");
418
  if (!accepted)
419
    return;
420

  
421
  $.ajax({
422
    url:     'controller.pl?action=RequirementSpec/renumber_sections',
423
    type:    'post',
424
    data:    { id: $('#requirement_spec_id').val() },
425
    success: kivi.eval_json_result
426
  });
427
};
428

  
429
ns.renumber = function(opt) {
430
  $('#rs-dialog-confirm').remove();
431

  
432
  var text1   = kivi.t8('Re-numbering all sections and function blocks in the order they are currently shown cannot be undone.');
433
  var text2   = kivi.t8('Do you really want do continue?');
434
  var $dialog = $('<div id="rs-dialog-confirm"><p>' + text1 + '</p><p>' + text2 + '</p></div>').hide().appendTo('body');
435
  var buttons = {};
436

  
437
  buttons[kivi.t8('Yes')] = function() {
438
    $(this).dialog('close');
439
    ns.renumber_callback(true);
440
  };
441

  
442
  buttons[kivi.t8('No')] = function() {
443
    $(this).dialog('close');
444
    ns.renumber_callback(false);
445
  };
446

  
447
  $dialog.dialog({
448
      resizable: false
449
    , modal:     true
450
    , title:     kivi.t8('Are you sure?')
451
    , height:    250
452
    , width:     400
453
    , buttons:   buttons
454
  });
455
};
456

  
416 457
// -------------------------------------------------------------------------
417 458
// ------------------------------- templates -------------------------------
418 459
// -------------------------------------------------------------------------
......
829 870
      // , sep99:           "---------"
830 871
      , copy_reqspec:    { name: kivi.t8('Copy template'),   icon: "copy",   callback: kivi.requirement_spec.copy_reqspec   }
831 872
      , delete_reqspec:  { name: kivi.t8('Delete template'), icon: "delete", callback: kivi.requirement_spec.delete_reqspec }
873
      , sep_paste_template: "---------"
874
      , renumber:        { name: kivi.t8('Renumber sections and function blocks'), icon: "renumber", callback: kivi.requirement_spec.renumber }
832 875
    };
833 876

  
834 877
    $.contextMenu({
......
848 891
      , copy_reqspec:       { name: kivi.t8('Copy requirement spec'),   icon: "copy",   callback: kivi.requirement_spec.copy_reqspec   }
849 892
      , delete_reqspec:     { name: kivi.t8('Delete requirement spec'), icon: "delete", callback: kivi.requirement_spec.delete_reqspec }
850 893
      , sep_paste_template: "---------"
894
      , renumber:           { name: kivi.t8('Renumber sections and function blocks'), icon: "renumber", callback: kivi.requirement_spec.renumber }
895
      , sep_paste_template: "---------"
851 896
      , paste_template:     { name: kivi.t8('Paste template'),     icon: "paste",  callback: kivi.requirement_spec.paste_template }
852 897
    };
853 898

  

Auch abrufbar als: Unified diff