Compare commits

...

1 Commits

Author SHA1 Message Date
e659164d1b change app 2023-06-07 18:11:32 +02:00
3 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,5 @@
#nullable enable
using System.Linq;
using System.Threading.Tasks;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
@ -11,6 +12,7 @@ using BTCPayServer.Services.Stores;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using StoreData = BTCPayServer.Data.StoreData;
namespace BTCPayServer.Plugins.PayButton.Controllers
@ -80,7 +82,7 @@ namespace BTCPayServer.Plugins.PayButton.Controllers
Min = 1,
Max = 20,
Step = "1",
Apps = apps
Apps = apps.Select(viewModel => new SelectListItem($"{viewModel.AppName} {viewModel.AppType}", viewModel.Id)).Prepend(new SelectListItem("Use default pay button endpoint", "")).ToArray(),
};
return View("PayButton/PayButton", model);
}

View File

@ -5,6 +5,7 @@ using BTCPayServer.Models.AppViewModels;
using BTCPayServer.Models.StoreViewModels;
using BTCPayServer.Validation;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace BTCPayServer.Plugins.PayButton.Models
{
@ -48,7 +49,7 @@ namespace BTCPayServer.Plugins.PayButton.Models
public string PayButtonText { get; set; }
public bool UseModal { get; set; }
public bool JsonResponse { get; set; }
public ListAppsViewModel.ListAppViewModel[] Apps { get; set; }
public SelectListItem[] Apps { get; set; }
public string AppIdEndpoint { get; set; } = "";
public string AppChoiceKey { get; set; } = "";
}

View File

@ -371,9 +371,7 @@
<p>Link this Pay Button to an app instead. Some features are disabled due to the different endpoint capabilities. You can set which perk/item this button should be targeting.</p>
<div class="form-group">
<label class="form-label" for="app-as-endpoint">Use App As Endpoint</label>
<select v-model="srvModel.appIdEndpoint" v-on:change="inputChanges" class="form-select" id="app-as-endpoint">
<option value="">Use default pay button endpoint</option>
<option v-for="app in srvModel.apps" v-bind:value="app.id" >{{app.appName}} ({{app.appType}})</option>
<select asp-items="Model.Apps" v-model="srvModel.appIdEndpoint" v-on:change="inputChanges" class="form-select" id="app-as-endpoint">
</select>
<small class="text-danger">{{ errors.first('appIdEndpoint') }}</small>
</div>