Breadcrumb tag helper refactoring

pull/279/head
yekalkan 8 years ago
parent c959adce56
commit 86ba6f4082

@ -23,8 +23,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Breadcrumb
var list = GetValueFromContext<List<BreadcrumbItem>>(context, BreadcrumbItemsContent);
output.Content.SetHtmlContent(GetInnerHtml(context, output));
list.Add(new BreadcrumbItem
{
Html = RenderTagHelperOutput(output, _encoder),

@ -26,12 +26,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Breadcrumb
protected virtual void SetInnerList(TagHelperContext context, TagHelperOutput output, List<BreadcrumbItem> list)
{
var anyActiveItem = list.Any(bc => bc.Active);
if (!anyActiveItem && list.Count > 0)
{
list.Last().Active = true;
}
SetLastOneActiveIfThereIsNotAny(context, output, list);
var html = new StringBuilder("");
@ -52,6 +47,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Breadcrumb
return items;
}
protected virtual void SetLastOneActiveIfThereIsNotAny(TagHelperContext context, TagHelperOutput output, List<BreadcrumbItem> list)
{
if (list.Count > 0 && list.Any(bc => bc.Active))
{
list.Last().Active = true;
}
}
protected virtual string SetActiveClassIfActiveAndGetHtml(BreadcrumbItem item)
{
return item.Active ?

Loading…
Cancel
Save