Generates the dropdown menu containing groups
169870
public function generateDropdownMenu($show_group)
    {
        $show_group = Container::get('hooks')->fire('model.userlist.generate_dropdown_menu_start', $show_group);

        $dropdown_menu = '';

        $result['select'] = ['g_id', 'g_title'];

        $result = DB::forTable('groups')
            ->selectMany($result['select'])
            ->whereNotEqual('g_id', ForumEnv::get('FEATHER_GUEST'))
            ->orderByExpr('g_id');
        $result = Container::get('hooks')->fireDB('model.userlist.generate_dropdown_menu_query', $result);
        $result = $result->findMany();

        foreach ($result as $cur_group) {
            if ($cur_group['g_id'] == $show_group) {
                $dropdown_menu .= "\t\t\t\t\t\t\t" . '<option value="' . $cur_group['g_id'] . '" selected="selected">' .
                    Utils::escape($cur_group['g_title']) . '</option>' . "\n";
            } else {
                $dropdown_menu .= "\t\t\t\t\t\t\t" . '<option value="' . $cur_group['g_id'] . '">' .
                    Utils::escape($cur_group['g_title']) . '</option>' . "\n";
            }
        }

        $dropdown_menu = Container::get('hooks')->fire('model.userlist.generate_dropdown_menu', $dropdown_menu);

        return $dropdown_menu;
    }
288016
protected function renderPresets()
    {
        // Create the dropdown menu options
        $config = config('decoy.encode.presets');
        $presets = array_keys($config);
        $dropdown = implode('', array_map(function ($config, $preset) {
            return '<li>
                <a href="#" data-val="'.$preset.'">
                    '.$config['title'].'
                </a>
            </li>';
        }, $config, $presets));

        // Make the hidden field
        $hidden = '<input type="hidden"
            name="_preset['.$this->name.']"
            value="'.$this->presetValue().'">';

        // Renturn the total markup
        return '<div class="input-group-btn js-tooltip"
            title="<b>Encoding quality.</b><br>Change to re-encode videos.">
            '.$hidden.'
            <button type="button"
                class="btn btn-default dropdown-toggle"
                data-toggle="dropdown" >
                    <span class="selected">Presets</span>
                    <span class="caret"></span>
            </button>
            <ul class="dropdown-menu dropdown-menu-right presets">
                '.$dropdown.'
            </ul>
        </div>';
    }
1262788
def select_groups(adata, groups='all', key='louvain'):
    
    strings_to_categoricals(adata)
    if isinstance(groups, list) and isinstance(groups[0], int): groups = [str(n) for n in groups]
    categories = adata.obs[key].cat.categories
    groups_masks = np.array([categories[i] == adata.obs[key].values for i, name in enumerate(categories)])
    if groups == 'all':
        groups = categories.values
    else:
        groups_ids = [np.where(categories.values == name)[0][0] for name in groups]
        groups_masks = groups_masks[groups_ids]
        groups = categories[groups_ids].values
    return groups, groups_masks
579434
function buildContainerGroups() {
            let container = svg
              .append('g')
                .classed('container-group', true);

            container
              .append('g')
                .classed('chart-group', true);
            container
              .append('g')
                .classed('legend-group', true);
        }
375067
def groups(self) -> Set[str]:
        
        return set(opt.group_name for opt in self._options.values())
181441
static function optionsframework_tabs( $option_name, $options ) {
		$counter = 0;
		$menu = '';

		foreach ( $options as $value ) {
			// Heading for Navigation
			if ( $value['type'] == "heading" ) {
				$counter++;
				$class = '';
				$class = ! empty( $value['id'] ) ? $value['id'] : $value['name'];
				$class = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower($class) ) . '-tab';
				$menu .= '<a id="options-group-'.  $counter . '-tab" class="nav-tab ' . $class .'" title="' . esc_attr( $value['name'] ) . '" href="' . esc_attr( '#options-group-'.  $counter ) . '">' . esc_html( $value['name'] ) . '</a>';
			}
		}

		return $menu;
	}
