From ee74ea829d19e553d14e0f7bbdf9ee189cff3c36 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 9 Apr 2014 16:44:48 +0200 Subject: [PATCH] P.part_picker reicht jetzt das flag fat_set_item durch und schluckt nicht mehr class --- SL/Presenter/Part.pm | 7 ++++++- js/autocomplete_part.js | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/SL/Presenter/Part.pm b/SL/Presenter/Part.pm index daa7d7310..9533e1d6c 100644 --- a/SL/Presenter/Part.pm +++ b/SL/Presenter/Part.pm @@ -29,9 +29,14 @@ sub part_picker { $value = SL::DB::Manager::Part->find_by(id => $value) if $value && !ref $value; my $id = delete($params{id}) || $self->name_to_id($name); + my $fat_set_item = delete $params{fat_set_item}; + + my @classes = $params{class} ? ($params{class}) : (); + push @classes, 'part_autocomplete'; + push @classes, 'partpicker_fat_set_item' if $fat_set_item; my $ret = - $self->input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => 'part_autocomplete', type => 'hidden', id => $id) . + $self->input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => "@classes", type => 'hidden', id => $id) . join('', map { $params{$_} ? $self->input_tag("", delete $params{$_}, id => "${id}_${_}", type => 'hidden') : '' } qw(column type unit convertible_unit)) . $self->input_tag("", (ref $value && $value->can('description')) ? $value->description : '', id => "${id}_name", %params); diff --git a/js/autocomplete_part.js b/js/autocomplete_part.js index a08130b63..d0984eb01 100644 --- a/js/autocomplete_part.js +++ b/js/autocomplete_part.js @@ -16,8 +16,7 @@ namespace('kivi', function(k){ var o = $.extend({ limit: 20, delay: 50, - fat_set_item: 0, // use this option to get a fat item json with all - // relevant data instead of the guaranteed id + name + fat_set_item: $real.hasClass('partpicker_fat_set_item'), }, options); var STATES = { UNIQUE: 1, -- 2.20.1