diff --git a/BTCPayServer.Tests/SeleniumTester.cs b/BTCPayServer.Tests/SeleniumTester.cs index 2bb61b37b..e6c72f53f 100644 --- a/BTCPayServer.Tests/SeleniumTester.cs +++ b/BTCPayServer.Tests/SeleniumTester.cs @@ -225,7 +225,7 @@ namespace BTCPayServer.Tests public void ClickOnAllSideMenus() { - var links = Driver.FindElements(By.CssSelector(".nav-pills .nav-link")).Select(c => c.GetAttribute("href")).ToList(); + var links = Driver.FindElements(By.CssSelector(".nav .nav-link")).Select(c => c.GetAttribute("href")).ToList(); Driver.AssertNoError(); Assert.NotEmpty(links); foreach (var l in links) diff --git a/BTCPayServer/Controllers/AppsController.Crowdfund.cs b/BTCPayServer/Controllers/AppsController.Crowdfund.cs index 5727ee368..ca3caaf6d 100644 --- a/BTCPayServer/Controllers/AppsController.Crowdfund.cs +++ b/BTCPayServer/Controllers/AppsController.Crowdfund.cs @@ -16,23 +16,22 @@ namespace BTCPayServer.Controllers public string StoreId { get; set; } public override string ToString() { - return String.Empty; + return string.Empty; } } - - [HttpGet] - [Route("{appId}/settings/crowdfund")] + [HttpGet("{appId}/settings/crowdfund")] public async Task UpdateCrowdfund(string appId) { var app = await GetOwnedApp(appId, AppType.Crowdfund); if (app == null) return NotFound(); var settings = app.GetSettings(); - var vm = new UpdateCrowdfundViewModel() + var vm = new UpdateCrowdfundViewModel { Title = settings.Title, StoreId = app.StoreDataId, + StoreName = app.StoreData?.StoreName, Enabled = settings.Enabled, EnforceTargetAmount = settings.EnforceTargetAmount, StartDate = settings.StartDate, diff --git a/BTCPayServer/Controllers/AppsController.PointOfSale.cs b/BTCPayServer/Controllers/AppsController.PointOfSale.cs index fb46bf12d..427ec1f98 100644 --- a/BTCPayServer/Controllers/AppsController.PointOfSale.cs +++ b/BTCPayServer/Controllers/AppsController.PointOfSale.cs @@ -97,10 +97,11 @@ namespace BTCPayServer.Controllers settings.DefaultView = settings.EnableShoppingCart ? PosViewType.Cart : settings.DefaultView; settings.EnableShoppingCart = false; - var vm = new UpdatePointOfSaleViewModel() + var vm = new UpdatePointOfSaleViewModel { Id = appId, StoreId = app.StoreDataId, + StoreName = app.StoreData?.StoreName, Title = settings.Title, DefaultView = settings.DefaultView, ShowCustomAmount = settings.ShowCustomAmount, @@ -183,7 +184,7 @@ namespace BTCPayServer.Controllers var app = await GetOwnedApp(appId, AppType.PointOfSale); if (app == null) return NotFound(); - app.SetSettings(new PointOfSaleSettings() + app.SetSettings(new PointOfSaleSettings { Title = vm.Title, DefaultView = vm.DefaultView, diff --git a/BTCPayServer/Controllers/StoresController.cs b/BTCPayServer/Controllers/StoresController.cs index 626adb145..822eba6ba 100644 --- a/BTCPayServer/Controllers/StoresController.cs +++ b/BTCPayServer/Controllers/StoresController.cs @@ -857,6 +857,12 @@ namespace BTCPayServer.Controllers if (string.IsNullOrWhiteSpace(userId)) return Challenge(AuthenticationSchemes.Cookie); var storeId = CurrentStore?.Id; + if (storeId != null) + { + var store = await _Repo.FindStore(storeId, userId); + if (store != null) + HttpContext.SetStoreData(store); + } var model = new CreateTokenViewModel(); ViewBag.HidePublicKey = true; ViewBag.ShowStores = true; @@ -913,6 +919,14 @@ namespace BTCPayServer.Controllers return Challenge(AuthenticationSchemes.Cookie); if (pairingCode == null) return NotFound(); + if (selectedStore != null) + { + var store = await _Repo.FindStore(selectedStore, userId); + if (store == null) + return NotFound(); + HttpContext.SetStoreData(store); + ViewBag.ShowStores = false; + } var pairing = await _TokenRepository.GetPairingAsync(pairingCode); if (pairing == null) { @@ -922,7 +936,7 @@ namespace BTCPayServer.Controllers else { var stores = await _Repo.GetStoresByUserId(userId); - return View(new PairingModel() + return View(new PairingModel { Id = pairing.Id, Label = pairing.Label, @@ -981,8 +995,6 @@ namespace BTCPayServer.Controllers return _UserManager.GetUserId(User); } - - // TODO: Need to have talk about how architect default currency implementation // For now we have also hardcoded USD for Store creation and then Invoice creation const string DEFAULT_CURRENCY = "USD"; diff --git a/BTCPayServer/Controllers/WalletsController.cs b/BTCPayServer/Controllers/WalletsController.cs index 02083a6d6..ebee6f7e8 100644 --- a/BTCPayServer/Controllers/WalletsController.cs +++ b/BTCPayServer/Controllers/WalletsController.cs @@ -341,6 +341,8 @@ namespace BTCPayServer.Controllers model.Transactions = model.Transactions.OrderByDescending(t => t.Timestamp).Skip(skip).Take(count).ToList(); } + model.CryptoCode = walletId.CryptoCode; + return View(model); } diff --git a/BTCPayServer/Models/AppViewModels/UpdateCrowdfundViewModel.cs b/BTCPayServer/Models/AppViewModels/UpdateCrowdfundViewModel.cs index 02572b8d9..51cd8bbbc 100644 --- a/BTCPayServer/Models/AppViewModels/UpdateCrowdfundViewModel.cs +++ b/BTCPayServer/Models/AppViewModels/UpdateCrowdfundViewModel.cs @@ -9,6 +9,8 @@ namespace BTCPayServer.Models.AppViewModels public class UpdateCrowdfundViewModel { public string StoreId { get; set; } + public string StoreName { get; set; } + [Required] [MaxLength(30)] public string Title { get; set; } @@ -95,12 +97,7 @@ namespace BTCPayServer.Models.AppViewModels [Display(Name = "Colors to rotate between with animation when a payment is made. First color is the default background. One color per line. Can be any valid css color value.")] public string AnimationColors { get; set; } - // NOTE: Improve validation if needed - public bool ModelWithMinimumData - { - get { return Description != null && Title != null && TargetCurrency != null; } - } - + public bool ModelWithMinimumData => Description != null && Title != null && TargetCurrency != null; } } diff --git a/BTCPayServer/Models/AppViewModels/UpdatePointOfSaleViewModel.cs b/BTCPayServer/Models/AppViewModels/UpdatePointOfSaleViewModel.cs index 84aaa6b06..5e9af8c04 100644 --- a/BTCPayServer/Models/AppViewModels/UpdatePointOfSaleViewModel.cs +++ b/BTCPayServer/Models/AppViewModels/UpdatePointOfSaleViewModel.cs @@ -9,6 +9,8 @@ namespace BTCPayServer.Models.AppViewModels public class UpdatePointOfSaleViewModel { public string StoreId { get; set; } + public string StoreName { get; set; } + [Required] [MaxLength(30)] public string Title { get; set; } diff --git a/BTCPayServer/Models/WalletViewModels/ListTransactionsViewModel.cs b/BTCPayServer/Models/WalletViewModels/ListTransactionsViewModel.cs index e58df812f..9294f1673 100644 --- a/BTCPayServer/Models/WalletViewModels/ListTransactionsViewModel.cs +++ b/BTCPayServer/Models/WalletViewModels/ListTransactionsViewModel.cs @@ -19,5 +19,6 @@ namespace BTCPayServer.Models.WalletViewModels } public HashSet Labels { get; set; } = new HashSet(); public List Transactions { get; set; } = new List(); + public string CryptoCode { get; set; } } } diff --git a/BTCPayServer/Views/Account/ForgotPassword.cshtml b/BTCPayServer/Views/Account/ForgotPassword.cshtml index 714812515..767ddbe65 100644 --- a/BTCPayServer/Views/Account/ForgotPassword.cshtml +++ b/BTCPayServer/Views/Account/ForgotPassword.cshtml @@ -5,14 +5,8 @@
- @if (TempData.HasStatusMessage()) - { -
-
- -
-
- } + +

@ViewData["Title"]

@@ -39,6 +33,7 @@
+ @section Scripts { - @await Html.PartialAsync("_ValidationScriptsPartial") + } diff --git a/BTCPayServer/Views/Account/Login.cshtml b/BTCPayServer/Views/Account/Login.cshtml index 7e6833b21..27feb0077 100644 --- a/BTCPayServer/Views/Account/Login.cshtml +++ b/BTCPayServer/Views/Account/Login.cshtml @@ -7,7 +7,7 @@ } @section Scripts { - @await Html.PartialAsync("_ValidationScriptsPartial") + }
@@ -18,10 +18,7 @@

Welcome to your BTCPay Server

- @if (TempData.HasStatusMessage()) - { - - } +
diff --git a/BTCPayServer/Views/Account/LoginWith2fa.cshtml b/BTCPayServer/Views/Account/LoginWith2fa.cshtml index b145b3b33..f8886d049 100644 --- a/BTCPayServer/Views/Account/LoginWith2fa.cshtml +++ b/BTCPayServer/Views/Account/LoginWith2fa.cshtml @@ -43,5 +43,5 @@ @section Scripts { - @await Html.PartialAsync("_ValidationScriptsPartial") + } diff --git a/BTCPayServer/Views/Account/LoginWithRecoveryCode.cshtml b/BTCPayServer/Views/Account/LoginWithRecoveryCode.cshtml index 1af51bcaa..e2534bfb3 100644 --- a/BTCPayServer/Views/Account/LoginWithRecoveryCode.cshtml +++ b/BTCPayServer/Views/Account/LoginWithRecoveryCode.cshtml @@ -33,5 +33,5 @@ @section Scripts { - @await Html.PartialAsync("_ValidationScriptsPartial") + } diff --git a/BTCPayServer/Views/Account/Register.cshtml b/BTCPayServer/Views/Account/Register.cshtml index 812a02ae5..ed42a1f24 100644 --- a/BTCPayServer/Views/Account/Register.cshtml +++ b/BTCPayServer/Views/Account/Register.cshtml @@ -6,7 +6,7 @@ } @section Scripts { - @await Html.PartialAsync("_ValidationScriptsPartial") + }
@@ -22,10 +22,7 @@ It is secure, private, censorship-resistant and free.

- @if (TempData.HasStatusMessage()) - { - - } +
diff --git a/BTCPayServer/Views/Account/SecondaryLogin.cshtml b/BTCPayServer/Views/Account/SecondaryLogin.cshtml index 9b2760645..89f579e19 100644 --- a/BTCPayServer/Views/Account/SecondaryLogin.cshtml +++ b/BTCPayServer/Views/Account/SecondaryLogin.cshtml @@ -36,6 +36,7 @@ + @section Scripts { - @await Html.PartialAsync("_ValidationScriptsPartial") + } diff --git a/BTCPayServer/Views/Account/SetPassword.cshtml b/BTCPayServer/Views/Account/SetPassword.cshtml index 0a72969ae..0e62f7e9a 100644 --- a/BTCPayServer/Views/Account/SetPassword.cshtml +++ b/BTCPayServer/Views/Account/SetPassword.cshtml @@ -1,12 +1,11 @@ @model BTCPayServer.Models.AccountViewModels.SetPasswordViewModel @{ ViewData["Title"] = "Reset password"; - Layout = "_LayoutSimple"; } @section Scripts { - @await Html.PartialAsync("_ValidationScriptsPartial") + }
@@ -17,10 +16,7 @@

Welcome to your BTCPay Server

- @if (TempData.HasStatusMessage()) - { - - } +
diff --git a/BTCPayServer/Views/Apps/AppsNavPages.cs b/BTCPayServer/Views/Apps/AppsNavPages.cs index 2ec18d1d6..e8b7f1529 100644 --- a/BTCPayServer/Views/Apps/AppsNavPages.cs +++ b/BTCPayServer/Views/Apps/AppsNavPages.cs @@ -2,6 +2,6 @@ namespace BTCPayServer.Views.Apps { public enum AppsNavPages { - Index, Create + Index, Create, Update } } diff --git a/BTCPayServer/Views/Apps/CreateApp.cshtml b/BTCPayServer/Views/Apps/CreateApp.cshtml index 6136dac1b..2a0189924 100644 --- a/BTCPayServer/Views/Apps/CreateApp.cshtml +++ b/BTCPayServer/Views/Apps/CreateApp.cshtml @@ -1,15 +1,13 @@ @model CreateAppViewModel @{ - ViewData["Title"] = "Create a new app"; + ViewData.SetActivePageAndTitle(AppsNavPages.Create, "Create a new app"); }
-
-
-

@ViewData["Title"]

-
-
-
+ + +

@ViewData["Title"]

+
@@ -28,10 +26,10 @@
- + + Back to list
- Back to the app list
diff --git a/BTCPayServer/Views/Apps/ListApps.cshtml b/BTCPayServer/Views/Apps/ListApps.cshtml index 3e4f1f149..d5268697d 100644 --- a/BTCPayServer/Views/Apps/ListApps.cshtml +++ b/BTCPayServer/Views/Apps/ListApps.cshtml @@ -1,6 +1,6 @@ @model ListAppsViewModel @{ - ViewData["Title"] = "Apps"; + ViewData.SetActivePageAndTitle(AppsNavPages.Index, "Apps"); var storeNameSortOrder = (string)ViewData["StoreNameSortOrder"]; var appNameSortOrder = (string)ViewData["AppNameSortOrder"]; var appTypeSortOrder = (string)ViewData["AppTypeSortOrder"]; @@ -10,27 +10,20 @@
- @if (TempData.HasStatusMessage()) - { -
-
- -
-
- } -
-
-

@ViewData["Title"]

-
-

Create and manage apps.

-
-
-
- + + +
+

+ @ViewData["PageTitle"] + + + + + +

+ Create a new app
+
@if (Model.Apps.Any()) diff --git a/BTCPayServer/Views/Apps/UpdateCrowdfund.cshtml b/BTCPayServer/Views/Apps/UpdateCrowdfund.cshtml index 175942830..28ebbe6d8 100644 --- a/BTCPayServer/Views/Apps/UpdateCrowdfund.cshtml +++ b/BTCPayServer/Views/Apps/UpdateCrowdfund.cshtml @@ -2,25 +2,14 @@ @using System.Globalization @model UpdateCrowdfundViewModel @{ - ViewData["Title"] = "Update Crowdfund"; + ViewData.SetActivePageAndTitle(AppsNavPages.Update, "Update Crowdfund", Model.StoreName); }
-
-
-
-

@ViewData["Title"]

-
-
-
- @if (TempData.HasStatusMessage()) - { -
-
- -
-
- } + + +

@ViewData["PageTitle"]

+
@@ -92,7 +81,9 @@
- + + +
@@ -100,7 +91,9 @@
- + + +
diff --git a/BTCPayServer/Views/Apps/UpdatePointOfSale.cshtml b/BTCPayServer/Views/Apps/UpdatePointOfSale.cshtml index 3418a5305..ee20a465a 100644 --- a/BTCPayServer/Views/Apps/UpdatePointOfSale.cshtml +++ b/BTCPayServer/Views/Apps/UpdatePointOfSale.cshtml @@ -2,24 +2,14 @@ @addTagHelper *, BundlerMinifier.TagHelpers @model UpdatePointOfSaleViewModel @{ - ViewData["Title"] = "Update Point of Sale"; + ViewData.SetActivePageAndTitle(AppsNavPages.Update, "Update Point of Sale", Model.StoreName); }
-
-
-

@ViewData["Title"]

-
-
-
- @if (TempData.HasStatusMessage()) - { -
-
- -
-
- } + + +

@ViewData["PageTitle"]

+
@@ -79,11 +69,15 @@
- + + +
+ +
diff --git a/BTCPayServer/Views/Apps/_ViewImports.cshtml b/BTCPayServer/Views/Apps/_ViewImports.cshtml index ee3f9960b..0a4a4114e 100644 --- a/BTCPayServer/Views/Apps/_ViewImports.cshtml +++ b/BTCPayServer/Views/Apps/_ViewImports.cshtml @@ -1 +1,2 @@ -@using BTCPayServer.Models.AppViewModels +@using BTCPayServer.Views.Apps +@using BTCPayServer.Models.AppViewModels diff --git a/BTCPayServer/Views/Apps/_ViewStart.cshtml b/BTCPayServer/Views/Apps/_ViewStart.cshtml index 3cda48fd0..ce0623920 100644 --- a/BTCPayServer/Views/Apps/_ViewStart.cshtml +++ b/BTCPayServer/Views/Apps/_ViewStart.cshtml @@ -1,6 +1,6 @@ @using BTCPayServer.Views @using BTCPayServer.Views.Apps @{ - ViewBag.MainTitle = "Manage app"; + ViewBag.CategoryTitle = "Apps"; ViewData.SetActiveCategory(typeof(AppsNavPages)); } diff --git a/BTCPayServer/Views/AppsPublic/PointOfSale/Cart.cshtml b/BTCPayServer/Views/AppsPublic/PointOfSale/Cart.cshtml index 10b1c7357..678c5c3ad 100644 --- a/BTCPayServer/Views/AppsPublic/PointOfSale/Cart.cshtml +++ b/BTCPayServer/Views/AppsPublic/PointOfSale/Cart.cshtml @@ -202,10 +202,8 @@
- @if (this.TempData.HasStatusMessage()) - { - - } + +
  diff --git a/BTCPayServer/Views/AppsPublic/PointOfSale/Light.cshtml b/BTCPayServer/Views/AppsPublic/PointOfSale/Light.cshtml index fef2e4329..e30ced492 100644 --- a/BTCPayServer/Views/AppsPublic/PointOfSale/Light.cshtml +++ b/BTCPayServer/Views/AppsPublic/PointOfSale/Light.cshtml @@ -5,12 +5,12 @@ @if (Context.Request.Query.ContainsKey("simple")) { - @await Html.PartialAsync("/Views/AppsPublic/PointOfSale/MinimalLight.cshtml", Model) + } else { - @await Html.PartialAsync("/Views/AppsPublic/PointOfSale/VueLight.cshtml", Model) + } diff --git a/BTCPayServer/Views/AppsPublic/PointOfSale/Static.cshtml b/BTCPayServer/Views/AppsPublic/PointOfSale/Static.cshtml index b45bd1b94..6bb47ce6b 100644 --- a/BTCPayServer/Views/AppsPublic/PointOfSale/Static.cshtml +++ b/BTCPayServer/Views/AppsPublic/PointOfSale/Static.cshtml @@ -6,10 +6,8 @@
- @if (TempData.HasStatusMessage()) - { - - } + +

@Model.Title

@if (!string.IsNullOrEmpty(Model.Description)) { diff --git a/BTCPayServer/Views/AppsPublic/ViewCrowdfund.cshtml b/BTCPayServer/Views/AppsPublic/ViewCrowdfund.cshtml index a0785c307..41ba94f1c 100644 --- a/BTCPayServer/Views/AppsPublic/ViewCrowdfund.cshtml +++ b/BTCPayServer/Views/AppsPublic/ViewCrowdfund.cshtml @@ -40,12 +40,12 @@ @if (Context.Request.Query.ContainsKey("simple")) { - @await Html.PartialAsync("/Views/AppsPublic/Crowdfund/MinimalCrowdfund.cshtml", Model) + } else {