mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
Adding overriding of CreativeStartUri, refactoring PoliciesSettings
This commit is contained in:
@@ -207,7 +207,7 @@ namespace BTCPayServer.Controllers
|
|||||||
await _SettingsRepository.UpdateSetting(settings);
|
await _SettingsRepository.UpdateSetting(settings);
|
||||||
// TODO: remove controller/class-level property and have only reference to
|
// TODO: remove controller/class-level property and have only reference to
|
||||||
// CssThemeManager here in this method
|
// CssThemeManager here in this method
|
||||||
_CssThemeManager.Update(settings.CustomBootstrapThemeCssUri);
|
_CssThemeManager.Update(settings);
|
||||||
TempData["StatusMessage"] = "Policies upadated successfully";
|
TempData["StatusMessage"] = "Policies upadated successfully";
|
||||||
return View(settings);
|
return View(settings);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,24 +21,42 @@ namespace BTCPayServer.HostedServices
|
|||||||
Update(settingsRepository);
|
Update(settingsRepository);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _bootstrapThemeUri;
|
|
||||||
public string BootstrapThemeUri
|
|
||||||
{
|
|
||||||
get { return _bootstrapThemeUri; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void Update(SettingsRepository settingsRepository)
|
private async void Update(SettingsRepository settingsRepository)
|
||||||
{
|
{
|
||||||
var data = (await settingsRepository.GetSettingAsync<PoliciesSettings>()) ?? new PoliciesSettings();
|
var data = (await settingsRepository.GetSettingAsync<PoliciesSettings>()) ?? new PoliciesSettings();
|
||||||
Update(data.CustomBootstrapThemeCssUri);
|
Update(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(string newUri)
|
public void Update(PoliciesSettings data)
|
||||||
|
{
|
||||||
|
UpdateBootstrap(data.BootstrapCssUri);
|
||||||
|
UpdateCreativeStart(data.CreativeStartCssUri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _bootstrapUri;
|
||||||
|
public string BootstrapUri
|
||||||
|
{
|
||||||
|
get { return _bootstrapUri; }
|
||||||
|
}
|
||||||
|
public void UpdateBootstrap(string newUri)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrWhiteSpace(newUri))
|
if (String.IsNullOrWhiteSpace(newUri))
|
||||||
_bootstrapThemeUri = "/vendor/bootstrap4/css/bootstrap.css";
|
_bootstrapUri = "/vendor/bootstrap4/css/bootstrap.css";
|
||||||
else
|
else
|
||||||
_bootstrapThemeUri = newUri;
|
_bootstrapUri = newUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _creativeStartUri;
|
||||||
|
public string CreativeStartUri
|
||||||
|
{
|
||||||
|
get { return _creativeStartUri; }
|
||||||
|
}
|
||||||
|
public void UpdateCreativeStart(string newUri)
|
||||||
|
{
|
||||||
|
if (String.IsNullOrWhiteSpace(newUri))
|
||||||
|
_creativeStartUri = "/vendor/bootstrap4-creativestart/creative.css";
|
||||||
|
else
|
||||||
|
_creativeStartUri = newUri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ namespace BTCPayServer.Services
|
|||||||
public bool LockSubscription { get; set; }
|
public bool LockSubscription { get; set; }
|
||||||
|
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public string CustomBootstrapThemeCssUri { get; set; }
|
public string BootstrapCssUri { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
|
public string CreativeStartCssUri { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,14 +16,23 @@
|
|||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="CustomBootstrapThemeCssUri"></label>
|
<label asp-for="BootstrapCssUri"></label>
|
||||||
<input asp-for="CustomBootstrapThemeCssUri" class="form-control" />
|
<input asp-for="BootstrapCssUri" class="form-control" />
|
||||||
<span asp-validation-for="CustomBootstrapThemeCssUri" class="text-danger"></span>
|
<span asp-validation-for="BootstrapCssUri" class="text-danger"></span>
|
||||||
<p class="form-text text-muted">
|
<p class="form-text text-muted">
|
||||||
<a href="https://bootstrap.build/app/v4.0/" target="_blank">Build your own theme</a>
|
<a href="https://bootstrap.build/app/v4.0/" target="_blank">Build your own theme</a>
|
||||||
or <a href="https://bootswatch.com/" target="_blank">pick one already made</a>
|
or <a href="https://bootswatch.com/" target="_blank">pick one already made</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="CreativeStartCssUri"></label>
|
||||||
|
<input asp-for="CreativeStartCssUri" class="form-control" />
|
||||||
|
<span asp-validation-for="CreativeStartCssUri" class="text-danger"></span>
|
||||||
|
<p class="form-text text-muted">
|
||||||
|
<a href="https://startbootstrap.com/template-overviews/creative/" target="_blank">Creative Start theme</a>
|
||||||
|
is used on top of Bootstrap
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="RequiresConfirmedEmail"></label>
|
<label asp-for="RequiresConfirmedEmail"></label>
|
||||||
<input asp-for="RequiresConfirmedEmail" type="checkbox" class="form-check-inline" />
|
<input asp-for="RequiresConfirmedEmail" type="checkbox" class="form-check-inline" />
|
||||||
|
|||||||
@@ -18,10 +18,8 @@
|
|||||||
<title>BTCPay Server</title>
|
<title>BTCPay Server</title>
|
||||||
|
|
||||||
@* CSS *@
|
@* CSS *@
|
||||||
<link href="@themeManager.BootstrapThemeUri" rel="stylesheet" />
|
<link href="@themeManager.BootstrapUri" rel="stylesheet" />
|
||||||
|
<link href="@themeManager.CreativeStartUri" rel="stylesheet" />
|
||||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
|
|
||||||
<link href='https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
|
|
||||||
|
|
||||||
<bundle name="wwwroot/bundles/main-bundle.min.css" />
|
<bundle name="wwwroot/bundles/main-bundle.min.css" />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user