From 1b522616312493ada2474275859ca9a9d79a40bb Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 11 May 2011 12:41:19 +0200 Subject: [PATCH] =?utf8?q?Verbesserte=20Kompatibilit=C3=A4t=20mit=20Opera,?= =?utf8?q?=20FireFox,=20InternetExplorer=20bei=20Drag=20&=20Drop?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Wenn Textauswahl mit ".disableSelection()" deaktiviert ist, so kann man bei den genannten Browsern Text-Eingabefelder nicht mehr anklicken. Statt dessen sind nun nur noch die Pfeile drag&drop-bar, der Rest der Zeile nicht mehr. --- SL/Template/Plugin/L.pm | 16 +++++++++++++--- templates/webpages/am/edit_units.html | 4 ++-- templates/webpages/am/list_price_factors.html | 4 ++-- templates/webpages/am/list_warehouses.html | 4 ++-- templates/webpages/amcvar/list_cvar_configs.html | 4 ++-- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index d6c8ca2b7..5a59e025d 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -400,10 +400,11 @@ sub sortable_element { my ($self, $selector, @slurp) = @_; my %params = _hashify(@slurp); - my %attributes = ( helper => < 5, + helper => <<'JAVASCRIPT' ); function(event, ui) { ui.children().each(function() { - \$(this).width(\$(this).width()); + $(this).width($(this).width()); }); return ui; } @@ -422,12 +423,14 @@ JAVASCRIPT JAVASCRIPT } + $attributes{handle} = "'$params{handle}'" if $params{handle}; + my $attr_str = join(', ', map { "${_}: $attributes{$_}" } keys %attributes); my $code = < \$(function() { - \$( "${selector}" ).sortable({ ${attr_str} }).disableSelection(); + \$( "${selector}" ).sortable({ ${attr_str} }) }); JAVASCRIPT @@ -676,6 +679,13 @@ C<$params{as}> or, missing that, C<$params{with}>. Sets the POST parameter name for AJAX request after dropping an element (see C<$params{with}>). +=item C + +An optional jQuery selector specifying which part of the child element +is dragable. If nothing is given then the whole child element is +dragable, and clicks through to underlying elements like inputs or +links might not work. + =back Example: diff --git a/templates/webpages/am/edit_units.html b/templates/webpages/am/edit_units.html index 4d3b3e3e0..9d228d5da 100644 --- a/templates/webpages/am/edit_units.html +++ b/templates/webpages/am/edit_units.html @@ -100,7 +100,7 @@ [% FOREACH row = UNITS %] - [ LxERP.t8('reorder item') %] + [ LxERP.t8('reorder item') %] [% IF row.in_use %] @@ -145,7 +145,7 @@ - [% L.sortable_element('#unit_list tbody', 'url' => 'controller.pl?action=Unit/reorder', 'with' => 'unit_id') %] + [% L.sortable_element('#unit_list tbody', 'url' => 'controller.pl?action=Unit/reorder', 'with' => 'unit_id', handle => '.dragdrop') %] diff --git a/templates/webpages/am/list_price_factors.html b/templates/webpages/am/list_price_factors.html index 4c81bbb11..c220a8dd0 100644 --- a/templates/webpages/am/list_price_factors.html +++ b/templates/webpages/am/list_price_factors.html @@ -19,7 +19,7 @@ [% FOREACH factor = PRICE_FACTORS %] - [ LxERP.t8('reorder item') %] + [ LxERP.t8('reorder item') %] [% HTML.escape(factor.description) %] [% HTML.escape(factor.factor) %] @@ -38,7 +38,7 @@

- [% L.sortable_element('#price_factor_list tbody', 'url' => 'controller.pl?action=PriceFactor/reorder', 'with' => 'price_factor_id') %] + [% L.sortable_element('#price_factor_list tbody', 'url' => 'controller.pl?action=PriceFactor/reorder', 'with' => 'price_factor_id', handle => '.dragdrop') %] diff --git a/templates/webpages/am/list_warehouses.html b/templates/webpages/am/list_warehouses.html index e47e7c241..b791e7de8 100644 --- a/templates/webpages/am/list_warehouses.html +++ b/templates/webpages/am/list_warehouses.html @@ -20,7 +20,7 @@ [% FOREACH warehouse = WAREHOUSES %] - [ LxERP.t8('reorder item') %] + [ LxERP.t8('reorder item') %] [% HTML.escape(warehouse.description) %] [% HTML.escape(warehouse.number_of_bins) %] [% IF warehouse.invalid %][% 'Yes' | $T8 %][% ELSE %][% 'No' | $T8 %][% END %] @@ -39,7 +39,7 @@

- [% L.sortable_element('#warehouse_list tbody', 'url' => 'controller.pl?action=Warehouse/reorder', 'with' => 'warehouse_id') %] + [% L.sortable_element('#warehouse_list tbody', 'url' => 'controller.pl?action=Warehouse/reorder', 'with' => 'warehouse_id', handle => '.dragdrop') %] diff --git a/templates/webpages/amcvar/list_cvar_configs.html b/templates/webpages/amcvar/list_cvar_configs.html index 7652a01d6..b2e4b9ab8 100644 --- a/templates/webpages/amcvar/list_cvar_configs.html +++ b/templates/webpages/amcvar/list_cvar_configs.html @@ -39,7 +39,7 @@ [%- FOREACH cfg = CONFIGS %] - [ LxERP.t8('reorder item') %] + [ LxERP.t8('reorder item') %] @@ -89,7 +89,7 @@

- [% L.sortable_element('#cvarcfg_list tbody', 'url' => 'controller.pl?action=CustomVariableConfig/reorder', 'with' => 'cvarcfg_id') %] + [% L.sortable_element('#cvarcfg_list tbody', 'url' => 'controller.pl?action=CustomVariableConfig/reorder', 'with' => 'cvarcfg_id', handle => '.dragdrop') %] -- 2.20.1