Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 880a2e9f

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 880a2e9f233d585d9e1a3d8dc17b2795b8513fcf
  • Vorgänger e39a5a77
  • Nachfolger df33875f

Partpicker: Filtermöglichkeit nach Einheiten ('unit')

Unterschiede anzeigen:

SL/Presenter/Part.pm
15 15

  
16 16
  my $ret =
17 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');
18
    join('', map { $params{$_} ? $self->input_tag("", delete $params{$_}, id => "${id}_${_}", type => 'hidden') : '' } qw(column type unit)) .
19
    $self->input_tag("", (ref $value && $value->can('description')) ? $value->description : '', id => "${id}_name", %params);
21 20

  
22 21
  $self->html_tag('span', $ret, class => 'part_picker');
23 22
}
......
60 59
for autocompletion. You may comma separate multiple types as in
61 60
C<part,assembly>.
62 61

  
62
If C<%params> contains C<unit> only parts with this unit will be used
63
for autocompletion. You may comma separate multiple units as in
64
C<h,min>.
65

  
63 66
Obsolete parts will by default not displayed for selection. However they are
64 67
accepted as default values and can persist during updates. As with other
65 68
selectors though, they are not selectable once overridden.
js/autocomplete_part.js
12 12
    var real_id = $real.attr('id');
13 13
    var $dummy  = $('#' + real_id + '_name');
14 14
    var $type   = $('#' + real_id + '_type');
15
    var $unit   = $('#' + real_id + '_unit');
15 16
    var $column = $('#' + real_id + '_column');
16 17
    var state   = STATES.PICKED;
17 18
    var last_real = $real.val();
......
35 36
        current:  $real.val(),
36 37
      };
37 38

  
38
      var type = $type.val();
39
      if (type !== '')
40
        data['filter.type'] = type.split(',');
39
      if ($type && $type.val())
40
        data['filter.type'] = $type.val().split(',');
41

  
42
      if ($unit && $unit.val())
43
        data['filter.unit'] = $unit.val().split(',');
41 44

  
42 45
      return data;
43 46
    }
......
150 153
      real:           function() { return $real },
151 154
      dummy:          function() { return $dummy },
152 155
      type:           function() { return $type },
156
      unit:           function() { return $unit },
153 157
      column:         function() { return $column },
154 158
      update_results: update_results,
155 159
      set_item:       set_item,

Auch abrufbar als: Unified diff