Improve store/selectlist labeling (#3014)

This commit is contained in:
Samuel B. Atwood 2021-10-25 00:15:08 -04:00 committed by GitHub
parent 5318684e5c
commit 0558631982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 8 deletions

View File

@ -83,8 +83,8 @@ namespace BTCPayServer.Controllers.GreenField
var store = new Data.StoreData();
PaymentMethodId.TryParse(request.DefaultPaymentMethod, out var defaultPaymnetMethodId);
ToModel(request, store, defaultPaymnetMethodId);
PaymentMethodId.TryParse(request.DefaultPaymentMethod, out var defaultPaymentMethodId);
ToModel(request, store, defaultPaymentMethodId);
await _storeRepository.CreateStore(_userManager.GetUserId(User), store);
return Ok(FromModel(store));
}
@ -104,9 +104,9 @@ namespace BTCPayServer.Controllers.GreenField
return validationResult;
}
PaymentMethodId.TryParse(request.DefaultPaymentMethod, out var defaultPaymnetMethodId);
PaymentMethodId.TryParse(request.DefaultPaymentMethod, out var defaultPaymentMethodId);
ToModel(request, store, defaultPaymnetMethodId);
ToModel(request, store, defaultPaymentMethodId);
await _storeRepository.UpdateStore(store);
return Ok(FromModel(store));
}
@ -193,7 +193,7 @@ namespace BTCPayServer.Controllers.GreenField
}
if (!string.IsNullOrEmpty(request.DefaultPaymentMethod) &&
!PaymentMethodId.TryParse(request.DefaultPaymentMethod, out var defaultPaymnetMethodId))
!PaymentMethodId.TryParse(request.DefaultPaymentMethod, out var defaultPaymentMethodId))
{
ModelState.AddModelError(nameof(request.Name), "DefaultPaymentMethod is invalid");
}

View File

@ -63,6 +63,7 @@ namespace BTCPayServer.Models.InvoicingModels
get; set;
}
[DisplayName("Store")]
public SelectList Stores
{
get; set;

View File

@ -61,7 +61,9 @@ namespace BTCPayServer.Models.PaymentRequestViewModels
[Required] public string Title { get; set; }
public string Description { get; set; }
[Display(Name = "Store")]
public SelectList Stores { get; set; }
[EmailAddress]
public string Email { get; set; }

View File

@ -24,6 +24,7 @@ namespace BTCPayServer.Models.StoreViewModels
get; set;
}
[Display(Name = "Store")]
public SelectList Stores
{
get; set;

View File

@ -70,7 +70,7 @@
<span asp-validation-for="NotificationUrl" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="StoreId" class="form-label"></label>
<label asp-for="Stores" class="form-label"></label>
<select asp-for="StoreId" asp-items="Model.Stores" class="form-select"></select>
<span asp-validation-for="StoreId" class="text-danger"></span>
</div>

View File

@ -25,7 +25,7 @@
<input type="hidden" name="Id" value="@Model.Id" />
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="StoreId" class="form-label"></label>
<label asp-for="Stores" class="form-label"></label>
@if (string.IsNullOrEmpty(Model.Id))
{
<select asp-for="StoreId" asp-items="Model.Stores" class="form-select"></select>

View File

@ -32,7 +32,7 @@
@if (ViewBag.ShowStores)
{
<div class="form-group">
<label asp-for="StoreId" class="form-label"></label>
<label asp-for="Stores" class="form-label"></label>
<select asp-for="StoreId" asp-items="Model.Stores" class="form-select"></select>
<span asp-validation-for="StoreId" class="text-danger"></span>
</div>