From: Moritz Bunkus Date: Wed, 11 May 2011 11:18:41 +0000 (+0200) Subject: Automatisches Neu-Einfärben nach Drag&Drop X-Git-Tag: release-2.6.3~25^2~62 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3c0769d8f8720ed0b9b0b81e6a6128360a70c932;p=kivitendo-erp.git Automatisches Neu-Einfärben nach Drag&Drop --- diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index 5a59e025d..0d159dc85 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -410,14 +410,29 @@ sub sortable_element { } JAVASCRIPT + my $stop_event = ''; + if ($params{url} && $params{with}) { my $as = $params{as} || $params{with}; my $filter = ".filter(function(idx) { return this.substr(0, " . length($params{with}) . ") == '$params{with}'; })"; $filter .= ".map(function(idx, str) { return str.replace('$params{with}_', ''); })"; + $stop_event = <*:odd').removeClass('listrow1').removeClass('listrow0').addClass('listrow0'); + \$('${selector}>*:even').removeClass('listrow1').removeClass('listrow0').addClass('listrow1'); +JAVASCRIPT + } + + if ($stop_event) { $attributes{stop} = < + +If trueish then the children will not be recolored. The default is to +recolor the children by setting the class C on odd and +C on even entries. + =back Example: @@ -704,9 +725,10 @@ Example: [% L.sortable_element('#thing_list tbody', - 'url' => 'controller.pl?action=SystemThings/reorder', - 'with' => 'thingy', - 'as' => 'thing_ids') %] + url => 'controller.pl?action=SystemThings/reorder', + with => 'thingy', + as => 'thing_ids', + recolor_rows => 1) %] After dropping e.g. the third element at the top of the list a POST request would be made to the C action of the C