Add singleItem option for ReactionHandler
authorJoshua Rüsweg <josh@bastelstu.be>
Thu, 9 Aug 2018 09:49:01 +0000 (11:49 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Thu, 9 Aug 2018 09:49:11 +0000 (11:49 +0200)
See #2508

wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Reaction/Handler.js

index a599e4221f818c8d916abebb8b65ac6b150ae514..83911b8d52814a711c3426c380bc4ced3edbb127 100644 (file)
@@ -53,6 +53,7 @@ define(
                                        buttonSelector: '.reactButton', 
                                        containerSelector: '',
                                        isButtonGroupNavigation: false,
+                                       isSingleItem: false,
                                        
                                        // other stuff
                                        parameters: {
@@ -102,7 +103,12 @@ define(
                         * Initializes a specific react button.
                         */
                        _initReactButton: function(element, elementData) {
-                               elementData.reactButton = elBySel(this._options.buttonSelector, element);
+                               if (this._options.isSingleItem) {
+                                       elementData.reactButton = elBySel(this._options.buttonSelector);
+                               }
+                               else {
+                                       elementData.reactButton = elBySel(this._options.buttonSelector, element);
+                               }
                                
                                if (elementData.reactButton === null || elementData.reactButton.length === 0) {
                                        // the element may have no react button