[BUGFIX] Install tool: Use CardLayout events to init card 94/53794/3
authorFrank Naegler <frank.naegler@typo3.org>
Wed, 23 Aug 2017 18:07:59 +0000 (20:07 +0200)
committerBenni Mack <benni@typo3.org>
Wed, 23 Aug 2017 20:35:21 +0000 (22:35 +0200)
Some install tool cards load content on opening the card.
The patch now fires events on open and modules single card
JS binds to those events to load content.
This fixes the prev/next buttons in docheader to init
card content correctly.

Resolves: #82185
Releases: master
Change-Id: Iad04a0fc560df8511f716982456b2ac3ae0644bb
Reviewed-on: https://review.typo3.org/53794
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/install/Resources/Public/JavaScript/Modules/CardLayout.js
typo3/sysext/install/Resources/Public/JavaScript/Modules/ClearTables.js
typo3/sysext/install/Resources/Public/JavaScript/Modules/DatabaseAnalyzer.js
typo3/sysext/install/Resources/Public/JavaScript/Modules/ImageProcessing.js
typo3/sysext/install/Resources/Public/JavaScript/Modules/UpgradeDocs.js
typo3/sysext/install/Resources/Public/JavaScript/Modules/UpgradeWizards.js

index 964ee2c..cb5757e 100644 (file)
@@ -101,6 +101,7 @@ define(['jquery', 'bootstrap'], function ($) {
                        }
                        CardLayout.checkNavigationButtons();
                });
