theme/javascript/toolbar.js
function createDropdownMenu(dropdown) {
    var $menu = $('<div>', {
        'class': 'dropdown-menu',
        'html': '<div class="dropdown-caret"><span class="caret-outer"></span><span class="caret-inner"></span></div>'
    });

    if (_.isString(dropdown)) {
        $menu.append(dropdown);
    } else {
        var groups = _.map(dropdown, function(group) {
            if (_.isArray(group)) return group;
            else return [group];
        });

        // Create buttons groups
        _.each(groups, function(group) {
            var $group = $('<div>', {
                'class': 'buttons'
            });
            var sizeClass = 'size-'+group.length;

            // Append buttons
            _.each(group, function(btn) {
                btn = _.defaults(btn || {}, {
                    text: '',
                    className: '',
                    onClick: defaultOnClick
                });

                var $btn = $('<button>', {
                    'class': 'button '+sizeClass+' '+btn.className,
                    'text': btn.text
                });
                $btn.click(btn.onClick);

                $group.append($btn);
            });


            $menu.append($group);
        });

    }


    return $menu;
}
function createDropdownMenu(dropdown) {
    var $menu = $('<div>', {
        'class': 'dropdown-menu',
        'html': '<div class="dropdown-caret"><span class="caret-outer"></span><span class="caret-inner"></span></div>'
    });

    if (_.isString(dropdown)) {
        $menu.append(dropdown);
    } else {
        var groups = _.map(dropdown, function(group) {
            if (_.isArray(group)) return group;
            else return [group];
        });

        // Create buttons groups
        _.each(groups, function(group) {
            var $group = $('<div>', {
                'class': 'buttons'
            });
            var sizeClass = 'size-'+group.length;

            // Append buttons
            _.each(group, function(btn) {
                btn = _.defaults(btn || {}, {
                    text: '',
                    className: '',
                    onClick: defaultOnClick
                });

                var $btn = $('<button>', {
                    'class': 'button '+sizeClass+' '+btn.className,
                    'text': btn.text
                });
                $btn.click(btn.onClick);

                $group.append($btn);
            });


            $menu.append($group);
        });

    }


    return $menu;
}
function createDropdownMenu ( dropdown ) { var $menu = $ ( '<div>' , { 'class' : 'dropdown-menu' , 'html' : '<div class="dropdown-caret"><span class="caret-outer"></span><span class="caret-inner"></span></div>' } ) ; if ( _ . isString ( dropdown ) ) { $menu . append ( dropdown ) ; } else { var groups = _ . map ( dropdown , function ( group ) { if ( _ . isArray ( group ) ) return group ; else return [ group ] ; } ) ; // Create buttons groups _ . each ( groups , function ( group ) { var $group = $ ( '<div>' , { 'class' : 'buttons' } ) ; var sizeClass = 'size-' + group . length ; // Append buttons _ . each ( group , function ( btn ) { btn = _ . defaults ( btn || { } , { text : '' , className : '' , onClick : defaultOnClick } ) ; var $btn = $ ( '<button>' , { 'class' : 'button ' + sizeClass + ' ' + btn . className , 'text' : btn . text } ) ; $btn . click ( btn . onClick ) ; $group . append ( $btn ) ; } ) ; $menu . append ( $group ) ; } ) ; } return $menu ; }
Create a dropdown menu
Create a dropdown menu