Reset FontAweosme search filter on show
authorAlexander Ebert <ebert@woltlab.com>
Tue, 5 Sep 2017 12:09:29 +0000 (14:09 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 5 Sep 2017 12:09:29 +0000 (14:09 +0200)
Fixes #2396

wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/Filter.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Style/FontAwesome.js

index 8c717fe229ea6c97d5f0c9b79b030cdfb772bf83..42a7de9a2882fd8db68729560f60708b75463e30 100644 (file)
@@ -78,8 +78,7 @@ define(['Core', 'EventKey', 'Language', 'List', 'StringUtil', 'Dom/Util'], funct
                        clearButton.addEventListener('click', (function(event) {
                                event.preventDefault();
                                
-                               this._input.value = '';
-                               this._keyup();
+                               this.reset();
                        }).bind(this));
                        
                        inputAddon.appendChild(input);
@@ -94,6 +93,14 @@ define(['Core', 'EventKey', 'Language', 'List', 'StringUtil', 'Dom/Util'], funct
                        this._fragment = null;
                },
                
+               /**
+                * Resets the filter.
+                */
+               reset: function () {
+                       this._input.value = '';
+                       this._keyup();
+               },
+               
                /**
                 * Builds the item list and rebuilds the items' DOM for easier manipulation.
                 * 
index bb18f8aca1d80e08a438fb34859450591e8f6bd2..e77213bb8c9f05c7e373ea947dc2d6da91b660ed 100644 (file)
@@ -20,7 +20,7 @@ define(['Language', 'Ui/Dialog', 'WoltLabSuite/Core/Ui/ItemList/Filter'], functi
                return Fake;
        }
        
-       var _callback, _iconList;
+       var _callback, _iconList, _itemListFilter;
        var _icons = [];
        
        /**
@@ -88,7 +88,7 @@ define(['Language', 'Ui/Dialog', 'WoltLabSuite/Core/Ui/ItemList/Filter'], functi
                                                _iconList.innerHTML = html;
                                                _iconList.addEventListener(WCF_CLICK_EVENT, this._click.bind(this));
                                                
-                                               new UiItemListFilter('fontAwesomeIcons', {
+                                               _itemListFilter = new UiItemListFilter('fontAwesomeIcons', {
                                                        callbackPrepareItem: function (item) {
                                                                var small = elBySel('small', item);
                                                                var text = small.textContent.trim();
@@ -101,6 +101,9 @@ define(['Language', 'Ui/Dialog', 'WoltLabSuite/Core/Ui/ItemList/Filter'], functi
                                                        }
                                                });
                                        }).bind(this),
+                                       onShow: function () {
+                                               _itemListFilter.reset();
+                                       },
                                        title: Language.get('wcf.global.fontAwesome.selectIcon')
                                },
                                source: '<ul class="fontAwesomeIcons" id="fontAwesomeIcons"></ul>'