1039501
function() {

            this.$select.children().each($.proxy(function(index, element) {

                // Support optgroups and options without a group simultaneously.
                var tag = $(element).prop('tagName')
                    .toLowerCase();

                if ($(element).prop('value') == this.options.selectAllValue) {
                    return;
                }

                if (tag === 'optgroup') {
                    this.createOptgroup(element);
                }
                else if (tag === 'option') {

                    if ($(element).data('role') === 'divider') {
                        this.createDivider();
                    }
                    else {
                        this.createOptionValue(element);
                    }

                }

                // Other illegal tags will be ignored.
            }, this));

            // Bind the change event on the dropdown elements.
            $('li input', this.$ul).on('change', $.proxy(function(event) {
                var $target = $(event.target);

                var checked = $target.prop('checked') || false;
                var isSelectAllOption = $target.val() === this.options.selectAllValue;

                // Apply or unapply the configured selected class.
                if (this.options.selectedClass) {
                    if (checked) {
                        $target.parents('li')
                            .addClass(this.options.selectedClass);
                    }
                    else {
                        $target.parents('li')
                            .removeClass(this.options.selectedClass);
                    }
                }

                // Get the corresponding option.
                var value = $target.val();
                var $option = this.getOptionByValue(value);

                var $optionsNotThis = $('option', this.$select).not($option);
                var $checkboxesNotThis = $('input', this.$container).not($target);

                if (isSelectAllOption) {
                    if (checked) {
                        this.selectall();
                    }
                    else {
                        this.deselectall();
                    }
                }

                if(!isSelectAllOption){
                    if (checked) {
                        $option.prop('selected', true);

                        if (this.options.multiple) {
                            // Simply select additional option.
                            $option.prop('selected', true);
                        }
                        else {
                            // Unselect all other options and corresponding checkboxes.
                            if (this.options.selectedClass) {
                                $($checkboxesNotThis).parents('li').removeClass(this.options.selectedClass);
                            }

                            $($checkboxesNotThis).prop('checked', false);
                            $optionsNotThis.prop('selected', false);

                            // It's a single selection, so close.
                            this.$button.click();
                        }

                        if (this.options.selectedClass === "active") {
                            $optionsNotThis.parents("a").css("outline", "");
                        }
                    }
                    else {
                        // Unselect option.
                        $option.prop('selected', false);
                    }
                }

                this.$select.change();

                this.updateButtonText();
                this.updateSelectAll();

                this.options.onChange($option, checked);

                if(this.options.preventInputChangeEvent) {
                    return false;
                }
            }, this));

            $('li a', this.$ul).on('touchstart click', function(event) {
                event.stopPropagation();

                var $target = $(event.target);

                if (event.shiftKey) {
                    var checked = $target.prop('checked') || false;

                    if (checked) {
                        var prev = $target.parents('li:last')
                            .siblings('li[class="active"]:first');

                        var currentIdx = $target.parents('li')
                            .index();
                        var prevIdx = prev.index();

                        if (currentIdx > prevIdx) {
                            $target.parents("li:last").prevUntil(prev).each(
                                function() {
                                    $(this).find("input:first").prop("checked", true)
                                        .trigger("change");
                                }
                            );
                        }
                        else {
                            $target.parents("li:last").nextUntil(prev).each(
                                function() {
                                    $(this).find("input:first").prop("checked", true)
                                        .trigger("change");
                                }
                            );
                        }
                    }
                }

                $target.blur();
            });

            // Keyboard support.
            this.$container.off('keydown.multiselect').on('keydown.multiselect', $.proxy(function(event) {
                if ($('input[type="text"]', this.$container).is(':focus')) {
                    return;
                }
                if ((event.keyCode === 9 || event.keyCode === 27)
                        && this.$container.hasClass('open')) {

                    // Close on tab or escape.
                    this.$button.click();
                }
                else {
                    var $items = $(this.$container).find("li:not(.divider):not(.disabled) a").filter(":visible");

                    if (!$items.length) {
                        return;
                    }

                    var index = $items.index($items.filter(':focus'));

                    // Navigation up.
                    if (event.keyCode === 38 && index > 0) {
                        index--;
                    }
                    // Navigate down.
                    else if (event.keyCode === 40 && index < $items.length - 1) {
                        index++;
                    }
                    else if (!~index) {
                        index = 0;
                    }

                    var $current = $items.eq(index);
                    $current.focus();

                    if (event.keyCode === 32 || event.keyCode === 13) {
                        var $checkbox = $current.find('input');

                        $checkbox.prop("checked", !$checkbox.prop("checked"));
                        $checkbox.change();
                    }

                    event.stopPropagation();
                    event.preventDefault();
                }
            }, this));
        }
