]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Controller/RequirementSpecTextBlock.pm
Pflichtenhefttextblöcke: nach Anlegen Node im Baum fokussieren
[mfinanz.git] / SL / Controller / RequirementSpecTextBlock.pm
index eaf8b6fdcbf527f7c316c346d356507136acc8ee..c4f37de105e85467b6cf18938a338405f225a1b9 100644 (file)
@@ -126,6 +126,7 @@ sub action_ajax_create {
   SL::ClientJS->new
     ->replaceWith('#' . $::form->{form_prefix} . '_form', $html)
     ->jstree->create_node('#tree', $insert_after ? ('#tb-' . $insert_after, 'after') : ('#tb-' . ($attributes->{output_position} == 0 ? 'front' : 'back'), 'last'), $node)
+    ->jstree->select_node('#tree', '#tb-' . $self->text_block->id)
     ->render($self);
 }
 
@@ -273,7 +274,7 @@ sub output_position_from_id {
     return undef                 if $type !~ m/text-block/;
   }
 
-  my $text_block = SL::DB::Manager::RequirementSpecTextBlock->find_by(id => $id);
+  my $text_block = $id ? SL::DB::Manager::RequirementSpecTextBlock->find_by(id => $id) : undef;
 
   return $text_block ? $text_block->output_position : undef;
 }