npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ovh-angular-sidebar-menu

v7.3.0

Published

Manage and display a left menu tree

Downloads

39

Readme

Sidebar Menu

OVH component

NPM

Maintenance Chat on gitter Build Status

Manage and display a left menu tree. This is the main module which holds everything together!

Dependencies

TODO

  • custom styles on scroll bar ;
  • virtual scroll ;
  • search into sections ;
  • display show all button when more than 10 items.

Installation

Bower

bower install ovh-angular-sidebar-menu --save

NPM

npm install ovh-angular-sidebar-menu --save

Get the sources

    git clone https://github.com/ovh-ux/ovh-angular-sidebar-menu.git
    cd ovh-angular-sidebar-menu
    npm install
    bower install

You've developed a new cool feature ? Fixed an annoying bug ? We'd be happy to hear from you !

Have a look in CONTRIBUTING.md

Usage

In your web page:

<script src="angular.js"></script>
<script src="dist/sidebar-menu.min.js"></script>
...
<body>
...
    <div data-sidebar-menu></div>
...
</body>

In your main app.js file:

angular.module("myManagerModule", [
    ...
    "ovh-angular-sidebar-menu"
    ...
]);

During angular run phase, add ovh-angular-sidebar-menu service as dependency and add "root" items to manager sidebar menu:

angular.module("myManagerModule").run(function ($translate, sidebarMenu, myResourceService) {
    var self = this;

    self.mainSectionItem = null;

    function myFunctionThatReturnAPromise () {
        return myResourceService.v6().query().$promise.then(function (datas) {
            angular.forEach(datas, function (data) {
                SidebarMenu.addMenuItem({
                    title: data.description || data.serviceName,
                    id: data.serviceName,
                    state: "mymanager.state.subState",
                    stateParams: {
                        foo : "test",
                        test : "foo"
                    }
                }, self.mainSectionItem);
            });
        });
    }

    // wait that sidebar is loaded (wait that translations are loaded)
    SidebarMenu.loadDeferred.promise.then(function () {
        // creating a level 1 item
        self.mainSectionItem = SidebarMenu.addMenuItem({
            title: $translate.instant("translation_key"),
            category: "my-category",
            icon: "myOvhFontIconName",
            allowSubItems: true,
            onLoad: myFunctionThatReturnAPromise,
            loadOnState: "mymanager.state"
        });

        // confugure order menu items
        SidebarMenu.addActionsMenuOptions([{
            id: "order1",
            title: $translate.instant("order_translation_key1"),
            icon: "myOvhFontIconName1",
            href: "https://www.ovh.com/",
            target: "_blank"
        }, {
            id: "order2",
            title: $translate.instant("order_translation_key2"),
            icon: "myOvhFontIconName2",
            href: "#/my-order/dest"
        }, {
            id: "order3",
            title: $translate.instant("order_translation_key3"),
            icon: "myOvhFontIconName3",
            href: "#/my-order/dest2"
        }]);

        // Add Action menu iten click handler
        SidebarMenu.addActionsMenuItemClickHandler(function (id) {
            console.log("Actions menu item " + id + " has been selected!");
        });
    });
});

This code will add an item into manager sidebar menu and when current state will be "mymanager.state" or when it will be clicked, it will load sub items.

Using with less

Some vars can be configured in manager app less part under #sidebar-menu namespace. They have all default values.

  • @SIDEBAR_MENU_OFFSET_TOP : top position of the sidebar
  • @SIDEBAR_MENU_Z_INDEX : z-index of the sidebar
  • @SIDEBAR_MENU_OPACITY : opacity of elements that need opacity in the sidebar
  • @SIDEBAR_MENU_ACTIVE_COLOR : active color of items (should be set to @UNIVERS)
  • @SIDEBAR_MENU_COLOR : items text color
  • @SIDEBAR_MENU_BG_COLOR : background color of the sidebar element
  • @SIDEBAR_MENU_ACTIVE_ITEM_BG_COLOR : background color of the active item
  • @SIDEBAR_MENU_LVL1_ACTIVE_BORDER_COLOR : border color of the sub items of the active item of level 1
  • @SIDEBAR_MENU_LVL2_ACTIVE_BORDER_COLOR : border color of the sub items of the active item of level 2
  • @SIDEBAR_MENU_MOBILE_TOP_NAV_HEIGHT : height of the manager top nav element. Needed to adjust position of sidebar menu on mobile
  • @SIDEBAR_MENU_LVL1_FONT_SIZE : font side of items of level 1
  • @SIDEBAR_MENU_LVL2_FONT_SIZE : font side of items of level 2 (and sub levels)

Development

To start developping on this module, launch:

# make install

This will install npm and bower dependencies. Then launch:

# grunt watch

And start developing.

Note: if you add a new feature to module, don't forget to document your new piece of code.

Documentation

For a full documentation of the module, launch:

# grunt ngdocs && grunt connect

Then go on http://localhost:9090.

Related links

  • Contribute: https://github.com/ovh-ux/ovh-angular-sidebar-menu/blob/master/CONTRIBUTING.md
  • Report bugs: https://github.com/ovh-ux/ovh-angular-sidebar-menu/issues
  • Get latest version: https://github.com/ovh-ux/ovh-angular-sidebar-menu

License

See https://github.com/ovh-ux/ovh-angular-sidebar-menu/blob/master/LICENSE