254289
function colorRangeGroup(selection, colorScales) {
  selection
      .classed('mb-3', true);
  selection.append('div')
      .classed('colorscale', true)
      .classed('mb-2', true)
      .call(lbox.colorScaleBox, 'Colorscale')
      .call(lbox.colorScaleBoxItems, colorScales);

  // Custom colorscale
  const collapse = selection.append('div')
      .call(dropdown.dropdownFormGroup, 'Custom color')
    .select('.card-body')
      .classed('p-2', true);

  const customColorRanges = [
    {key: 'continuous', name: 'Continuous'},
    {key: 'two-piece', name: 'Two-piece'}
  ];
  collapse.append('div')
      .classed('rangetype', true)
      .classed('mb-1', true)
      .call(lbox.selectBox, 'Range type')
      .call(lbox.updateSelectBoxOptions, customColorRanges);
  collapse.append('div')
      .classed('range', true)
      .classed('mb-1', true)
      .call(rbox.colorRangeBox, 'Range');
  collapse.append('div')
      .classed('unknown', true)
      .classed('mb-1', true)
      .call(box.colorBox, 'Unknown');
}
1235687
def optgroups(self, name, value, attrs=None):
        """"""
        default = (None, [], 0)
        groups = [default]
        has_selected = False
        selected_choices = {str(v) for v in value}
        if not self.is_required and not self.allow_multiple_selected:
            default[1].append(self.create_option(name, '', '', False, 0))
        if not isinstance(self.choices, ModelChoiceIterator):
            return super(ModelSelect2Mixin, self).optgroups(name, value, attrs=attrs)
        selected_choices = {
            c for c in selected_choices
            if c not in self.choices.field.empty_values
        }
        field_name = self.choices.field.to_field_name or 'pk'
        query = Q(**{'%s__in' % field_name: selected_choices})
        for obj in self.choices.queryset.filter(query):
            option_value = self.choices.choice(obj)[0]
            option_label = self.label_from_instance(obj)

            selected = (
                str(option_value) in value and
                (has_selected is False or self.allow_multiple_selected)
            )
            if selected is True and has_selected is False:
                has_selected = True
            index = len(default[1])
            subgroup = default[1]
            subgroup.append(self.create_option(name, option_value, option_label, selected_choices, index))
        return groups
966918
function _populateLanguageDropdown() {
        // Get all non-binary languages
        var languages = _.values(LanguageManager.getLanguages()).filter(function (language) {
            return !language.isBinary();
        });

        // sort dropdown alphabetically
        languages.sort(function (a, b) {
            return a.getName().toLowerCase().localeCompare(b.getName().toLowerCase());
        });

        languageSelect.items = languages;

        // Add option to top of menu for persisting the override
        languageSelect.items.unshift("---");
        languageSelect.items.unshift(LANGUAGE_SET_AS_DEFAULT);
    }
751743
private function generateGroups()
    {
        foreach ($this->app['config']->get('contenttypes') as $ctname => $ctype) {
            $keyprefix = 'contenttypes.' . $this->slugifyKey($ctname) . '.group.';

            if (isset($ctype['groups']) && is_array($ctype['groups'])) {
                foreach ($ctype['groups'] as $groupname) {
                    $key = $keyprefix . $this->slugifyKey($groupname);

                    if ($this->isSaved($key)) {
                        $this->translation[$key] = $this->saved[$key];
                    } else {
                        $fallback = $this->fallback($key);
                        $this->hints[$key] = ($fallback !== false) ? $fallback : ucfirst($groupname);
                        $this->translation[$key] = '';
                    }
                }
            }
        }
    }
1036894
public static function bar($groups, $htmlOptions = array())
    {
        ArrayHelper::addValue('class', 'button-bar', $htmlOptions);

        ob_start();
        echo \CHtml::openTag('div', $htmlOptions);
        foreach ($groups as $group) {
            echo $group;
        }
        echo \CHtml::closeTag('div');
        
        return ob_get_clean();
    }
