Store Branding: Refactoring and logo as favicon (#5519)

* Store Branding: Refactoring and logo as favicon

- Encapsulates store branding properties into their own view model
- Uses the logo as favicon on public pages

* Refactorings

* Updates
This commit is contained in:
d11n
2023-12-01 16:13:44 +01:00
committed by GitHub
parent afed3a0899
commit 44b7ed0e6e
33 changed files with 138 additions and 140 deletions

View File

@@ -10,6 +10,7 @@ using BTCPayServer.Data;
using BTCPayServer.Filters;
using BTCPayServer.Forms;
using BTCPayServer.Forms.Models;
using BTCPayServer.Models;
using BTCPayServer.Models.PaymentRequestViewModels;
using BTCPayServer.PaymentRequest;
using BTCPayServer.Services;
@@ -209,12 +210,14 @@ namespace BTCPayServer.Controllers
}
var storeBlob = store.GetStoreBlob();
vm.HubPath = PaymentRequestHub.GetHubPath(Request);
vm.StoreName = store.StoreName;
vm.StoreWebsite = store.StoreWebsite;
vm.BrandColor = storeBlob.BrandColor;
vm.LogoFileId = storeBlob.LogoFileId;
vm.CssFileId = storeBlob.CssFileId;
vm.HubPath = PaymentRequestHub.GetHubPath(Request);
vm.StoreBranding = new StoreBrandingViewModel(storeBlob)
{
EmbeddedCSS = vm.EmbeddedCSS,
CustomCSSLink = vm.CustomCSSLink
};
return View(vm);
}
@@ -240,7 +243,6 @@ namespace BTCPayServer.Controllers
var formData = await FormDataService.GetForm(prFormId);
if (formData is null)
{
return RedirectToAction("PayPaymentRequest", new { payReqId });
}
@@ -266,8 +268,14 @@ namespace BTCPayServer.Controllers
}
viewModel.FormName = formData.Name;
viewModel.Form = form;
var storeBlob = result.StoreData.GetStoreBlob();
viewModel.StoreBranding = new StoreBrandingViewModel(storeBlob)
{
EmbeddedCSS = prBlob.EmbeddedCSS,
CustomCSSLink = prBlob.CustomCSSLink
};
return View("Views/UIForms/View", viewModel);
}
[HttpGet("{payReqId}/pay")]