<commit_before>﻿@using System.Dynamic;
@using System.Linq;
@using System.Collections.Generic;
@using DotNetNuke.Web.DDRMenu;
@using DotNetNuke.Common;
@using DotNetNuke.Entities.Portals;
@using DotNetNuke.Services.Localization;
@using R7.Epsilon.Components;
@inherits DotNetNuke.Web.Razor.DotNetNukeWebPage<dynamic>

@functions {
	string NodeActiveCssClass (MenuNode node)
	{
		return (node.Selected) ? "active" : string.Empty;
	}

	string NodeDisabledCssClass (MenuNode node)
	{
		return !node.Enabled ? "disabled" : string.Empty;
	}

	string NodeCssClasses (MenuNode node)
	{
		return (NodeActiveCssClass (node) + " " + NodeDisabledCssClass (node)).Trim ();
	}

	MenuNode FindCurrentNodeRecursive (MenuNode node)
	{
		if (node.Selected) {
			return node;
		}

		foreach (var node1 in node.Children) {
			var node2 = FindCurrentNodeRecursive (node1);
			if (node2 != null) {
				return node2;
			}
		}

		return null;
	}

	// TODO: Implement via NodeManipulator?
	IList<MenuNode> GetBreadcrumbNodes (MenuNode root)
	{
		var currentNode = FindCurrentNodeRecursive (root);
		var nodes = new List<MenuNode> ();
		while (currentNode != null) {
			nodes.Insert (0, currentNode);
			currentNode = currentNode.Parent;
		}

		return nodes;
	}

	string GetString (string resourceKey)
	{
		var resourceFileRoot = "~/Portals/_default/Skins/R7.Epsilon/App_LocalResources/Fake.ascx.resx";
		return Localization.GetString (resourceKey, resourceFileRoot);
	}

	string FormatUrl (MenuNode node)
	{
		if (string.IsNullOrEmpty (node.Url) && node.TabId == -1) {
			node.TabId = PortalSettings.Current.HomeTabId;
			node.Url = Globals.NavigateURL (PortalSettings.Current.HomeTabId);
		}

		var urlFormat = Model.UrlFormat;
		if (string.IsNullOrEmpty (urlFormat)) {
			return node.Url;
		}

		return EpsilonUrlHelper.FormatUrl (urlFormat, node.TabId, PortalSettings.Current.PortalId, HttpContext.Current.Request.QueryString);
	}
}

@helper RenderDropdownFor(MenuNode parentNode) {
	<div class="dropdown-menu" aria-labelledby="btnDropCrumb">
		@foreach (var node in parentNode.Children) {
			<a class="dropdown-item @NodeCssClasses(node)" href="@FormatUrl(node)">@node.Text</a>
		}
	</div>
}

@helper RenderBreadcrumb(MenuNode root) {
	// TODO: Implement schema.org markup
	var nodes = GetBreadcrumbNodes (root);
	if (nodes.Count > 0) {
        <nav aria-label="breadcrumb">
			<ol class="breadcrumb">
				@foreach (var node in nodes) {
					if (node == root) {
						node.Enabled = true;
						node.Text = GetString ("DropCrumb_Home.Text");
					}
					<li class="breadcrumb-item @NodeCssClasses(node)">
						@if (node.Selected) {
							if (node.Children.Count > 0) {
								<span class="dropdown">
									<a class="dropdown-toggle" href="#" type="button" role="button" id="btnDropCrumb" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
										@Html.Raw(node.Text)
									</a>
									@RenderDropdownFor(node)
								</span>
							}
							else {
								@Html.Raw(node.Text)
							}
						}
						else {
							<a class="@NodeCssClasses(node)" href="@FormatUrl(node)">@Html.Raw(node.Text)</a>
						}
					</li>
				}
			</ol>
		</nav>
	}
}<commit_msg>Method call, remove CSS classes from link<commit_after>﻿@using System.Dynamic;
@using System.Linq;
@using System.Collections.Generic;
@using DotNetNuke.Web.DDRMenu;
@using DotNetNuke.Common;
@using DotNetNuke.Entities.Portals;
@using DotNetNuke.Services.Localization;
@using R7.Epsilon.Components;
@inherits DotNetNuke.Web.Razor.DotNetNukeWebPage<dynamic>

