if (!$is_template) {
%column_defs = (
%column_defs,
- customer => { raw_data => sub { $self->presenter->customer($_[0]->customer, display => 'table-cell', callback => $callback) },
+ customer => { raw_data => sub { $_[0]->customer->presenter->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) },
+ projectnumber => { raw_data => sub { $_[0]->project ? $_[0]->project->presenter->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 } },
->hide('#text-block-list-empty');
}
- my $node = $self->presenter->requirement_spec_text_block_jstree_data($text_block);
+ my $node = $text_block->presenter->jstree_data;
my $front_back = $text_block->output_position == 0 ? 'front' : 'back';
$self->js
->jstree->create_node('#tree', "#tb-${front_back}", 'last', $node)
sub render_pasted_section {
my ($self, $item, $parent_id) = @_;
- my $node = $self->presenter->requirement_spec_item_jstree_data($item);
+ my $node = $item->presenter->jstree_data;
$self->js
->jstree->create_node('#tree', $parent_id ? "#fb-${parent_id}" : '#sections', 'last', $node)
->jstree->open_node( '#tree', $parent_id ? "#fb-${parent_id}" : '#sections');
use SL::Helper::Flash;
use SL::JSON;
use SL::Locale::String;
+use SL::Presenter::Text qw(truncate);
use Rose::Object::MakeMethods::Generic
(
my $type = $self->item->item_type;
if ($type eq 'section') {
- my $node = $self->presenter->requirement_spec_item_jstree_data($self->item);
+ my $node = $self->item->presenter->jstree_data;
$self->invalidate_version;
$self->render_list($self->item)
->hide('#section-list-empty')
my $template = 'requirement_spec_item/_' . (apply { s/-/_/g; $_ } $type);
my $html = $self->render($template, { output => 0 }, requirement_spec_item => $self->item, id_prefix => $type eq 'function-block' ? '' : 'sub-');
- my $node = $self->presenter->requirement_spec_item_jstree_data($self->item);
+ my $node = $self->item->presenter->jstree_data;
$self->js
->replaceWith('#' . $prefix . '_form', $html)
->remove('#edit_section_form')
->html('#section-header-' . $self->item->id, $html)
->show('#section-header-' . $self->item->id)
- ->jstree->rename_node('#tree', '#fb-' . $self->item->id, $::request->presenter->requirement_spec_item_tree_node_title($self->item))
+ ->jstree->rename_node('#tree', '#fb-' . $self->item->id, $self->item->presenter->tree_node_title)
->prop('#fb-' . $self->item->id . ' a', 'title', $self->item->content_excerpt)
->addClass('#fb-' . $self->item->id . ' a', 'tooltip')
->reinit_widgets
->prop('#fb-' . $self->item->id . ' a', 'title', $self->item->content_excerpt)
->addClass('#fb-' . $self->item->id . ' a', 'tooltip')
->reinit_widgets
- ->jstree->rename_node('#tree', '#fb-' . $self->item->id, $::request->presenter->requirement_spec_item_tree_node_title($self->item));
+ ->jstree->rename_node('#tree', '#fb-' . $self->item->id, $self->item->presenter->tree_node_title);
$self->replace_bottom($self->item, id_prefix => $id_prefix);
$self->replace_bottom($self->item->parent) if $type eq 'sub-function-block';
sub create_and_insert_node_rec {
my ($self, $item, $new_parent_id, $insert_after) = @_;
- my $node = $self->presenter->requirement_spec_item_jstree_data($item);
+ my $node = $item->presenter->jstree_data;
$self->js->jstree->create_node('#tree', $insert_after ? ('#fb-' . $insert_after, 'after') : $new_parent_id ? ('#fb-' . $new_parent_id, 'last') : ('#sections', 'last'), $node);
$self->create_and_insert_node_rec($_, $item->id) for @{ $item->children || [] };
sub create_dependency_item {
my $self = shift;
- [ $_[0]->id, $self->presenter->truncate(join(' ', grep { $_ } ($_[1], $_[0]->fb_number, $_[0]->description_as_stripped_html))) ];
+ [ $_[0]->id, truncate(join(' ', grep { $_ } ($_[1], $_[0]->fb_number, $_[0]->description_as_stripped_html))) ];
}
sub create_dependencies {
$self->text_block->add_to_list(position => 'after', reference => $insert_after) if $insert_after;
my $html = $self->render('requirement_spec_text_block/_text_block', { output => 0 }, text_block => $self->text_block);
- my $node = $self->presenter->requirement_spec_text_block_jstree_data($self->text_block);
+ my $node = $self->text_block->presenter->jstree_data;
$self->invalidate_version
->hide('#text-block-list-empty')
$self->js->action($::form->{id} ? 'insertAfter' : 'appendTo', $html, '#text-block-' . ($::form->{id} || 'list'));
}
- my $node = $self->presenter->requirement_spec_text_block_jstree_data($self->text_block);
+ my $node = $self->text_block->presenter->jstree_data;
$self->invalidate_version
->run(SORTABLE_PICTURE_LIST())
->jstree->create_node('#tree', $::form->{id} ? ('#tb-' . $::form->{id}, 'after') : ("#tb-${front_back}", 'last'), $node)
\begin{longtable}{p{2.8cm}p{11.7cm}}
Funktionsblock & $( KiviLatex.filter(item.fb_number) )$\\
Beschreibung & $( KiviLatex.filter_html(item.description_as_restricted_html) )$\\
- Abhängigkeiten & $( KiviLatex.filter(P.requirement_spec_item_dependency_list(item)) )$
+ Abhängigkeiten & $( KiviLatex.filter(item.presenter.requirement_spec_item_dependency_list) )$
\end{longtable}}
% $( FOREACH sub_item = item.children_sorted )$
\begin{longtable}{p{2.8cm}p{11.7cm}}
Unterfunktionsblock & $( KiviLatex.filter(sub_item.fb_number) )$\\
Beschreibung & $( KiviLatex.filter_html(sub_item.description_as_restricted_html) )$\\
- Abhängigkeiten & $( KiviLatex.filter(P.requirement_spec_item_dependency_list(sub_item)) )$
+ Abhängigkeiten & $( KiviLatex.filter(sub_item.presenter.requirement_spec_item_dependency_list) )$
\end{longtable}}
% $( END )$
attr: { id: "tb-front", class: "text-block-context-menu" },
children: [
[% FOREACH tb = SELF.requirement_spec.text_blocks_sorted(output_position=0) %]
- [% P.requirement_spec_text_block_jstree_data(tb).json %][% IF !loop.last %],[% END %]
+ [% tb.presenter.jstree_data.json %][% IF !loop.last %],[% END %]
[% END %]
]},
attr: { id: "sections", class: "section-context-menu" },
children: [
[% FOREACH section = sections %]
- [% P.requirement_spec_item_jstree_data(section).json %][% IF !loop.last %],[% END %]
+ [% section.presenter.jstree_data.json %][% IF !loop.last %],[% END %]
[% END %]
]},
attr: { id: "tb-back", class: "text-block-context-menu" },
children: [
[% FOREACH tb = SELF.requirement_spec.text_blocks_sorted(output_position=1) %]
- [% P.requirement_spec_text_block_jstree_data(tb).json %][% IF !loop.last %],[% END %]
+ [% tb.presenter.jstree_data.json %][% IF !loop.last %],[% END %]
[% END %]
]}
];
[%- USE LxERP -%][%- USE P -%]<div id="[% id_prefix %]function-block-content-bottom-[% requirement_spec_item.id %]" class="smaller" style="text-align:right">
[%- IF requirement_spec_item.dependencies.size -%]
<span class="gray">
- [%- LxERP.t8("Dependencies") -%]: [%- P.requirement_spec_item_dependency_list(requirement_spec_item) -%]
+ [%- LxERP.t8("Dependencies") -%]: [%- requirement_spec_item.presenter.requirement_spec_item_dependency_list -%]
</span><br>
[%- END -%]
<span class="gray">
<tr>
<td>[% LxERP.t8("Assign the following article to all sections") %]:</td>
<td data-unit="[% HTML.escape(SELF.section_order_part.unit) %]">
- [% P.part_picker('quotations_and_orders_dummy', SELF.section_order_part.id, id='quotations_and_orders_order_id', style=style) %]
+ [% P.part.picker('quotations_and_orders_dummy', SELF.section_order_part.id, id='quotations_and_orders_order_id', style=style) %]
[% L.button_tag('kivi.requirement_spec.assign_order_part_id_to_all()', LxERP.t8('Assign article')) %]
</td>
</tr>
<td>[% HTML.escape(section.fb_number) %]</td>
<td>[% HTML.escape(section.title) %]</td>
<td>[% HTML.escape(P.truncate(section.description_as_stripped_html)) %]</td>
- <td>[% P.part_picker('sections[].order_part_id', section.order_part_id, id='quotations_and_orders_sections_order_pard_id_' _ loop.count, style=style) %]</td>
+ <td>[% P.part.picker('sections[].order_part_id', section.order_part_id, id='quotations_and_orders_sections_order_pard_id_' _ loop.count, style=style) %]</td>
<td data-unit-column=1>[% HTML.escape(section.order_part.unit) %]</td>
<td data-position-type-column=1>
[% IF section.order_part_id && section.order_part.unit_obj.is_time_based %]
<div>
[% LxERP.t8("Add part") %]:
- [% P.part_picker('additional_parts_add_part_id', '', style="width: 300px") %]
+ [% P.part.picker('additional_parts_add_part_id', '', style="width: 300px") %]
[% L.button_tag('kivi.requirement_spec.add_additional_part()', LxERP.t8('Add part')) %]
</div>