Flexible Sidebar Toggle Action

The Flexible Sidebar Toggle action is responsible for showing or hiding a responsive sidebar.

Action Definition

Name Flexible sidebar toggle action
ID com.hybris.cockpitng.action.flexibletoggle
Description Action to toggle visibility of responsive sidebar
Author SAP
Action Class Name com.hybris.cockpitng.actions.flexibletoggle.FlexibleSidebarToggleAction
Custom Renderer Class Name

com.hybris.cockpitng.actions.flexibletoggle.FlexibleSidebarToggleActionRenderer

The renderer is an extension of DefaultActionRenderer.

For more information, see Action Parameters.

Inputs Not applicable
Outputs Not applicable

Action Preview

Configuration

Name Type Description
toggleSocket java.lang.String Name of the parent widget output socket that is used to send a message that toggles responsive sidebar visibility (default: toggle)
stateInput java.lang.String Name of parent widget input socket that is used to send a message to receive current state of responsive sidebar (default: toggleState)
breakpointOutput java.lang.String Name of parent widget output socket that is used to send a message that configures responsiveness of flexible sidebar (default: breakpoint)
breakpoint ENUM(xl,l,m,s) Points to one of predefined minimum screen resolutions, on which a sidebar is visible and hamburger button hidden (default: m)

Exemplary configuration would look like this:

cockpit-config.xml

<context type="Product" component="summary-view">
    <summary-view:summary-view xmlns:summary-view="http://www.hybris.com/cockpitng/component/summaryview">
        <summary-view:section name="hmc.essential">
            <summary-view:attribute qualifier="code" />
            <summary-view:attribute qualifier="name" />
            <summary-view:attribute qualifier="catalogVersion" />
        </summary-view:section>
        <summary-view:section name="hmc.section.product.pictures">
            <summary-view:attribute qualifier="picture" />
            <summary-view:attribute qualifier="thumbnail" />
        </summary-view:section>
        <summary-view:section name="Actions">
            <summary-view:actions component-id="summaryviewactions" group="common" />
        </summary-view:section>
    </summary-view:summary-view>
</context>

Dependency

Not applicable

Responsiveness

Most common use of the responsive sidebar is a combination of the panel and the hamburger button that toggles the sidebar visibility. For this purpose, an action has been introduced. It is designed in a way that it works in pair with Flexible Layout widget and its responsiveness feature.

To properly configure and connect the layout and the action, the following configuration and the following mashup must be set. Below, you can see an example, which can be later on amended accordingly to your needs.

  • The Flexible Layout definition:

    cockpit-widgets.xml

    <widget id="SOME.LAYOUT.INSTANCE.IDENTITY"
        widgetDefinitionId="com.hybris.cockpitng.flexiblelayout" template="false"
        slotId="SOME_SLOT">
     
        <!-- Put contents of sidebar into 'sidebar' slot -->
        <!--
        <widget id="..." widgetDefinitionId="..." template="false" slotId="sidebar">...</widget>
        -->
     
     
        <!-- Put main contents into 'contents' slot -->
        <!--
        <widget id="..." widgetDefinitionId="..." template="false" slotId="contents">...</widget>
        -->
     
        <!-- Some additional configuration might be places here -->
        <!--
        <setting key="sidebarPosition" type="String" value="..."/>
        <setting key="overlapOnHover" type="Boolean" value="..."/>
        <setting key="sidebarCollapsible" type="Boolean" value="..."/>
        -->
    </widget>
  • A slot for actions, in this example placed in Toolbar Widget with proper virtual sockets:

    cockpit-widgets.xml

    <widget id="SOME.TOOLBAR.INSTANCE.IDENTITY"
        widgetDefinitionId="com.hybris.backoffice.widgets.toolbar" template="false"
        slotId="SOME_SLOT">
     
        <setting key="toolbarActions" type="String" value="SOME_ACTIONS_CONTEXT_NAME"/>
        <!-- Some additional configuration might be places here -->
     
        <virtual-sockets>
            <input id="toggleState" type="java.lang.String" visibility="default"/>
            <!-- Some additional input sockets might be placed here -->
     
            <output id="toggle" type="java.lang.String" visibility="default"/>
            <output id="breakpoint" type="java.lang.String"/>
            <!-- Some additional output sockets might be placed here -->
        </virtual-sockets>
    </widget>
  • Configured Flexible sidebar toggle action:

    cockpit-config.xml

    <context component="SOME_ACTIONS_CONTEXT_NAME">
        <y:actions xmlns:y="http://www.hybris.com/cockpit/config/hybris">
            <y:group qualifier="common">
                <y:action action-id="com.hybris.cockpitng.action.flexibletoggle">
                    <y:parameter>
                        <y:name>breakpoint</y:name>
                        <y:value>xl</y:value>
                    </y:parameter>
                </y:action>
            </y:group>
        </y:actions>
    </context>
  • Connected Toolbar with Flexible Layout:

    cockpit-widgets.xml

    <widget-connection sourceWidgetId="SOME.TOOLBAR.INSTANCE.IDENTITY" outputId="toggle"
                       targetWidgetId="SOME.LAYOUT.INSTANCE.IDENTITY" inputId="toggleSidebar"/>
    <widget-connection sourceWidgetId="SOME.LAYOUT.INSTANCE.IDENTITY" outputId="sidebarState"
                       targetWidgetId="SOME.TOOLBAR.INSTANCE.IDENTITY" inputId="toggleState"/>
    <widget-connection sourceWidgetId="SOME.TOOLBAR.INSTANCE.IDENTITY" outputId="breakpoint"
                       targetWidgetId="SOME.LAYOUT.INSTANCE.IDENTITY" inputId="responsiveBreakpoint"/>