@functions {
	string NodeActiveCssClass (MenuNode node)
	{
		return (node.Selected) ? "active" : string.Empty;
	}

	string NodeDisabledCssClass (MenuNode node)
	{
		return !node.Enabled ? "disabled" : string.Empty;
	}

	string NodeCssClasses (MenuNode node)
	{
		return (NodeActiveCssClass (node) + " " + NodeDisabledCssClass (node)).Trim ();
	}

	MenuNode FindCurrentNodeRecursive (MenuNode node)
	{
		if (node.Selected) {
			return node;
		}

		foreach (var node1 in node.Children) {
			var node2 = FindCurrentNodeRecursive (node1);
			if (node2 != null) {
				return node2;
			}
		}

		return null;
	}

	// TODO: Implement via NodeManipulator?
	IList<MenuNode> GetBreadcrumbNodes (MenuNode root)
	{
		var currentNode = FindCurrentNodeRecursive (root);
		var nodes = new List<MenuNode> ();
		while (currentNode != null) {
			nodes.Insert (0, currentNode);
			currentNode = currentNode.Parent;
		}

		return nodes;
	}

	string GetString (string resourceKey)
	{
		var resourceFileRoot = "~/Portals/_default/Skins/R7.Epsilon/App_LocalResources/Fake.ascx.resx";
		return Localization.GetString (resourceKey, resourceFileRoot);
	}

	string FormatUrl (MenuNode node)
	{
		if (string.IsNullOrEmpty (node.Url) && node.TabId == -1) {
			node.TabId = PortalSettings.Current.HomeTabId;
			node.Url = Globals.NavigateURL (PortalSettings.Current.HomeTabId);
		}

		var urlFormat = Model.UrlFormat;
		if (string.IsNullOrEmpty (urlFormat)) {
			return node.Url;
		}

		return EpsilonUrlHelper.FormatUrl (urlFormat, node.TabId, PortalSettings.Current.PortalId, HttpContext.Current.Request.QueryString);
	}
}

@helper RenderDropdownFor(MenuNode parentNode) {
	<div class="dropdown-menu" aria-labelledby="btnDropCrumb">
		@foreach (var node in parentNode.Children) {
			<a class="dropdown-item @NodeCssClasses(node)" href="@FormatUrl(node)">@node.Text</a>
		}
	</div>
}

@helper RenderBreadcrumb(MenuNode root) {
	// TODO: Implement schema.org markup
	var nodes = GetBreadcrumbNodes (root);
	if (nodes.Count > 0) {
        <nav aria-label="breadcrumb">
			<ol class="breadcrumb">
				@foreach (var node in nodes) {
					if (node == root) {
						node.Enabled = true;
						node.Text = GetString ("DropCrumb_Home.Text");
					}
					<li class="breadcrumb-item @NodeCssClasses(node)">
						@if (node.Selected) {
							if (node.HasChildren ()) {
								<span class="dropdown">
									<a class="dropdown-toggle" href="#" type="button" role="button" id="btnDropCrumb" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
										@Html.Raw(node.Text)
									</a>
									@RenderDropdownFor(node)
								</span>
							}
							else {
								@Html.Raw(node.Text)
							}
						}
						else {
							<a href="@FormatUrl(node)">@Html.Raw(node.Text)</a>
						}
					</li>
				}
			</ol>
		</nav>
	}
}
{'fraction_non_alphanumeric': 0.1364642631246047, 'fraction_numerical': 0.003320683111954459, 'mean_word_length': 3.6370967741935485, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6975948', 'n_tokens_mistral': 2597, 'n_tokens_neox': 2181, 'n_words': 428}