<commit_before>﻿@functions {
    private string GetCssClass(string actionName, string controllerName)
    {
        var currentControllerName = ViewContext.RouteData.Values["controller"].ToString();

        var isCurrentController = currentControllerName == controllerName;
        if (currentControllerName == "Home")
        {
            return GetHomeControllerLinksCssClass(actionName, isCurrentController);
        }
        
        return isCurrentController ? "active" : string.Empty;
    }

    private string GetHomeControllerLinksCssClass(string actionName, bool isCurrentController)
    {
        if (!isCurrentController)
        {
            return string.Empty;
        }
        
        var isCurrentAction = ViewContext.RouteData.Values["action"].ToString() == actionName;

        return isCurrentAction ? "active" : string.Empty;
    }

}

@helper GetMenuBarLink(string linkText, string actionName, string controllerName)
{
    <li class="@GetCssClass(actionName, controllerName)">@Html.ActionLink(linkText, actionName, controllerName)</li>
}

<ul class="nav">
    @GetMenuBarLink("Home", "Index", "Home")
    @GetMenuBarLink("Concerts", "Index", "Concerts")
    @GetMenuBarLink("Rehearsals", "Index", "Rehearsals")
    @GetMenuBarLink("About", "About", "Home")
    @GetMenuBarLink("Contact", "Contact", "Home")
</ul><commit_msg>Add drop-down menu for concerts.<commit_after>﻿@functions {
    private string GetCssClass(string actionName, string controllerName)
    {
        var currentControllerName = ViewContext.RouteData.Values["controller"].ToString();

        var isCurrentController = currentControllerName == controllerName;
        if (currentControllerName == "Home")
        {
            return GetHomeControllerLinksCssClass(actionName, isCurrentController);
        }
        
        return isCurrentController ? "active" : string.Empty;
    }

    private string GetHomeControllerLinksCssClass(string actionName, bool isCurrentController)
    {
        if (!isCurrentController)
        {
            return string.Empty;
        }
        
        var isCurrentAction = ViewContext.RouteData.Values["action"].ToString() == actionName;

        return isCurrentAction ? "active" : string.Empty;
    }

}

@helper GetMenuBarLink(string linkText, string actionName, string controllerName)
{
    <li class="dropdown @GetCssClass(actionName, controllerName)">
        @if (controllerName == "Concerts" && Request.IsAuthenticated)
        {
            <a href="@Url.Action(actionName, controllerName)" class="dropdown-toggle" data-toggle="dropdown">
                @linkText
                <b class="caret"></b>
            </a>
            
            <ul class="dropdown-menu">
                <li>@Html.ActionLink("Administer Concerts", "List", "Concerts")</li>
            </ul>
        }
        else
        {
            @Html.ActionLink(linkText, actionName, controllerName)
        }
    </li>
}

<ul class="nav">
    @GetMenuBarLink("Home", "Index", "Home")
    @GetMenuBarLink("Concerts", "Index", "Concerts")
    @GetMenuBarLink("Rehearsals", "Index", "Rehearsals")
    @GetMenuBarLink("About", "About", "Home")
    @GetMenuBarLink("Contact", "Contact", "Home")
</ul>
{'fraction_non_alphanumeric': 0.12426219322771047, 'fraction_numerical': 0.0, 'mean_word_length': 3.0350877192982457, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '5145653', 'n_tokens_mistral': 900, 'n_tokens_neox': 885, 'n_words': 171}