2017-09-13 23:50:36 +09:00
|
|
|
|
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.Stores
|
|
|
|
|
{
|
2017-10-27 17:53:04 +09:00
|
|
|
|
public static class StoreNavPages
|
|
|
|
|
{
|
|
|
|
|
public static string ActivePageKey => "ActivePage";
|
|
|
|
|
public static string Index => "Index";
|
2018-03-27 14:48:32 +09:00
|
|
|
|
public static string Checkout => "Checkout experience";
|
2017-09-13 23:50:36 +09:00
|
|
|
|
|
2017-10-27 17:53:04 +09:00
|
|
|
|
public static string Tokens => "Tokens";
|
2018-03-23 16:24:57 +09:00
|
|
|
|
public static string Users => "Users";
|
|
|
|
|
public static string UsersNavClass(ViewContext viewContext) => PageNavClass(viewContext, Users);
|
2017-10-27 17:53:04 +09:00
|
|
|
|
public static string TokensNavClass(ViewContext viewContext) => PageNavClass(viewContext, Tokens);
|
2017-09-13 23:50:36 +09:00
|
|
|
|
|
2018-03-27 14:48:32 +09:00
|
|
|
|
public static string CheckoutNavClass(ViewContext viewContext) => PageNavClass(viewContext, Checkout);
|
2017-10-27 17:53:04 +09:00
|
|
|
|
public static string IndexNavClass(ViewContext viewContext) => PageNavClass(viewContext, Index);
|
2017-09-13 23:50:36 +09:00
|
|
|
|
|
2017-10-27 17:53:04 +09:00
|
|
|
|
public static string PageNavClass(ViewContext viewContext, string page)
|
|
|
|
|
{
|
|
|
|
|
var activePage = viewContext.ViewData["ActivePage"] as string;
|
|
|
|
|
return string.Equals(activePage, page, StringComparison.OrdinalIgnoreCase) ? "active" : null;
|
|
|
|
|
}
|
2017-09-13 23:50:36 +09:00
|
|
|
|
|
2017-10-27 17:53:04 +09:00
|
|
|
|
public static void AddActivePage(this ViewDataDictionary viewData, string activePage) => viewData[ActivePageKey] = activePage;
|
|
|
|
|
}
|
2017-09-13 23:50:36 +09:00
|
|
|
|
}
|