Revision 9e278d06
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/Presenter/Part.pm | ||
---|---|---|
9 | 9 |
|
10 | 10 |
sub part_picker { |
11 | 11 |
my ($self, $name, $value, %params) = @_; |
12 |
my $name_e = $self->escape($name); |
|
13 | 12 |
|
14 | 13 |
$value = SL::DB::Manager::Part->find_by(id => $value) if !ref $value; |
14 |
my $id = delete($params{id}) || $self->name_to_id($name); |
|
15 | 15 |
|
16 | 16 |
my $ret = |
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');
|
|
17 |
$self->input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => 'part_autocomplete', type => 'hidden', id => $id) .
|
|
18 |
$self->input_tag("", delete $params{type}, id => "${id}_type", type => 'hidden') .
|
|
19 |
$self->input_tag("", (ref $value && $value->can('description')) ? $value->description : '', id => "${id}_name", %params) .
|
|
20 |
$self->input_tag("", delete $params{column}, id => "${id}_column", type => 'hidden');
|
|
21 | 21 |
|
22 | 22 |
$self->html_tag('span', $ret, class => 'part_picker'); |
23 | 23 |
} |
... | ... | |
44 | 44 |
|
45 | 45 |
=over 4 |
46 | 46 |
|
47 |
=item C<part_picker NAME, VALUE, PARAMS>
|
|
47 |
=item C<part_picker $name, $value, %params>
|
|
48 | 48 |
|
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>. |
|
49 |
All-in-one picker widget for parts. The name will be both id and name |
|
50 |
of the resulting hidden C<id> input field (but the ID can be |
|
51 |
overwritten with C<$params{id}>). |
|
53 | 52 |
|
54 |
C<VALUE> can be an id or C<Rose::DB:Object> instance. |
|
53 |
An additional dummy input will be generated which is used to find |
|
54 |
parts. For a detailed description of it's behaviour, see section |
|
55 |
C<PART PICKER SPECIFICATION>. |
|
55 | 56 |
|
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>. |
|
57 |
C<$value> can be a parts id or a C<Rose::DB:Object> instance. |
|
58 |
|
|
59 |
If C<%params> contains C<type> only parts of this type will be used |
|
60 |
for autocompletion. You may comma separate multiple types as in |
|
61 |
C<part,assembly>. |
|
58 | 62 |
|
59 | 63 |
Obsolete parts will by default not displayed for selection. However they are |
60 | 64 |
accepted as default values and can persist during updates. As with other |
Auch abrufbar als: Unified diff
Partpicker: ID-Attribut manuell angeben können