kivitendo/SL/Controller/RequirementSpec.pm @ e2e7e282
b2e1809f | Moritz Bunkus | package SL::Controller::RequirementSpec;
|
||
use strict;
|
||||
84fc52bd | Moritz Bunkus | use utf8;
|
||
b2e1809f | Moritz Bunkus | |||
use parent qw(SL::Controller::Base);
|
||||
b48939fe | Moritz Bunkus | use SL::ClientJS;
|
||
b2e1809f | Moritz Bunkus | use SL::Controller::Helper::GetModels;
|
||
use SL::Controller::Helper::Paginated;
|
||||
use SL::Controller::Helper::Sorted;
|
||||
use SL::Controller::Helper::ParseFilter;
|
||||
use SL::Controller::Helper::ReportGenerator;
|
||||
c19b1e03 | Moritz Bunkus | use SL::Controller::Helper::RequirementSpec;
|
||
b2e1809f | Moritz Bunkus | use SL::DB::Customer;
|
||
use SL::DB::Project;
|
||||
c19b1e03 | Moritz Bunkus | use SL::DB::RequirementSpecComplexity;
|
||
use SL::DB::RequirementSpecRisk;
|
||||
b2e1809f | Moritz Bunkus | use SL::DB::RequirementSpecStatus;
|
||
use SL::DB::RequirementSpecType;
|
||||
use SL::DB::RequirementSpec;
|
||||
use SL::Helper::Flash;
|
||||
use SL::Locale::String;
|
||||
84fc52bd | Moritz Bunkus | use SL::Template::LaTeX;
|
||
b2e1809f | Moritz Bunkus | |||
use Rose::Object::MakeMethods::Generic
|
||||
(
|
||||
9dffe94b | Moritz Bunkus | scalar => [ qw(requirement_spec_item customers types statuses db_args flat_filter visible_item visible_section) ],
|
||
55e399ab | Moritz Bunkus | 'scalar --get_set_init' => [ qw(requirement_spec complexities risks projects copy_source js current_text_block_output_position) ],
|
||
b2e1809f | Moritz Bunkus | );
|
||
__PACKAGE__->run_before('setup');
|
||||
c19b1e03 | Moritz Bunkus | __PACKAGE__->run_before('load_select_options', only => [ qw(new ajax_edit create update list) ]);
|
||
b2e1809f | Moritz Bunkus | |||
405a41ef | Moritz Bunkus | |||
b2e1809f | Moritz Bunkus | __PACKAGE__->get_models_url_params('flat_filter');
|
||
__PACKAGE__->make_paginated(
|
||||
MODEL => 'RequirementSpec',
|
||||
PAGINATE_ARGS => 'db_args',
|
||||
ONLY => [ qw(list) ],
|
||||
);
|
||||
__PACKAGE__->make_sorted(
|
||||
MODEL => 'RequirementSpec',
|
||||
ONLY => [ qw(list) ],
|
||||
DEFAULT_BY => 'customer',
|
||||
DEFAULT_DIR => 1,
|
||||
customer => t8('Customer'),
|
||||
title => t8('Title'),
|
||||
type => t8('Requirement Spec Type'),
|
||||
status => t8('Requirement Spec Status'),
|
||||
projectnumber => t8('Project Number'),
|
||||
51fec310 | Moritz Bunkus | version => t8('Version'),
|
||
mtime => t8('Last modification'),
|
||||
b2e1809f | Moritz Bunkus | );
|
||
#
|
||||
# actions
|
||||
#
|
||||
c19b1e03 | Moritz Bunkus | |||
b2e1809f | Moritz Bunkus | sub action_list {
|
||
my ($self) = @_;
|
||||
$self->setup_db_args_from_filter;
|
||||
$self->flat_filter({ map { $_->{key} => $_->{value} } $::form->flatten_variables('filter') });
|
||||
$self->prepare_report;
|
||||
my $requirement_specs = $self->get_models(%{ $self->db_args });
|
||||
$self->report_generator_list_objects(report => $self->{report}, objects => $requirement_specs);
|
||||
}
|
||||
sub action_new {
|
||||
my ($self) = @_;
|
||||
9dffe94b | Moritz Bunkus | $self->requirement_spec(SL::DB::RequirementSpec->new(is_template => $::form->{is_template}));
|
||
405a41ef | Moritz Bunkus | |||
if ($self->copy_source) {
|
||||
$self->requirement_spec->$_($self->copy_source->$_) for qw(type_id status_id customer_id title hourly_rate)
|
||||
}
|
||||
9f687789 | Moritz Bunkus | $self->render('requirement_spec/new', title => $self->requirement_spec->is_template ? t8('Create a new requirement spec template') : t8('Create a new requirement spec'));
|
||
b2e1809f | Moritz Bunkus | }
|
||
b48939fe | Moritz Bunkus | sub action_ajax_edit {
|
||
b2e1809f | Moritz Bunkus | my ($self) = @_;
|
||
b48939fe | Moritz Bunkus | |||
$self->render('requirement_spec/_form', { layout => 0 }, submit_as => 'ajax');
|
||||
b2e1809f | Moritz Bunkus | }
|
||
c19b1e03 | Moritz Bunkus | sub action_ajax_show_time_and_cost_estimate {
|
||
my ($self) = @_;
|
||||
$self->render('requirement_spec/_show_time_and_cost_estimate', { layout => 0 });
|
||||
}
|
||||
sub action_ajax_cancel_time_and_cost_estimate {
|
||||
my ($self) = @_;
|
||||
my $html = $self->render('requirement_spec/_show_time_and_cost_estimate', { output => 0 });
|
||||
13b0468f | Moritz Bunkus | $self->js
|
||
->replaceWith('#time_cost_estimate', $html)
|
||||
->render($self);
|
||||
c19b1e03 | Moritz Bunkus | }
|
||
sub action_ajax_edit_time_and_cost_estimate {
|
||||
my ($self) = @_;
|
||||
my $html = $self->render('requirement_spec/_edit_time_and_cost_estimate', { output => 0 });
|
||||
13b0468f | Moritz Bunkus | $self->js
|
||
->replaceWith('#time_cost_estimate', $html)
|
||||
->render($self);
|
||||
c19b1e03 | Moritz Bunkus | }
|
||
sub action_ajax_save_time_and_cost_estimate {
|
||||
my ($self) = @_;
|
||||
$self->requirement_spec->db->do_transaction(sub {
|
||||
# Make Emacs happy
|
||||
1;
|
||||
foreach my $attributes (@{ $::form->{requirement_spec_items} || [] }) {
|
||||
SL::DB::RequirementSpecItem
|
||||
->new(id => delete $attributes->{id})
|
||||
->load
|
||||
->update_attributes(%{ $attributes });
|
||||
}
|
||||
1;
|
||||
});
|
||||
4f79e0da | Moritz Bunkus | $self->requirement_spec(SL::DB::RequirementSpec->new(id => $self->requirement_spec->id)->load);
|
||
c19b1e03 | Moritz Bunkus | my $html = $self->render('requirement_spec/_show_time_and_cost_estimate', { output => 0 });
|
||
13b0468f | Moritz Bunkus | $self->js->replaceWith('#time_cost_estimate', $html);
|
||
c19b1e03 | Moritz Bunkus | |||
if ($self->visible_section) {
|
||||
$html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $self->visible_section);
|
||||
13b0468f | Moritz Bunkus | $self->js->html('#column-content', $html);
|
||
c19b1e03 | Moritz Bunkus | }
|
||
13b0468f | Moritz Bunkus | $self->js->render($self);
|
||
c19b1e03 | Moritz Bunkus | }
|
||
c1569bc1 | Moritz Bunkus | sub action_show {
|
||
my ($self) = @_;
|
||||
4cab0b74 | Moritz Bunkus | my $title = $self->requirement_spec->is_template ? t8('Show requirement spec template') : t8('Show requirement spec');
|
||
my $item = $::form->{requirement_spec_item_id} ? SL::DB::RequirementSpecItem->new(id => $::form->{requirement_spec_item_id})->load : @{ $self->requirement_spec->sections }[0];
|
||||
c1569bc1 | Moritz Bunkus | $self->requirement_spec_item($item);
|
||
4cab0b74 | Moritz Bunkus | $self->render('requirement_spec/show', title => $title);
|
||
c1569bc1 | Moritz Bunkus | }
|
||
b2e1809f | Moritz Bunkus | sub action_create {
|
||
my ($self) = @_;
|
||||
b48939fe | Moritz Bunkus | $self->requirement_spec(SL::DB::RequirementSpec->new);
|
||
b2e1809f | Moritz Bunkus | $self->create_or_update;
|
||
}
|
||||
sub action_update {
|
||||
my ($self) = @_;
|
||||
$self->create_or_update;
|
||||
}
|
||||
sub action_destroy {
|
||||
my ($self) = @_;
|
||||
b48939fe | Moritz Bunkus | if (eval { $self->requirement_spec->delete; 1; }) {
|
||
b2e1809f | Moritz Bunkus | flash_later('info', t8('The requirement spec has been deleted.'));
|
||
} else {
|
||||
flash_later('error', t8('The requirement spec is in use and cannot be deleted.'));
|
||||
}
|
||||
$self->redirect_to(action => 'list');
|
||||
}
|
||||
c96c4bb2 | Moritz Bunkus | sub action_revert_to {
|
||
my ($self, %params) = @_;
|
||||
return $self->js->error(t8('Cannot revert a versioned copy.'))->render($self) if $self->requirement_spec->working_copy_id;
|
||||
my $versioned_copy = SL::DB::RequirementSpec->new(id => $::form->{versioned_copy_id})->load;
|
||||
$self->requirement_spec->copy_from(
|
||||
$versioned_copy,
|
||||
version_id => $versioned_copy->version_id,
|
||||
);
|
||||
flash_later('info', t8('The requirement spec has been reverted to version #1.', $self->requirement_spec->version->version_number));
|
||||
$self->js->redirect_to($self->url_for(action => 'show', id => $self->requirement_spec->id))->render($self);
|
||||
}
|
||||
84fc52bd | Moritz Bunkus | sub action_create_pdf {
|
||
my ($self, %params) = @_;
|
||||
my %result = SL::Template::LaTeX->parse_and_create_pdf('requirement_spec.tex', SELF => $self, rspec => $self->requirement_spec);
|
||||
$::form->error(t8('Conversion to PDF failed: #1', $result{error})) if $result{error};
|
||||
my $attachment_name = $self->requirement_spec->type->description . ' ' . ($self->requirement_spec->working_copy_id || $self->requirement_spec->id);
|
||||
$attachment_name .= ' (v' . $self->requirement_spec->version->version_number . ')' if $self->requirement_spec->version;
|
||||
$attachment_name .= '.pdf';
|
||||
$attachment_name =~ s/[^\wäöüÄÖÜß \-\+\(\)\[\]\{\}\.,]+/_/g;
|
||||
$self->send_file($result{file_name}, type => 'application/pdf', name => $attachment_name);
|
||||
unlink $result{file_name};
|
||||
}
|
||||
4cab0b74 | Moritz Bunkus | sub action_select_template_to_paste {
|
||
my ($self) = @_;
|
||||
my @templates = grep { @{ $_->sections } || @{ $_->text_blocks } } @{ SL::DB::Manager::RequirementSpec->get_all(where => [ is_template => 1 ], sort_by => 'lower(title)') };
|
||||
$self->render('requirement_spec/select_template_to_paste', { layout => 0 }, TEMPLATES => \@templates);
|
||||
}
|
||||
55e399ab | Moritz Bunkus | sub action_paste_template {
|
||
my ($self, %params) = @_;
|
||||
my $template = SL::DB::RequirementSpec->new(id => $::form->{template_id})->load;
|
||||
my %result = $self->requirement_spec->paste_template($template);
|
||||
return $self->js->error($self->requirement_spec->error)->render($self) if !%result;
|
||||
$self->render_pasted_text_block($_) for sort { $a->position <=> $b->position } @{ $result{text_blocks} };
|
||||
$self->render_pasted_section($_) for sort { $a->position <=> $b->position } @{ $result{sections} };
|
||||
if (@{ $result{sections} } && (($::form->{current_content_type} || 'sections') eq 'sections') && !$::form->{current_content_id}) {
|
||||
$self->render_first_pasted_section_as_list($result{sections}->[0]);
|
||||
}
|
||||
$self->invalidate_version->render($self);
|
||||
}
|
||||
b2e1809f | Moritz Bunkus | #
|
||
# filters
|
||||
#
|
||||
sub setup {
|
||||
my ($self) = @_;
|
||||
51fec310 | Moritz Bunkus | $::auth->assert('sales_quotation_edit');
|
||
c1569bc1 | Moritz Bunkus | $::request->{layout}->use_stylesheet("${_}.css") for qw(jquery.contextMenu requirement_spec);
|
||
ca7c2f91 | Moritz Bunkus | $::request->{layout}->use_javascript("${_}.js") for qw(jquery.jstree jquery/jquery.contextMenu client_js requirement_spec);
|
||
c19b1e03 | Moritz Bunkus | $self->init_visible_section;
|
||
b2e1809f | Moritz Bunkus | |||
return 1;
|
||||
}
|
||||
c19b1e03 | Moritz Bunkus | sub init_complexities {
|
||
my ($self) = @_;
|
||||
return SL::DB::Manager::RequirementSpecComplexity->get_all_sorted;
|
||||
}
|
||||
sub init_risks {
|
||||
my ($self) = @_;
|
||||
return SL::DB::Manager::RequirementSpecRisk->get_all_sorted;
|
||||
}
|
||||
sub init_projects {
|
||||
my ($self) = @_;
|
||||
$self->projects(SL::DB::Manager::Project->get_all_sorted);
|
||||
}
|
||||
sub init_requirement_spec {
|
||||
54daa586 | Moritz Bunkus | my ($self) = @_;
|
||
c19b1e03 | Moritz Bunkus | $self->requirement_spec(SL::DB::RequirementSpec->new(id => $::form->{id})->load || die "No such requirement spec") if $::form->{id};
|
||
54daa586 | Moritz Bunkus | }
|
||
405a41ef | Moritz Bunkus | sub init_copy_source {
|
||
my ($self) = @_;
|
||||
$self->copy_source(SL::DB::RequirementSpec->new(id => $::form->{copy_source_id})->load) if $::form->{copy_source_id};
|
||||
}
|
||||
13b0468f | Moritz Bunkus | sub init_js {
|
||
my ($self) = @_;
|
||||
$self->js(SL::ClientJS->new);
|
||||
}
|
||||
55e399ab | Moritz Bunkus | sub init_current_text_block_output_position {
|
||
my ($self) = @_;
|
||||
$self->current_text_block_output_position($::form->{current_content_type} !~ m/^(?:text-blocks|tb)-(front|back)/ ? -1 : $1 eq 'front' ? 0 : 1);
|
||||
}
|
||||
54daa586 | Moritz Bunkus | sub load_select_options {
|
||
my ($self) = @_;
|
||||
my @filter = ('!obsolete' => 1);
|
||||
c19b1e03 | Moritz Bunkus | @filter = ( or => [ @filter, id => $self->requirement_spec->customer_id ] ) if $self->requirement_spec && $self->requirement_spec->customer_id;
|
||
54daa586 | Moritz Bunkus | |||
$self->customers(SL::DB::Manager::Customer->get_all_sorted(where => \@filter));
|
||||
$self->statuses( SL::DB::Manager::RequirementSpecStatus->get_all_sorted);
|
||||
$self->types( SL::DB::Manager::RequirementSpecType->get_all_sorted);
|
||||
}
|
||||
b2e1809f | Moritz Bunkus | #
|
||
# helpers
|
||||
#
|
||||
sub create_or_update {
|
||||
my $self = shift;
|
||||
b48939fe | Moritz Bunkus | my $is_new = !$self->requirement_spec->id;
|
||
b2e1809f | Moritz Bunkus | my $params = delete($::form->{requirement_spec}) || { };
|
||
b48939fe | Moritz Bunkus | $self->requirement_spec->assign_attributes(%{ $params });
|
||
b2e1809f | Moritz Bunkus | |||
9f687789 | Moritz Bunkus | my $title = $is_new && $self->requirement_spec->is_template ? t8('Create a new requirement spec template')
|
||
9dffe94b | Moritz Bunkus | : $is_new ? t8('Create a new requirement spec')
|
||
9f687789 | Moritz Bunkus | : $self->requirement_spec->is_template ? t8('Edit requirement spec template')
|
||
9dffe94b | Moritz Bunkus | : t8('Edit requirement spec');
|
||
b48939fe | Moritz Bunkus | my @errors = $self->requirement_spec->validate;
|
||
b2e1809f | Moritz Bunkus | |||
if (@errors) {
|
||||
13b0468f | Moritz Bunkus | return $self->js->error(@errors)->render($self) if $::request->is_ajax;
|
||
b48939fe | Moritz Bunkus | |||
b2e1809f | Moritz Bunkus | flash('error', @errors);
|
||
b48939fe | Moritz Bunkus | $self->render('requirement_spec/new', title => $title);
|
||
b2e1809f | Moritz Bunkus | return;
|
||
}
|
||||
405a41ef | Moritz Bunkus | my $db = $self->requirement_spec->db;
|
||
if (!$db->do_transaction(sub {
|
||||
if ($self->copy_source) {
|
||||
$self->requirement_spec($self->copy_source->create_copy(%{ $params }));
|
||||
} else {
|
||||
$self->requirement_spec->save;
|
||||
}
|
||||
})) {
|
||||
$::lxdebug->message(LXDebug::WARN(), "Error: " . $db->error);
|
||||
51fec310 | Moritz Bunkus | @errors = ($::locale->text('Saving failed. Error message from the database: #1'), $db->error);
|
||
13b0468f | Moritz Bunkus | return $self->js->error(@errors)->render($self) if $::request->is_ajax;
|
||
405a41ef | Moritz Bunkus | |||
$self->requirement_spec->id(undef) if $is_new;
|
||||
flash('error', @errors);
|
||||
return $self->render('requirement_spec/new', title => $title);
|
||||
}
|
||||
b48939fe | Moritz Bunkus | |||
9f687789 | Moritz Bunkus | my $info = $self->requirement_spec->is_template ? t8('The requirement spec template has been saved.') : t8('The requirement spec has been saved.');
|
||
9dffe94b | Moritz Bunkus | |||
b48939fe | Moritz Bunkus | if ($::request->is_ajax) {
|
||
my $html = $self->render('requirement_spec/_header', { output => 0 });
|
||||
b4fc4933 | Moritz Bunkus | return $self->invalidate_version
|
||
b48939fe | Moritz Bunkus | ->replaceWith('#requirement-spec-header', $html)
|
||
9dffe94b | Moritz Bunkus | ->flash('info', $info)
|
||
b48939fe | Moritz Bunkus | ->render($self);
|
||
}
|
||||
b2e1809f | Moritz Bunkus | |||
9dffe94b | Moritz Bunkus | flash_later('info', $info);
|
||
b48939fe | Moritz Bunkus | $self->redirect_to(action => 'show', id => $self->requirement_spec->id);
|
||
b2e1809f | Moritz Bunkus | }
|
||
sub setup_db_args_from_filter {
|
||||
my ($self) = @_;
|
||||
$self->{filter} = {};
|
||||
my %args = parse_filter(
|
||||
$::form->{filter},
|
||||
with_objects => [ 'customer', 'type', 'status', 'project' ],
|
||||
launder_to => $self->{filter},
|
||||
);
|
||||
$args{where} = [
|
||||
and => [
|
||||
@{ $args{where} || [] },
|
||||
51fec310 | Moritz Bunkus | working_copy_id => undef,
|
||
9dffe94b | Moritz Bunkus | is_template => $::form->{is_template} ? 1 : 0,
|
||
b2e1809f | Moritz Bunkus | ]];
|
||
$self->db_args(\%args);
|
||||
}
|
||||
sub prepare_report {
|
||||
my ($self) = @_;
|
||||
my $callback = $self->get_callback;
|
||||
9dffe94b | Moritz Bunkus | my $is_template = $::form->{is_template};
|
||
b2e1809f | Moritz Bunkus | my $report = SL::ReportGenerator->new(\%::myconfig, $::form);
|
||
$self->{report} = $report;
|
||||
9dffe94b | Moritz Bunkus | my @columns = $is_template ? qw(title mtime) : qw(title customer status type projectnumber mtime version);
|
||
my @sortable = $is_template ? qw(title mtime) : qw(title customer status type projectnumber mtime);
|
||||
b2e1809f | Moritz Bunkus | |||
my %column_defs = (
|
||||
b48939fe | Moritz Bunkus | title => { obj_link => sub { $self->url_for(action => 'show', id => $_[0]->id, callback => $callback) } },
|
||
1f1ee792 | Moritz Bunkus | mtime => { sub => sub { ($_[0]->mtime || $_[0]->itime)->to_kivitendo(precision => 'minute') } },
|
||
b2e1809f | Moritz Bunkus | );
|
||
9dffe94b | Moritz Bunkus | if (!$is_template) {
|
||
%column_defs = (
|
||||
%column_defs,
|
||||
customer => { raw_data => sub { $self->presenter->customer($_[0]->customer, display => 'table-cell', callback => $callback) },
|
||||
sub => sub { $_[0]->customer->name } },
|
||||
projectnumber => { raw_data => sub { $self->presenter->project($_[0]->project, display => 'table-cell', callback => $callback) },
|
||||
sub => sub { $_[0]->project_id ? $_[0]->project->projectnumber : '' } },
|
||||
status => { sub => sub { $_[0]->status->description } },
|
||||
type => { sub => sub { $_[0]->type->description } },
|
||||
version => { sub => sub { $_[0]->version_id ? $_[0]->version->version_number : t8('Working copy without version') } },
|
||||
);
|
||||
}
|
||||
b2e1809f | Moritz Bunkus | map { $column_defs{$_}->{text} ||= $::locale->text( $self->get_sort_spec->{$_}->{title} ) } keys %column_defs;
|
||
$report->set_options(
|
||||
std_column_visibility => 1,
|
||||
controller_class => 'RequirementSpec',
|
||||
output_format => 'HTML',
|
||||
9dffe94b | Moritz Bunkus | raw_top_info_text => $self->render('requirement_spec/report_top', { output => 0 }, is_template => $is_template),
|
||
b2e1809f | Moritz Bunkus | raw_bottom_info_text => $self->render('requirement_spec/report_bottom', { output => 0 }),
|
||
9f687789 | Moritz Bunkus | title => $is_template ? t8('Requirement Spec Templates') : t8('Requirement Specs'),
|
||
b2e1809f | Moritz Bunkus | allow_pdf_export => 1,
|
||
allow_csv_export => 1,
|
||||
);
|
||||
$report->set_columns(%column_defs);
|
||||
$report->set_column_order(@columns);
|
||||
$report->set_export_options(qw(list filter));
|
||||
$report->set_options_from_form;
|
||||
$self->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable);
|
||||
$self->disable_pagination if $report->{options}{output_format} =~ /^(pdf|csv)$/i;
|
||||
}
|
||||
b4fc4933 | Moritz Bunkus | sub invalidate_version {
|
||
my ($self) = @_;
|
||||
my $rspec = SL::DB::RequirementSpec->new(id => $self->requirement_spec->id)->load;
|
||||
9dffe94b | Moritz Bunkus | return $self->js if $rspec->is_template;
|
||
b4fc4933 | Moritz Bunkus | $rspec->invalidate_version;
|
||
my $html = $self->render('requirement_spec/_version', { output => 0 }, requirement_spec => $rspec);
|
||||
return $self->js->html('#requirement_spec_version', $html);
|
||||
}
|
||||
55e399ab | Moritz Bunkus | sub render_pasted_text_block {
|
||
my ($self, $text_block, %params) = @_;
|
||||
if ($self->current_text_block_output_position == $text_block->output_position) {
|
||||
my $html = $self->render('requirement_spec_text_block/_text_block', { output => 0 }, text_block => $text_block);
|
||||
$self->js
|
||||
->appendTo($html, '#text-block-list')
|
||||
->hide('#text-block-list-empty');
|
||||
}
|
||||
my $node = $self->presenter->requirement_spec_text_block_jstree_data($text_block);
|
||||
my $front_back = $text_block->output_position == 0 ? 'front' : 'back';
|
||||
$self->js
|
||||
->jstree->create_node('#tree', "#tb-${front_back}", 'last', $node)
|
||||
->jstree->open_node( '#tree', "#tb-${front_back}");
|
||||
}
|
||||
sub render_pasted_section {
|
||||
my ($self, $item, $parent_id) = @_;
|
||||
my $node = $self->presenter->requirement_spec_item_jstree_data($item);
|
||||
$self->js
|
||||
->jstree->create_node('#tree', $parent_id ? "#fb-${parent_id}" : '#sections', 'last', $node)
|
||||
->jstree->open_node( '#tree', $parent_id ? "#fb-${parent_id}" : '#sections');
|
||||
$self->render_pasted_section($_, $item->id) for @{ $item->children_sorted };
|
||||
}
|
||||
sub render_first_pasted_section_as_list {
|
||||
my ($self, $section, %params) = @_;
|
||||
my $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $section);
|
||||
$self->js
|
||||
->html('#column-content', $html)
|
||||
->val( '#current_content_type', $section->item_type)
|
||||
->val( '#current_content_id', $section->id)
|
||||
->jstree->select_node('#tree', '#fb-' . $section->id);
|
||||
}
|
||||
b2e1809f | Moritz Bunkus | 1;
|