+               $(document).trigger('cardlayout:card-opened', [$element]);
        };
 
        /**
@@ -125,6 +126,7 @@ define(['jquery', 'bootstrap'], function ($) {
                        }
                        CardLayout.checkNavigationButtons();
                });
+               $(document).trigger('cardlayout:card-closed', [$element]);
        };
 
        /**
index b751a15..0f3a34e 100644 (file)
@@ -24,7 +24,7 @@ define([
        'use strict';
 
        return {
-               selectorGridderOpener: '.t3js-clearTables-open',
+               selectorGridderOpener: 't3js-clearTables-open',
                selectorClearToken: '#t3js-clearTables-clear-token',
                selectorClearTrigger: '.t3js-clearTables-clear',
                selectorStatsTrigger: '.t3js-clearTables-stats',
@@ -40,10 +40,9 @@ define([
                        var self = this;
 
                        // Load stats on first open
-                       $(document).on('click', this.selectorGridderOpener, function(event) {
-                               var $element = $(event.target).closest(self.selectorGridderOpener);
-                               if (!$element.data('isInitialized')) {
-                                       $element.data('isInitialized', true);
+                       $(document).on('cardlayout:card-opened', function(event, $card) {
+                               if ($card.hasClass(self.selectorGridderOpener) && !$card.data('isInitialized')) {
+                                       $card.data('isInitialized', true);
                                        self.getStats();
                                }
                        });
index 9600c60..4e3fbb9 100644 (file)
@@ -18,7 +18,7 @@ define(['jquery', 'TYPO3/CMS/Install/FlashMessage', 'TYPO3/CMS/Install/ProgressB
        'use strict';
 
        return {
-               selectorGridderOpener: '.t3js-databaseAnalyzer-open',
+               selectorGridderOpener: 't3js-databaseAnalyzer-open',
                selectorAnalyzeTrigger: '.t3js-databaseAnalyzer-analyze',
                selectorExecuteTrigger: '.t3js-databaseAnalyzer-execute',
                selectorOutputContainer: '.t3js-databaseAnalyzer-output',
@@ -29,10 +29,9 @@ define(['jquery', 'TYPO3/CMS/Install/FlashMessage', 'TYPO3/CMS/Install/ProgressB
                        var self = this;
 
                        // Load main content on first open
-                       $(document).on('click', this.selectorGridderOpener, function(event) {
-                               var $element = $(event.target).closest(self.selectorGridderOpener);
-                               if (!$element.data('databaseAnalyzerInitialized')) {
-                                       $element.data('databaseAnalyzerInitialized', true);
+                       $(document).on('cardlayout:card-opened', function(event, $card) {
+                               if ($card.hasClass(self.selectorGridderOpener) && !$card.data('isInitialized')) {
+                                       $card.data('isInitialized', true);
                                        self.analyze();
                                }
                        });
index ce21232..acfe098 100644 (file)
@@ -24,7 +24,7 @@ define(['jquery',
     'use strict';
 
     return {
-        selectorGridderOpener: '.t3js-imageProcessing-open',
+        selectorGridderOpener: 't3js-imageProcessing-open',
         selectorImageProcessingToken: '#t3js-imageProcessing-token',
         selectorExecuteTrigger: '.t3js-imageProcessing-execute',
         selectorTestContainer: '.t3js-imageProcessing-twinContainer',
@@ -36,11 +36,10 @@ define(['jquery',
         initialize: function() {
             var self = this;
 
-            // Run tests on first open
-            $(document).on('click', this.selectorGridderOpener, function(event) {
-                var $element = $(event.target).closest(self.selectorGridderOpener);
-                if (!$element.data('isInitialized')) {
-                    $element.data('isInitialized', true);
+            // Load main content on first open
+            $(document).on('cardlayout:card-opened', function(event, $card) {
+                if ($card.hasClass(self.selectorGridderOpener) && !$card.data('isInitialized')) {
+                    $card.data('isInitialized', true);
                     self.runTests();
                 }
             });
index d451a6e..e2ef91b 100644 (file)
@@ -18,7 +18,7 @@ define(['jquery', 'bootstrap', 'chosen'], function ($) {
        'use strict';
 
        return {
-               selectorGridderOpener: '.t3js-upgradeDocs-open',
+               selectorGridderOpener: 't3js-upgradeDocs-open',
                selectorMarkReadToken: '#t3js-upgradeDocs-markRead-token',
                selectorUnmarkReadToken: '#t3js-upgradeDocs-unmarkRead-token',
                selectorRestFileItem: '.upgrade_analysis_item_to_filter',
@@ -47,17 +47,20 @@ define(['jquery', 'bootstrap', 'chosen'], function ($) {
                        });
 
                        // Delayed initialize of some stuff on first open
-                       $(document).on('click', this.selectorGridderOpener, function(event) {
-                               $('[data-toggle="tooltip"]').tooltip({container: 'body'});
-                               self.chosenField = $(self.selectorChosenField);
-                               self.fulltextSearchField = $(self.selectorFulltextSearch);
-                               self.initializeChosenSelector();
-                               self.chosenField.on('change', function() {
-                                       self.combinedFilterSearch();
-                               });
-                               self.fulltextSearchField.on('keyup', function() {
-                                       self.combinedFilterSearch();
-                               });
+                       // Load main content on first open
+                       $(document).on('cardlayout:card-opened', function(event, $card) {
+                               if ($card.hasClass(self.selectorGridderOpener)) {
+                                       $('[data-toggle="tooltip"]').tooltip({container: 'body'});
+                                       self.chosenField = $(self.selectorChosenField);
+                                       self.fulltextSearchField = $(self.selectorFulltextSearch);
+                                       self.initializeChosenSelector();
+                                       self.chosenField.on('change', function() {
+                                               self.combinedFilterSearch();
+                                       });
+                                       self.fulltextSearchField.on('keyup', function() {
+                                               self.combinedFilterSearch();
+                                       });
+                               }
                        });
                },
 
index fb549f6..403e0e9 100644 (file)
@@ -25,7 +25,7 @@ function($, FlashMessage, ProgressBar, InfoBox, Severity) {
        'use strict';
 
        return {
-               selectorGridderOpener: '.t3js-upgradeWizards-open',
+               selectorGridderOpener: 't3js-upgradeWizards-open',
                selectorMarkUndoneToken: '#t3js-upgradeWizards-markUndone-token',
                selectorOutputWizardsContainer: '.t3js-upgradeWizards-wizards-output',
                selectorOutputDoneContainer: '.t3js-upgradeWizards-done-output',
@@ -58,10 +58,10 @@ function($, FlashMessage, ProgressBar, InfoBox, Severity) {
                        var self = this;
 
                        // Load main content on first open
-                       $(document).on('click', this.selectorGridderOpener, function(event) {
-                               var $element = $(event.target).closest(self.selectorGridderOpener);
-                               if (!$element.data('upgradeWizardInitialized')) {
-                                       $element.data('upgradeWizardInitialized', true);
+                       // Load main content on first open
+                       $(document).on('cardlayout:card-opened', function(event, $card) {
+                               if ($card.hasClass(self.selectorGridderOpener) && !$card.data('isInitialized')) {
+                                       $card.data('isInitialized', true);
                                        self.silentUpgrades();
                                        self.doneUpgrades();
                                }