[BUGFIX] Do not scroll on top using actions on multipleSideBySide 14/47014/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Mon, 29 Feb 2016 08:07:40 +0000 (09:07 +0100)
committerBenni Mack <benni@typo3.org>
Thu, 3 Mar 2016 17:13:02 +0000 (18:13 +0100)
This patch prevents scrolling to top when using the actions buttons
in multipleSideBySide elements.

Change-Id: I0841b3f75afca8596725fc6c9e4621eaeeafc641
Resolves: #72973
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/47014
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js

index 084abd2..5753428 100644 (file)
@@ -591,7 +591,7 @@ abstract class AbstractFormElement extends AbstractNode
                 if ($sSize >= 5) {
                     $icons['L'][] = '
                                                <a href="#"
-                                                       class="btn btn-default t3-btn-moveoption-top"
+                                                       class="btn btn-default t3js-btn-moveoption-top"
                                                        data-fieldname="' . $fName . '"
                                                        title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_to_top')) . '">
                                                        ' . $this->iconFactory->getIcon('actions-move-to-top', Icon::SIZE_SMALL)->render() . '
@@ -599,14 +599,14 @@ abstract class AbstractFormElement extends AbstractNode
                 }
                 $icons['L'][] = '
                                        <a href="#"
-                                               class="btn btn-default t3-btn-moveoption-up"
+                                               class="btn btn-default t3js-btn-moveoption-up"
                                                data-fieldname="' . $fName . '"
                                                title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_up')) . '">
                                                ' . $this->iconFactory->getIcon('actions-move-up', Icon::SIZE_SMALL)->render() . '
                                        </a>';
                 $icons['L'][] = '
                                        <a href="#"
-                                               class="btn btn-default t3-btn-moveoption-down"
+                                               class="btn btn-default t3js-btn-moveoption-down"
                                                data-fieldname="' . $fName . '"
                                                title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_down')) . '">
                                                ' . $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render() . '
@@ -614,7 +614,7 @@ abstract class AbstractFormElement extends AbstractNode
                 if ($sSize >= 5) {
                     $icons['L'][] = '
                                                <a href="#"
-                                                       class="btn btn-default t3-btn-moveoption-bottom"
+                                                       class="btn btn-default t3js-btn-moveoption-bottom"
                                                        data-fieldname="' . $fName . '"
                                                        title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_to_bottom')) . '">
                                                        ' . $this->iconFactory->getIcon('actions-move-to-bottom', Icon::SIZE_SMALL)->render() . '
@@ -649,7 +649,7 @@ abstract class AbstractFormElement extends AbstractNode
         if (!$params['readOnly'] && !$params['noDelete']) {
             $icons['L'][] = '
                                <a href="#"
-                                       class="btn btn-default t3-btn-removeoption"
+                                       class="btn btn-default t3js-btn-removeoption"
                                        onClick="' . $rOnClickInline . '"
                                        data-fieldname="' . $fName . '"
                                        title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.remove_selected')) . '">
index ebcbdfc..9cbbc12 100644 (file)
@@ -568,21 +568,23 @@ define(['jquery',
 
                // track the arrows "Up", "Down", "Clear" etc in multi-select boxes
                $(document).on('click', '.t3-btn-moveoption-top, .t3-btn-moveoption-up, .t3-btn-moveoption-down, .t3-btn-moveoption-bottom, .t3-btn-removeoption', function(evt) {
+                       evt.preventDefault();
+
                        var $el = $(this)
                                        ,fieldName = $el.data('fieldname')
                                        ,$listFieldEl = FormEngine.getFieldElement(fieldName, '_list');
 
                        if ($listFieldEl.length > 0) {
 
-                               if ($el.hasClass('t3-btn-moveoption-top')) {
+                               if ($el.hasClass('t3js-btn-moveoption-top')) {
                                        FormEngine.moveOptionToTop($listFieldEl);
-                               } else if ($el.hasClass('t3-btn-moveoption-up')) {
+                               } else if ($el.hasClass('t3js-btn-moveoption-up')) {
                                        FormEngine.moveOptionUp($listFieldEl);
-                               } else if ($el.hasClass('t3-btn-moveoption-down')) {
+                               } else if ($el.hasClass('t3js-btn-moveoption-down')) {
                                        FormEngine.moveOptionDown($listFieldEl);
-                               } else if ($el.hasClass('t3-btn-moveoption-bottom')) {
+                               } else if ($el.hasClass('t3js-btn-moveoption-bottom')) {
                                        FormEngine.moveOptionToBottom($listFieldEl);
-                               } else if ($el.hasClass('t3-btn-removeoption')) {
+                               } else if ($el.hasClass('t3js-btn-removeoption')) {
                                        FormEngine.removeOption($listFieldEl);
                                }