mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Abstracting navigation so it can use any enums
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
namespace BTCPayServer.Views.Server
|
||||
{
|
||||
public static class ServerNavPages
|
||||
{
|
||||
public enum Pages
|
||||
{
|
||||
Index, Users, Rates, Emails, Policies, Theme, Hangfire
|
||||
}
|
||||
|
||||
public const string ACTIVE_PAGE_KEY = "ActivePage";
|
||||
public static void SetActivePageAndTitle(this ViewDataDictionary viewData, Pages activePage)
|
||||
{
|
||||
viewData["Title"] = activePage.ToString();
|
||||
viewData[ACTIVE_PAGE_KEY] = activePage;
|
||||
}
|
||||
|
||||
public static string IsActivePage(this ViewDataDictionary viewData, Pages page)
|
||||
{
|
||||
var activePage = viewData[ACTIVE_PAGE_KEY] as Pages?;
|
||||
return activePage == page ? "active" : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user