->jstree->create_node('#tree', $insert_after ? ('#fb-' . $insert_after, 'after') : ('#sections', 'last'), $node)
->jstree->select_node('#tree', '#fb-' . $self->item->id);
return $self->add_new_item_form_after_create
+ ->reinit_widgets
->render($self);
}
->replaceWith('#' . $prefix . '_form', $html)
->hide('#section-list-empty')
->jstree->create_node('#tree', $insert_after ? ('#fb-' . $insert_after, 'after') : ('#fb-' . $self->item->parent_id, 'last'), $node)
+ ->reinit_widgets
->jstree->select_node('#tree', '#fb-' . $self->item->id);
$self->replace_bottom($self->item->parent) if $type eq 'sub-function-block';
->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))
+ ->prop('#fb-' . $self->item->id, 'title', $self->item->content_excerpt)
->render($self);
}
$self->js
->remove('#' . $prefix . '_form')
->replaceWith('#' . $id_prefix . 'top-' . $self->item->id, $html_top)
+ ->prop('#fb-' . $self->item->id, 'title', $self->item->content_excerpt)
->jstree->rename_node('#tree', '#fb-' . $self->item->id, $::request->presenter->requirement_spec_item_tree_node_title($self->item));
$self->replace_bottom($self->item, id_prefix => $id_prefix);
->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);
$self->add_new_text_block_form(output_position => $self->text_block->output_position, insert_after_id => $self->text_block->id, requirement_spec_id => $self->text_block->requirement_spec_id)
+ ->reinit_widgets
->render($self);
}
->replaceWith('#text-block-' . $self->text_block->id, $html)
->run(SORTABLE_PICTURE_LIST())
->jstree->rename_node('#tree', '#tb-' . $self->text_block->id, $self->text_block->title)
+ ->prop('#tb-' . $self->text_block->id, 'title', $self->text_block->content_excerpt)
->render($self);
}
use Rose::DB::Object::Helpers;
use Rose::DB::Object::Util;
+use SL::Common ();
use SL::DB::MetaSetup::RequirementSpecItem;
use SL::DB::Manager::RequirementSpecItem;
use SL::DB::Helper::ActsAsList;
return $self->item_type eq 'section' ? 'function-block' : 'sub-function-block';
}
+sub content_excerpt {
+ my ($self) = @_;
+
+ return Common::truncate($self->description // '', at => 200);
+}
+
+
1;
__END__
use Rose::DB::Object::Helpers;
use Rose::DB::Object::Util;
+use SL::Common ();
use SL::DB::MetaSetup::RequirementSpecTextBlock;
use SL::DB::Manager::RequirementSpecTextBlock;
use SL::DB::Helper::ActsAsList;
return [ sort { $a->position <=> $b->position } $self->pictures ];
}
+sub content_excerpt {
+ my ($self) = @_;
+
+ return Common::truncate($self->text // '', at => 200);
+}
+
1;
my @children = map { $self->requirement_spec_item_jstree_data($_, %params) } @{ $item->children_sorted };
my $type = !$item->parent_id ? 'section' : 'function-block';
- my $class = $type . '-context-menu';
+ my $class = $type . '-context-menu tooltip';
$class .= ' flagged' if $item->is_flagged;
return {
data => $self->requirement_spec_item_tree_node_title($item),
metadata => { id => $item->id, type => $type },
- attr => { id => "fb-" . $item->id, href => $params{href} || '#', class => $class },
+ attr => { id => "fb-" . $item->id, href => $params{href} || '#', class => $class, title => $item->content_excerpt },
children => \@children,
};
}
sub requirement_spec_text_block_jstree_data {
my ($self, $text_block, %params) = @_;
- my $class = 'text-block-context-menu';
+ my $class = 'text-block-context-menu tooltip';
$class .= ' flagged' if $text_block->is_flagged;
return {
data => $text_block->title || '',
metadata => { id => $text_block->id, type => 'text-block' },
- attr => { id => "tb-" . $text_block->id, href => $params{href} || '#', class => $class },
+ attr => { id => "tb-" . $text_block->id, href => $params{href} || '#', class => $class, title => $text_block->content_excerpt },
};
}
var func = kivi.get_function_by_name('local_reinit_widgets');
if (func)
func();
+
+ ns.run_once_for('.tooltip', 'tooltip', function(elt) {
+ $(elt).tooltip();
+ });
};
ns.submit_ajax_form = function(url, form_selector, additional_data) {
[%- END -%]
];
- $('#tree').jstree({
+ $('#tree')
+ .bind('loaded.jstree', function() {
+ kivi.reinit_widgets();
+[% IF SELF.requirement_spec_item %]
+ $.jstree._reference("#tree").select_node('#fb-[% SELF.requirement_spec_item.id %]', true);
+[% END %]
+ })
+ .jstree({
core: {
animation: 0,
initially_open: initially_open,
})
.bind("move_node.jstree", kivi.requirement_spec.tree_node_moved)
.bind("click.jstree", kivi.requirement_spec.tree_node_clicked);
-[% IF SELF.requirement_spec_item %]
- $.jstree._reference("#tree").select_node('#fb-[% SELF.requirement_spec_item.id %]', true);
-[% END %]
kivi.requirement_spec.create_context_menus([% SELF.requirement_spec.is_template ? 'true' : 'false' %]);
$('#requirement_spec_tabs').on("tabsbeforeactivate", kivi.requirement_spec.tabs_before_activate);