217465
private function buildMenu($menu)
	{
		$html = '';

		foreach ($menu as $value) {
			$icon = '';
			if (isset($value['icon'])) {
				$icon = sprintf('<i class="fa fa-%s"></i> ', $value['icon']);
			}

			if (isset($value['children'])) {
				$html.= '<li class="dropdown">';
				$html.= sprintf('<a href="#" class="dropdown-toggle" data-toggle="dropdown">%s%s<b class="caret"></b></a>', $icon, $value['title']);
				$html.= '<ul class="dropdown-menu">';
				$html.= $this->buildMenu($value['children']);
				$html.= '</ul>';
				$html.= '</li>';

				continue;
			}

			$url = '';

			if (isset($value['class'])) {
				$url = route('admin.model.index', urlencode($value['class']));
			} elseif (isset($value['url'])) {
				$url = url($value['url']);
			} elseif (isset($value['route'])) {
				$url = route($value['route']);
			}

			if (isset($value['text'])) {
				$html.= sprintf('<li><p class="navbar-text">%s</p></li>', $value['text']);
			} elseif (isset($value['image'])) {
				$html.= sprintf('<li><img src="%s" class="navbar-image"></li>', $value['image']);
			} else {
				$html.= sprintf('<li><a href="%s">%s%s</a></li>', $url, $icon, $value['title']);
			}
		}

		return $html;
	}
273000
def generate(tagGroups, terms):
    

    rv = []
    for pid in tagGroups:
        # In testing we may not have complete set
        if pid not in terms.keys():
            continue

        groupData = terms[pid]
        groupName = "[%s] %s" % (pid, groupData['name'])
        groupDesc = groupData['desc']
        children = []
        group = dict(name=groupName, desc=groupDesc, set=children)
        rv.append(group)

        for cid in groupData['children']:
            cData = terms[cid]
            cName = "[%s] %s" % (cid, cData['name'])
            cDesc = cData['desc']
            child = dict(name=cName, desc=cDesc)
            children.append(child)

    return json.dumps(rv, indent=2)
208797
function buildContainerGroups() {
            let container = svg
                .append('g')
                  .classed('container-group', true)
                  .attr('transform', `translate(${margin.left}, ${margin.top})`);

            container
                .append('g').classed('grid-lines-group', true);
            container
                .append('g').classed('chart-group', true);
            container
                .append('g').classed('axis-group', true);
            container
                .append('g').classed('metadata-group', true);

            if (hasTitle()) {
                container.selectAll('.chart-group')
                  .attr('transform', `translate(${legendSpacing}, 0)`);
            }
        }
640650
function () {
		
			var i, length;
		
			// create DOM <select> node
			this.el = inputEx.cn('select', {
			
				id: this.divEl.id ? this.divEl.id + '-field' : YAHOO.util.Dom.generateId(),
				name: this.options.name || ''
			
			});
		
			// list of choices (e.g. [{ label: "France", value:"fr", node:<DOM-node>, visible:true }, {...}, ...])
			this.choicesList = [];
		
			// add choices
			for (i = 0, length = this.options.choices.length; i < length; i += 1) {
				this.addChoice(this.options.choices[i]);
			}
		
			// append <select> to DOM tree
			this.fieldContainer.appendChild(this.el);
		}
1025339
function() {
            var bselect = _callMethod( this, "element" );
            var optionList = bselect.find( ".bselect-option-list" ).empty();
            var mapping = {};
            var i = 0;

            bselect.toggleClass( "disabled", this.prop( "disabled" ) );

            this.find( "option, > optgroup" ).each(function() {
                var classes, li;
                var isOption = $( this ).is( "option" );

                if ( isOption && !this.value ) {
                    return;
                }

                if ( isOption ) {
                    classes = "bselect-option";
                    if ( $( this ).closest( "optgroup" ).length ) {
                        classes += " grouped";
                    }
                } else {
                    classes = "bselect-option-group";
                }

                li = $( "<li />" ).attr({
                    "class": classes,
                    // While there aren't roles for optgroup, we'll stick with the role option.
                    role: "option",
                    tabindex: isOption ? 2 : -1,
                    "aria-selected": "false"
                });

                if ( isOption ) {
                    li.data( "value", this.value );
                    mapping[ this.value ] = i;

                    li.html( "<a href='#'>" + this.text + "</a>" );
                } else {
                    li.text( this.label );
                }

                li.appendTo( optionList );
                i++;
            });

            if ( i === 0 ) {
                showNoOptionsAvailable( this );
            }

            this.data( dataName ).itemsMap = mapping;
            return this;
        }