zHaytam / SmartBreadcrumbs

A utility library for ASP.NET Core (both MVC and Razor Pages) websites to easily add and customize breadcrumbs.
https://blog.zhaytam.com/2018/06/24/asp-net-core-using-smartbreadcrumbs/
MIT License
161 stars 77 forks source link

Add Option to IconClasses #14

Closed a-pedroso closed 5 years ago

a-pedroso commented 5 years ago

Hi there!

It would be awesome to also include in the BreadCrumbAttribute the property:

        public virtual string IconClasses { get; set; } 

Example:

        [Breadcrumb("ViewData.Title", CacheTitle = true, IconClasses="fa fa-edit")]
        public async Task<IActionResult> Index()
        {
            var svc_result = await _service.GetProductList();
            return View(svc_result);
        }

To be able to use it on BreadcrumbOptions.LiTemplate and BreadcrumbOptions.ActiveLiTemplate at Startup -> ConfigureServices

Example:

            services.UseBreadcrumbs(GetType().Assembly, options =>
            {
                options.TagName = "";
                options.TagClasses = "";
                options.OlClasses = "breadcrumb";
                options.LiClasses = "";
                options.ActiveLiClasses = "active";
                options.LiTemplate = "<li><a href=\"{1}\"><i class=\"{2}\"></i>{0}</a></li>";
                options.ActiveLiTemplate = "<li class=\"active\"><a href=\"{1}\"><i class=\"{2}\"></i>{0}</a></li>";
            });

Thank you!

zHaytam commented 5 years ago

Added in https://github.com/zHaytam/SmartBreadcrumbs/commit/55fba58564df563e518e9c19309001970c561fbd. Please re-open if there is a problem with it.

a-pedroso commented 5 years ago

@zHaytam It works perfectly! Thank you!

Cheers