mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
pretty...
This commit is contained in:
parent
beaf0cf939
commit
afafc6b032
285 changed files with 32688 additions and 784 deletions
36
NzbDrone.Web/Helpers/IsCurrentActionHelper.cs
Normal file
36
NzbDrone.Web/Helpers/IsCurrentActionHelper.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Html;
|
||||
namespace Helpers
|
||||
{
|
||||
public static class IsCurrentActionHelper
|
||||
{
|
||||
|
||||
private static bool IsCurrentController(HtmlHelper helper, string actionName, string controllerName)
|
||||
{
|
||||
var currentControllerName = (string)helper.ViewContext.RouteData.Values["controller"];
|
||||
|
||||
if (currentControllerName.Equals(controllerName, StringComparison.CurrentCultureIgnoreCase))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static string CurrentActionLink(this HtmlHelper helper, string text, string actionName, string controllerName)
|
||||
{
|
||||
string result;
|
||||
|
||||
if (IsCurrentController(helper, actionName, controllerName))
|
||||
{
|
||||
result = "<li class='current_page_item'>";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "<li>";
|
||||
}
|
||||
|
||||
return result + helper.ActionLink(text, actionName, controllerName).ToHtmlString() + @"</li>";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue