<commit_before><?php

namespace hiqdev\menumanager\widgets;

use yii\helpers\Html;

class MenuButton extends \yii\base\Widget
{
    public $icon = '<i class="fa fa-bars"></i>&nbsp;&nbsp;<span class="caret"></span>';

    public $items;

    public $menuClass = Menu::class;

    public function run()
    {
        $this->getView()->registerCss("
        @media (max-width: 767px) {
            .menu-button .dropdown-menu {
                position: relative!important;
            }
        }
        ");
        $this->getView()->registerJs("
        $.fn.hasScrollBar = function() {
            return this.get(0).scrollWidth > this.width();
        }
        if ($('div.table-responsive').hasScrollBar() === true) {
           $('.menu-button .dropdown-menu').css('position', 'relative'); 
        }
        ");

        $class = $this->menuClass;
        $html = Html::beginTag('div', ['class' => 'menu-button dropdown visible-lg-inline visible-md-inline visible-sm-inline visible-xs-inline']);
        $html .= Html::button($this->icon, [
            'class' => 'btn btn-default btn-xs dropdown-toggle',
            'data-toggle' => 'dropdown',
        ]);
        $html .= $class::widget([
            'items' => $this->items,
            'options' => [
                'class' => 'dropdown-menu',
            ],
        ]);
        $html .= Html::endTag('div');

        return $html;
    }
}<commit_msg>Change actions from dropdown to popver<commit_after><?php

namespace hiqdev\menumanager\widgets;

use yii\helpers\Html;

class MenuButton extends \yii\base\Widget
{
    public $icon = '<i class="fa fa-bars"></i>&nbsp;&nbsp;<span class="caret"></span>';

    public $items;

    public $menuClass = Menu::class;

    public function run()
    {
        $this->getView()->registerCss("
        .menu-button .nav > li > a {
            padding: 5px 15px;
        }
        .menu-button .popover-content {
            padding: 9px 0px;
        }
        ");
        $this->getView()->registerJs("
            // Init popover
            ;(function () {
                var actionsButton = $('.menu-button button[data-toggle=\"popover\"]');
                actionsButton.popover();
                // Show one popover and hide other popovers
                actionsButton.on('click', function (e) {
                    actionsButton.not(this).popover('hide');
                });
                // hide popover on click outside
                $(document).on('click', function (e) {
                    actionsButton.each(function () {
                        //the 'is' for buttons that trigger popups
                        //the 'has' for icons within a button that triggers a popup
                        if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {                
                            (($(this).popover('hide').data('bs.popover')||{}).inState||{}).click = false  // fix for BS 3.3.6
                        }

                    });
                });
            })();
        ");
        $class = $this->menuClass;
        $actionsMenu = $class::widget([
            'items' => $this->items,
            'options' => [
                'class' => 'nav',
            ],
        ]);
        $html = Html::beginTag('div', [
            'class' => 'menu-button visible-lg-inline visible-md-inline visible-sm-inline visible-xs-inline'
        ]);
        $html .= Html::button($this->icon, [
            'class' => 'btn btn-default btn-xs',
            'data' => [
                'toggle' => 'popover',
                'trigger' => 'click',
                'content' => $actionsMenu,
                'html' => 'true',
                'placement' => 'left',
            ],
        ]);
        $html .= Html::endTag('div');

        return $html;
    }
}
{'fraction_non_alphanumeric': 0.16974746159854204, 'fraction_numerical': 0.0036448841447539702, 'mean_word_length': 1.581989247311828, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4908479', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1063, 'n_words': 212}