cancel
Showing results for 
Search instead for 
Did you mean: 

How to make Sebwite_Sidebar compatible with Breeze?

How to make Sebwite_Sidebar compatible with Breeze?

Hi 

I'm trying to make Sebwite_Sidebar a sidebar category module compatible with Breeze. There's a tutorial here https://docs.swissuplabs.com/m2/extensions/breeze/devdocs/module-js/ that I'm trying to use but I have no clue. 

 

I tried this so far ..

In app/code/Sebwite/Sidebar/view/frontend/web/js/breeze/module.js

(function () {
        $widget('module').on('click', '.o-list .expand, .o-list .expanded', function () {
            component: 'Sebwite_Sidebar/js/module',
            options:{
                default: 'value'
            } ,
            var element = $(this).parent('li');

            if (element.hasClass('active')) {
                element.find('ul').slideUp();

                element.removeClass('active');
                element.find('li').removeClass('active');

                element.find('i').removeClass('fa-minus').addClass('fa-plus');
            } else {
                element.children('ul').slideDown();
                element.siblings('li').children('ul').slideUp();
                element.parent('ul').find('i').removeClass('fa-minus').addClass('fa-plus');
                element.find('> span i').removeClass('fa-plus').addClass('fa-minus');

                element.addClass('active');
                element.siblings('li').removeClass('active');
                element.siblings('li').find('li').removeClass('active');
                element.siblings('li').find('ul').slideUp();
            }
            create: function () {
                console.log(this.element);
                console.log(this.options);
            }
        });

})();

and 

app/code/Sebwite/Sidebar/view/frontend/layout/breeze_default.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="breeze.js">
            <arguments>
                <argument name="bundles" xsi:type="array">
                    <item name="default" xsi:type="array">
                        <item name="items" xsi:type="array">
                            <item name="Sebwite_Sidebar/js/sidebar" xsi:type="string">Sebwite_Sidebar/js/breeze/module</item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>