Adds scrollableDropdownMenu support for label choosers
authorMatthias Schmidt <gravatronics@live.com>
Sat, 12 Oct 2013 13:24:19 +0000 (15:24 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 12 Oct 2013 13:24:19 +0000 (15:24 +0200)
wcfsetup/install/files/js/WCF.Label.js

index d02625f96e781e383d2e50ac16573e917c23c88f..a9ef8b8ac124896cb4270f503ae4a22721e39c2e 100644 (file)
@@ -184,20 +184,26 @@ WCF.Label.Chooser = Class.extend({
                                        $dropdownMenu = WCF.Dropdown.getDropdownMenu($containerID);
                                }
                                
+                               var $additionalList = $dropdownMenu;
+                               if ($dropdownMenu.getTagName() == 'div' && $dropdownMenu.children('.scrollableDropdownMenu').length) {
+                                       $additionalList = $('<ul />').appendTo($dropdownMenu);
+                                       $dropdownMenu = $dropdownMenu.children('.scrollableDropdownMenu');
+                               }
+                               
                                this._groups[$groupID] = $group;
                                
                                $dropdownMenu.children('li').data('groupID', $groupID).click($.proxy(this._click, this));
                                
                                if (!$group.data('forceSelection') || this._showWithoutSelection) {
-                                       $('<li class="dropdownDivider" />').appendTo($dropdownMenu);
+                                       $('<li class="dropdownDivider" />').appendTo($additionalList);
                                }
                                
                                if (this._showWithoutSelection) {
-                                       $('<li data-label-id="-1"><span><span class="badge label">' + WCF.Language.get('wcf.label.withoutSelection') + '</span></span></li>').data('groupID', $groupID).appendTo($dropdownMenu).click($.proxy(this._click, this));
+                                       $('<li data-label-id="-1"><span><span class="badge label">' + WCF.Language.get('wcf.label.withoutSelection') + '</span></span></li>').data('groupID', $groupID).appendTo($additionalList).click($.proxy(this._click, this));
                                }
                                
                                if (!$group.data('forceSelection')) {
-                                       var $buttonEmpty = $('<li data-label-id="0"><span><span class="badge label">' + WCF.Language.get('wcf.label.none') + '</span></span></li>').data('groupID', $groupID).appendTo($dropdownMenu);
+                                       var $buttonEmpty = $('<li data-label-id="0"><span><span class="badge label">' + WCF.Language.get('wcf.label.none') + '</span></span></li>').data('groupID', $groupID).appendTo($additionalList);
                                        $buttonEmpty.click($.proxy(this._click, this));
                                }
                        }
@@ -263,4 +269,4 @@ WCF.Label.Chooser = Class.extend({
                        }
                }
        }
-});
\ No newline at end of file
+});