Merge pull request #190 from hargata/Hargata/alternate.logo

allows users to inject their own logo.
This commit is contained in:
Hargata Softworks 2024-01-30 14:43:51 -07:00 committed by GitHub
commit d816f73598
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -9,6 +9,7 @@ namespace CarCareTracker.Helper
{ {
UserConfig GetUserConfig(ClaimsPrincipal user); UserConfig GetUserConfig(ClaimsPrincipal user);
bool SaveUserConfig(ClaimsPrincipal user, UserConfig configData); bool SaveUserConfig(ClaimsPrincipal user, UserConfig configData);
string GetLogoUrl();
public bool DeleteUserConfig(int userId); public bool DeleteUserConfig(int userId);
} }
public class ConfigHelper : IConfigHelper public class ConfigHelper : IConfigHelper
@ -24,6 +25,15 @@ namespace CarCareTracker.Helper
_userConfig = userConfig; _userConfig = userConfig;
_cache = memoryCache; _cache = memoryCache;
} }
public string GetLogoUrl()
{
var logoUrl = _config["LUBELOGGER_LOGO_URL"];
if (string.IsNullOrWhiteSpace(logoUrl))
{
logoUrl = "/defaults/lubelogger_logo.png";
}
return logoUrl;
}
public bool SaveUserConfig(ClaimsPrincipal user, UserConfig configData) public bool SaveUserConfig(ClaimsPrincipal user, UserConfig configData)
{ {
var storedUserId = user.FindFirstValue(ClaimTypes.NameIdentifier); var storedUserId = user.FindFirstValue(ClaimTypes.NameIdentifier);

View File

@ -2,6 +2,7 @@
@inject IConfigHelper config @inject IConfigHelper config
@{ @{
var enableAuth = config.GetUserConfig(User).EnableAuth; var enableAuth = config.GetUserConfig(User).EnableAuth;
var logoUrl = config.GetLogoUrl();
} }
@model string @model string
@{ @{
@ -35,7 +36,7 @@
<div class="container"> <div class="container">
<div class="row mt-2"> <div class="row mt-2">
<div class="d-flex lubelogger-navbar"> <div class="d-flex lubelogger-navbar">
<img src="/defaults/lubelogger_logo.png" /> <img src="@logoUrl" />
<div class="lubelogger-navbar-button"> <div class="lubelogger-navbar-button">
<button type="button" class="btn btn-dark" onclick="showMobileNav()"><i class="bi bi-list lubelogger-menu-icon"></i></button> <button type="button" class="btn btn-dark" onclick="showMobileNav()"><i class="bi bi-list lubelogger-menu-icon"></i></button>
</div> </div>