mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
Add description and embedded css to POS (#970)
* Add description and embedded css to POS * wrap embedded css props in <style> before Safe.raw
This commit is contained in:
committed by
Nicolas Dorier
parent
e743b2e457
commit
72d519bb45
@@ -78,6 +78,10 @@ namespace BTCPayServer.Controllers
|
|||||||
|
|
||||||
|
|
||||||
public string CustomCSSLink { get; set; }
|
public string CustomCSSLink { get; set; }
|
||||||
|
|
||||||
|
public string EmbeddedCSS { get; set; }
|
||||||
|
|
||||||
|
public string Description { get; set; }
|
||||||
public string NotificationEmail { get; set; }
|
public string NotificationEmail { get; set; }
|
||||||
public string NotificationUrl { get; set; }
|
public string NotificationUrl { get; set; }
|
||||||
public bool? RedirectAutomatically { get; set; }
|
public bool? RedirectAutomatically { get; set; }
|
||||||
@@ -109,6 +113,8 @@ namespace BTCPayServer.Controllers
|
|||||||
CustomTipText = settings.CustomTipText ?? PointOfSaleSettings.CUSTOM_TIP_TEXT_DEF,
|
CustomTipText = settings.CustomTipText ?? PointOfSaleSettings.CUSTOM_TIP_TEXT_DEF,
|
||||||
CustomTipPercentages = settings.CustomTipPercentages != null ? string.Join(",", settings.CustomTipPercentages) : string.Join(",", PointOfSaleSettings.CUSTOM_TIP_PERCENTAGES_DEF),
|
CustomTipPercentages = settings.CustomTipPercentages != null ? string.Join(",", settings.CustomTipPercentages) : string.Join(",", PointOfSaleSettings.CUSTOM_TIP_PERCENTAGES_DEF),
|
||||||
CustomCSSLink = settings.CustomCSSLink,
|
CustomCSSLink = settings.CustomCSSLink,
|
||||||
|
EmbeddedCSS = settings.EmbeddedCSS,
|
||||||
|
Description = settings.Description,
|
||||||
NotificationEmail = settings.NotificationEmail,
|
NotificationEmail = settings.NotificationEmail,
|
||||||
NotificationUrl = settings.NotificationUrl,
|
NotificationUrl = settings.NotificationUrl,
|
||||||
RedirectAutomatically = settings.RedirectAutomatically.HasValue? settings.RedirectAutomatically.Value? "true": "false" : ""
|
RedirectAutomatically = settings.RedirectAutomatically.HasValue? settings.RedirectAutomatically.Value? "true": "false" : ""
|
||||||
@@ -187,6 +193,8 @@ namespace BTCPayServer.Controllers
|
|||||||
CustomCSSLink = vm.CustomCSSLink,
|
CustomCSSLink = vm.CustomCSSLink,
|
||||||
NotificationUrl = vm.NotificationUrl,
|
NotificationUrl = vm.NotificationUrl,
|
||||||
NotificationEmail = vm.NotificationEmail,
|
NotificationEmail = vm.NotificationEmail,
|
||||||
|
Description = vm.Description,
|
||||||
|
EmbeddedCSS = vm.EmbeddedCSS,
|
||||||
RedirectAutomatically = string.IsNullOrEmpty(vm.RedirectAutomatically)? (bool?) null: bool.Parse(vm.RedirectAutomatically)
|
RedirectAutomatically = string.IsNullOrEmpty(vm.RedirectAutomatically)? (bool?) null: bool.Parse(vm.RedirectAutomatically)
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -87,7 +87,9 @@ namespace BTCPayServer.Controllers
|
|||||||
CustomTipText = settings.CustomTipText,
|
CustomTipText = settings.CustomTipText,
|
||||||
CustomTipPercentages = settings.CustomTipPercentages,
|
CustomTipPercentages = settings.CustomTipPercentages,
|
||||||
CustomCSSLink = settings.CustomCSSLink,
|
CustomCSSLink = settings.CustomCSSLink,
|
||||||
AppId = appId
|
AppId = appId,
|
||||||
|
Description = settings.Description,
|
||||||
|
EmbeddedCSS = settings.EmbeddedCSS
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,5 +85,7 @@ namespace BTCPayServer.Models.AppViewModels
|
|||||||
}, nameof(SelectListItem.Value), nameof(SelectListItem.Text), RedirectAutomatically);
|
}, nameof(SelectListItem.Value), nameof(SelectListItem.Text), RedirectAutomatically);
|
||||||
|
|
||||||
public bool NotificationEmailWarning { get; set; }
|
public bool NotificationEmailWarning { get; set; }
|
||||||
|
public string EmbeddedCSS { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,5 +50,7 @@ namespace BTCPayServer.Models.AppViewModels
|
|||||||
public int[] CustomTipPercentages { get; set; }
|
public int[] CustomTipPercentages { get; set; }
|
||||||
|
|
||||||
public string CustomCSSLink { get; set; }
|
public string CustomCSSLink { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public string EmbeddedCSS { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
@addTagHelper *, BundlerMinifier.TagHelpers
|
@addTagHelper *, BundlerMinifier.TagHelpers
|
||||||
@using System.Globalization
|
|
||||||
@model UpdatePointOfSaleViewModel
|
@model UpdatePointOfSaleViewModel
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Update Point of Sale";
|
ViewData["Title"] = "Update Point of Sale";
|
||||||
@@ -132,6 +131,16 @@
|
|||||||
<select asp-for="RedirectAutomatically" asp-items="Model.RedirectAutomaticallySelectList" class="form-control"></select>
|
<select asp-for="RedirectAutomatically" asp-items="Model.RedirectAutomaticallySelectList" class="form-control"></select>
|
||||||
<span asp-validation-for="RedirectAutomatically" class="text-danger"></span>
|
<span asp-validation-for="RedirectAutomatically" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Description" class="control-label"></label>
|
||||||
|
<textarea asp-for="Description" rows="10" cols="40" class="form-control richtext"></textarea>
|
||||||
|
<span asp-validation-for="Description" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="EmbeddedCSS" class="control-label"></label>
|
||||||
|
<textarea asp-for="EmbeddedCSS" rows="10" cols="40" class="form-control"></textarea>
|
||||||
|
<span asp-validation-for="EmbeddedCSS" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
<input type="hidden" asp-for="NotificationEmailWarning" />
|
<input type="hidden" asp-for="NotificationEmailWarning" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="submit" class="btn btn-primary" value="Save Settings" id="SaveSettings" />
|
<input type="submit" class="btn btn-primary" value="Save Settings" id="SaveSettings" />
|
||||||
@@ -265,6 +274,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
<script src="~/products/js/products.js"></script>
|
|
||||||
<script src="~/products/js/products.jquery.js"></script>
|
<bundle name="wwwroot/bundles/pos-admin-bundle.min.js"></bundle>
|
||||||
|
<bundle name="wwwroot/bundles/pos-admin-bundle.min.css"></bundle>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,7 @@
|
|||||||
<bundle name="wwwroot/bundles/crowdfund-bundle.min.css"></bundle>
|
<bundle name="wwwroot/bundles/crowdfund-bundle.min.css"></bundle>
|
||||||
@if (!string.IsNullOrEmpty(Model.EmbeddedCSS))
|
@if (!string.IsNullOrEmpty(Model.EmbeddedCSS))
|
||||||
{
|
{
|
||||||
<style>
|
@Safe.Raw($"<style>{Model.EmbeddedCSS}</style>");
|
||||||
@Safe.Raw(Model.EmbeddedCSS);
|
|
||||||
</style>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -47,6 +47,11 @@
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@if (!string.IsNullOrEmpty(Model.EmbeddedCSS))
|
||||||
|
{
|
||||||
|
@Safe.Raw($"<style>{Model.EmbeddedCSS}</style>");
|
||||||
|
}
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="h-100">
|
<body class="h-100">
|
||||||
@@ -258,8 +263,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@if (!string.IsNullOrEmpty(Model.Description))
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="overflow-hidden col-12">@Safe.Raw(Model.Description)</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="js-pos-list" class="text-center mx-auto px-4">
|
<div id="js-pos-list" class="text-center mx-auto px-4">
|
||||||
<div class="row card-deck my-3 mx-auto">
|
<div class="row card-deck my-3 mx-auto">
|
||||||
|
|
||||||
@@ -335,7 +345,12 @@
|
|||||||
<div class="container d-flex h-100">
|
<div class="container d-flex h-100">
|
||||||
<div class="justify-content-center align-self-center text-center mx-auto px-2 py-3 w-100" style="margin: auto;">
|
<div class="justify-content-center align-self-center text-center mx-auto px-2 py-3 w-100" style="margin: auto;">
|
||||||
<h1 class="mb-4">@Model.Title</h1>
|
<h1 class="mb-4">@Model.Title</h1>
|
||||||
|
@if (!string.IsNullOrEmpty(Model.Description))
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="overflow-hidden col-12">@Safe.Raw(Model.Description)</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
<div class="row card-deck my-3 mx-auto">
|
<div class="row card-deck my-3 mx-auto">
|
||||||
@for (int x = 0; x < Model.Items.Length; x++)
|
@for (int x = 0; x < Model.Items.Length; x++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -116,6 +116,24 @@
|
|||||||
"wwwroot/vendor/summernote/summernote-bs4.css"
|
"wwwroot/vendor/summernote/summernote-bs4.css"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"outputFileName": "wwwroot/bundles/pos-admin-bundle.min.js",
|
||||||
|
"inputFiles": [
|
||||||
|
"wwwroot/vendor/highlightjs/highlight.min.js",
|
||||||
|
"wwwroot/vendor/summernote/summernote-bs4.js",
|
||||||
|
"wwwroot/pos-admin/main.js",
|
||||||
|
"wwwroot/products/js/products.js",
|
||||||
|
"wwwroot/products/js/products.jquery.js"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputFileName": "wwwroot/bundles/pos-admin-bundle.min.css",
|
||||||
|
"inputFiles": [
|
||||||
|
"wwwroot/vendor/highlightjs/default.min.css",
|
||||||
|
"wwwroot/vendor/summernote/summernote-bs4.css"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"outputFileName": "wwwroot/bundles/crowdfund-bundle.min.css",
|
"outputFileName": "wwwroot/bundles/crowdfund-bundle.min.css",
|
||||||
"inputFiles": [
|
"inputFiles": [
|
||||||
|
|||||||
7
BTCPayServer/wwwroot/pos-admin/main.js
Normal file
7
BTCPayServer/wwwroot/pos-admin/main.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
hljs.initHighlightingOnLoad();
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
$(".richtext").summernote({
|
||||||
|
minHeight: 300
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user