mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
Fix: Revert to default block explorer button wasn't working (#5340)
* Fix: Revert to default block explorer button wasn't working * Update BTCPayServer/Views/UIServer/Policies.cshtml Co-authored-by: Andrew Camilleri <evilkukka@gmail.com> * Update BTCPayServer/Views/UIServer/Policies.cshtml Co-authored-by: Andrew Camilleri <evilkukka@gmail.com> * Improve UI --------- Co-authored-by: Andrew Camilleri <evilkukka@gmail.com> Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
This commit is contained in:
parent
7da82826fb
commit
8cdfaba20c
1 changed files with 12 additions and 14 deletions
|
@ -186,7 +186,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
<h4>Block Explorers</h4>
|
<h4>Block Explorers</h4>
|
||||||
|
|
||||||
@for (var i = 0; i < networks.Count(); i++)
|
@for (var i = 0; i < networks.Count(); i++)
|
||||||
{
|
{
|
||||||
var network = networks.ElementAt(i);
|
var network = networks.ElementAt(i);
|
||||||
|
@ -194,17 +193,17 @@
|
||||||
var linkValue = existingOverride?.Link ?? network.BlockExplorerLinkDefault;
|
var linkValue = existingOverride?.Link ?? network.BlockExplorerLinkDefault;
|
||||||
if (Model.BlockExplorerLinks.Count < i + 1)
|
if (Model.BlockExplorerLinks.Count < i + 1)
|
||||||
{
|
{
|
||||||
Model.BlockExplorerLinks.Add(new PoliciesSettings.BlockExplorerOverrideItem() {CryptoCode = network.CryptoCode, Link = network.BlockExplorerLinkDefault});
|
Model.BlockExplorerLinks.Add(new PoliciesSettings.BlockExplorerOverrideItem { CryptoCode = network.CryptoCode, Link = network.BlockExplorerLinkDefault });
|
||||||
}
|
}
|
||||||
<div class="form-group">
|
<div class="form-group" data-default="@network.BlockExplorerLinkDefault">
|
||||||
|
<div class="d-flex flex-wrap align-items-center justify-content-between gap-3">
|
||||||
<label asp-for="BlockExplorerLinks[i].Link" class="form-label">@network.DisplayName (@network.CryptoCode)</label>
|
<label asp-for="BlockExplorerLinks[i].Link" class="form-label">@network.DisplayName (@network.CryptoCode)</label>
|
||||||
<input type="hidden" asp-for="BlockExplorerLinks[i].CryptoCode" value="@network.CryptoCode"/>
|
<button type="button" class="btn btn-link p-0 only-for-js revert-default" title="Revert to default">
|
||||||
<div class="input-group">
|
Set to default
|
||||||
<input type="text" class="form-control" asp-for="BlockExplorerLinks[i].Link" value="@linkValue" rel="noreferrer noopener" data-default-link="@network.BlockExplorerLinkDefault"/>
|
|
||||||
<button type="button" class="btn btn-secondary only-for-js" title="Revert to default">
|
|
||||||
<span class="fa fa-refresh"></span>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<input type="hidden" asp-for="BlockExplorerLinks[i].CryptoCode" value="@network.CryptoCode" />
|
||||||
|
<input type="text" class="form-control block-explorer-link" asp-for="BlockExplorerLinks[i].Link" value="@linkValue" rel="noreferrer noopener" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</form>
|
</form>
|
||||||
|
@ -213,11 +212,10 @@
|
||||||
|
|
||||||
@section PageFootContent {
|
@section PageFootContent {
|
||||||
<script>
|
<script>
|
||||||
for (let element of document.getElementsByClassName("revert-default")) {
|
delegate('click', '.revert-default', e => {
|
||||||
element.addEventListener("click", function (){
|
const $row = e.target.closest('[data-default]');
|
||||||
element.parentElement.previousElementSibling.value = element.parentElement.previousElementSibling.getAttribute("data-default-link")
|
$row.querySelector('input.block-explorer-link').value = $row.dataset.default;
|
||||||
});
|
})
|
||||||
}
|
|
||||||
for (let element of document.getElementsByClassName("collapse-on-js")){
|
for (let element of document.getElementsByClassName("collapse-on-js")){
|
||||||
if (element.classList.contains("show")){
|
if (element.classList.contains("show")){
|
||||||
element.classList.remove("show");
|
element.classList.remove("show");
|
||||||
|
|
Loading…
Add table
Reference in a new issue