Pflichtenhefte: nach Anlegen eines Funktionsblocks gleich nächste Anlege-Form anzeigen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 17 Jul 2013 10:22:42 +0000 (12:22 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:09:06 +0000 (13:09 +0200)
SL/Controller/RequirementSpecItem.pm

index 73c8555..33ff067 100644 (file)
@@ -205,6 +205,8 @@ sub action_ajax_create {
 
   $self->replace_bottom($self->item->parent) if $type eq 'sub-function-block';
 
+  $self->add_new_item_form_after_create if $type =~ m/function-block/;
+
   $self->invalidate_version->render($self);
 }
 
@@ -591,6 +593,19 @@ sub add_new_item_form {
     ->focus("#${id_base}_description");
 }
 
+sub add_new_item_form_after_create {
+  my ($self, %params) = @_;
+
+  my $created_item = $self->item;
+  $self->item(SL::DB::RequirementSpecItem->new(requirement_spec_id => $created_item->requirement_spec_id, parent_id => $created_item->parent_id, item_type => $created_item->item_type));
+
+  $self->add_new_item_form(
+    insert_position   => 'insertAfter',
+    insert_reference  => $created_item->id,
+    display_reference => '#' . $created_item->item_type . '-' . $created_item->id,
+  );
+}
+
 sub add_function_block {
   my ($self, $new_type) = @_;