Skip to content

RoverCore/Navigation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is RoverCore Navigation?

RoverCore Navigation is a Razor Class Library that provides a service to load navigation menus from appsettings.json. Menu items are filtered automatically by role to reduce the menu to only the options the user has permission for.

How to setup

services.AddScoped<NavigationService>();

ViewComponent Usage

When you want the menu to appear simply include the following code in one of your razor pages.

@(await Component.InvokeAsync<NavbarViewComponent>())

Overriding the default menu html with your own

Create a folder at Views/Shared/Components/Navbar in your primary Asp.net web project and copy over the Default.cshtml from this project to that directory. Any customizations you make to Default.cshtml will be reflected on your website.

Example Menu Configuration

{
"Navigation": [
    {
      "NavMenuItems": [
        {
          "Text": "Home",
          "Type": "link",
          "Controller": "Home",
          "Action": "Index",
          "Values": {
            "Area": "Dashboard"
          },
          "Icon": "las la-home",
          "Roles": [ "User", "Admin" ]
        },
        {
          "Text": "Dropdown",
          "Type": "dropdown",
          "Controller": "Home",
          "Action": "Index",
          "Values": {
            "Area": "Dashboard"
          },
          "Icon": "las la-dumpster",
          "Roles": [ "User", "Admin" ],
          "Children": [
            {
              "Text": "Dropdown 1",
              "Type": "link",
              "Controller": "Home",
              "Action": "Index",
              "Values": {
                "Area": "Dashboard"
              },
              "Icon": "ti-home",
              "Roles": [ "User", "Admin" ]
            },
            {
              "Text": "Dropdown 2",
              "Type": "dropdown",
              "Icon": "ti-home",
              "Roles": [ "User", "Admin" ],
              "Children": [
                {
                  "Text": "Dropdown 3",
                  "Type": "link",
                  "Controller": "Home",
                  "Action": "Index",
                  "Values": {
                    "Area": "Dashboard"
                  },
                  "Icon": "ti-home",
                  "Roles": [ "User", "Admin" ]
                },
                {
                  "Text": "Dropdown 4",
                  "Type": "dropdown",
                  "Icon": "ti-home",
                  "Roles": [ "User", "Admin" ],
                  "Children": [
                    {
                      "Text": "Dropdown 5",
                      "Type": "link",
                      "Controller": "Home",
                      "Action": "Index",
                      "Values": {
                        "Area": "Dashboard"
                      },
                      "Icon": "ti-home",
                      "Roles": [ "User", "Admin" ]
                    },
                    {
                      "Text": "Dropdown 6",
                      "Type": "link",
                      "Icon": "ti-home",
                      "Roles": [ "User", "Admin" ]
                    }
                  ]
                }
              ]

            }
          ]
        },
        {
          "Text": "Documentation",
          "Type": "link",
          "Url": "https://rovercore.github.io/RoverCoreDocs/docs/",
          "Icon": "las la-file-alt",
          "Roles": [ "User", "Admin" ]
        }
      ]
    }
  ]
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors