1 package SL::Presenter::Part;
7 use Exporter qw(import);
8 our @EXPORT = qw(part_picker);
11 my ($self, $name, $value, %params) = @_;
12 my $name_e = $self->escape($name);
14 $value = SL::DB::Manager::Part->find_by(id => $value) if !ref $value;
17 $self->input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => 'part_autocomplete', type => 'hidden') .
18 $self->input_tag("", delete $params{type}, id => $self->name_to_id("$name_e\_type"), type => 'hidden') .
19 $self->input_tag("", (ref $value && $value->can('description')) ? $value->description : '', id => $self->name_to_id("$name_e\_name"), %params) .
20 $self->input_tag("", delete $params{column}, id => $self->name_to_id("$name_e\_column"), type => 'hidden');
22 $self->html_tag('span', $ret, class => 'part_picker');
33 SL::Presenter::Part - Part lelated presenter stuff
47 =item C<part_picker NAME, VALUE, PARAMS>
49 All-in-one picker widget for parts. The name will be both id and name of the
50 resulting hidden C<id> input field. An additional dummy input will be generated
51 which is used to find parts. For a detailed description of it's behaviour, see
52 section C<PART PICKER SPECIFICATION>.
54 C<VALUE> can be an id or C<Rose::DB:Object> instance.
56 If C<PARAMS> contains C<type> only parts of this type will be used for
57 autocompletion. You may comma separate multiple types as in C<part,assembly>.
59 Obsolete parts will by default not displayed for selection. However they are
60 accepted as default values and can persist during updates. As with other
61 selectors though, they are not selectable once overridden.
63 Currently you must include C<js/autocomplete_part.js> in your controller, the
64 presenter can not do this from the template.
74 Picker icons aren't displayed with css menu, because the spritemap is not loaded.
80 Sven Schöling E<lt>s.schoeling@linet-services.deE<gt>