From: Moritz Bunkus Date: Wed, 13 Mar 2013 15:50:11 +0000 (+0100) Subject: Pflichtenheftitems: current_content_type/_id nach Auswahl eines bereits Angezeigten... X-Git-Tag: release-3.2.0beta~467^2~211 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7e771bdf6e12012d050819d91dbaa035df465797;p=kivitendo-erp.git Pflichtenheftitems: current_content_type/_id nach Auswahl eines bereits Angezeigten fixen --- diff --git a/SL/Controller/RequirementSpecItem.pm b/SL/Controller/RequirementSpecItem.pm index b1709ce09..326ac8680 100644 --- a/SL/Controller/RequirementSpecItem.pm +++ b/SL/Controller/RequirementSpecItem.pm @@ -40,9 +40,14 @@ sub action_ajax_list { return $self->render($js); } - $self->item(SL::DB::RequirementSpecItem->new(id => $::form->{clicked_id})->load->get_section); + my $clicked_item = SL::DB::RequirementSpecItem->new(id => $::form->{clicked_id})->load; + $self->item($clicked_item->get_section); - $self->render_list($js, $self->item) if !$self->visible_section || ($self->visible_section->id != $self->item->id); + if (!$self->visible_section || ($self->visible_section->id != $self->item->id)) { + $self->render_list($js, $self->item, $clicked_item); + } else { + $self->select_node($js, $clicked_item); + } $self->render($js); } @@ -398,11 +403,16 @@ sub replace_bottom { } sub render_list { - my ($self, $js, $item) = @_; + my ($self, $js, $item, $item_to_select) = @_; my $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $item); - $js->html('#column-content', $html) - ->val( '#current_content_type', $item->get_type) + $self->select_node($js->html('#column-content', $html), $item_to_select || $item); +} + +sub select_node { + my ($self, $js, $item) = @_; + + $js->val( '#current_content_type', $item->get_type) ->val( '#current_content_id', $item->id) ->jstree->select_node('#tree', '#fb-' . $item->id); }