App updates (#3437)

* Fix toggle alignment

* Crowdfund: Change defaults (disable sounds and Disqus)

* Crowdfund: Move callback notification URL into additional options

Same as with the Point Of Sale options.

* Crowdfund: Make enable toggle more prominent

* Crowdfund: Improve start and end date form group display

* Template Editor: Improve button spacing

* adjusts currency + target

* removes "other actions"

* adjusts text

* adjusts status message bottom margin

Co-authored-by: dstrukt <gfxdsign@gmail.com>
This commit is contained in:
d11n 2022-02-14 10:14:21 +01:00 committed by GitHub
parent 0dc9c183b5
commit 1d3a8bb7bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 113 additions and 82 deletions

View File

@ -36,7 +36,7 @@ namespace BTCPayServer.Models.AppViewModels
[Required]
[Display(Name = "Make Crowdfund Public")]
public bool Enabled { get; set; } = false;
public bool Enabled { get; set; }
[Required]
[Display(Name = "Enable background animations on new payments")]
@ -44,11 +44,11 @@ namespace BTCPayServer.Models.AppViewModels
[Required]
[Display(Name = "Enable sounds on new payments")]
public bool SoundsEnabled { get; set; } = true;
public bool SoundsEnabled { get; set; }
[Required]
[Display(Name = "Enable Disqus Comments")]
public bool DisqusEnabled { get; set; } = true;
public bool DisqusEnabled { get; set; }
[Display(Name = "Disqus Shortname")]
public string DisqusShortname { get; set; }
@ -60,10 +60,10 @@ namespace BTCPayServer.Models.AppViewModels
public DateTime? EndDate { get; set; }
[MaxLength(5)]
[Display(Name = "Primary currency used for targets and stats. (e.g. BTC, LTC, USD, etc.)")]
[Display(Name = "Currency")]
public string TargetCurrency { get; set; }
[Display(Name = "Set a target amount")]
[Display(Name = "Target Amount")]
[Range(0, double.PositiveInfinity)]
public decimal? TargetAmount { get; set; }
@ -105,7 +105,7 @@ namespace BTCPayServer.Models.AppViewModels
[Display(Name = "Sounds to play when a payment is made. One sound per line")]
public string Sounds { get; set; }
[Display(Name = "Colors to rotate between with animation when a payment is made. One color per line (any valid css color value).")]
[Display(Name = "Colors to rotate between with animation when a payment is made. One color per line.")]
public string AnimationColors { get; set; }
// NOTE: Improve validation if needed

View File

@ -21,8 +21,8 @@ namespace BTCPayServer.Services.Apps
public string Tagline { get; set; }
public string EmbeddedCSS { get; set; }
public string PerksTemplate { get; set; }
public bool DisqusEnabled { get; set; } = false;
public bool SoundsEnabled { get; set; } = true;
public bool DisqusEnabled { get; set; }
public bool SoundsEnabled { get; set; }
public string DisqusShortname { get; set; }
public bool AnimationsEnabled { get; set; } = true;
public int ResetEveryAmount { get; set; } = 1;

View File

@ -4,7 +4,7 @@
@if (parsedModel != null)
{
<div class="alert alert-@parsedModel.SeverityCSS @(parsedModel.AllowDismiss? "alert-dismissible":"" ) @(ViewData["Margin"] ?? "mb-5") text-break" role="alert">
<div class="alert alert-@parsedModel.SeverityCSS @(parsedModel.AllowDismiss? "alert-dismissible":"" ) @(ViewData["Margin"] ?? "mb-4") text-break" role="alert">
@if (parsedModel.AllowDismiss)
{
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">

View File

@ -18,10 +18,12 @@
<div v-if="anyImages" class="card-img-top border-bottom" v-bind:style="getImage(item)"></div>
<div class="card-body">
<h6 class="card-title" v-html="item.title"></h6>
<button type="button" class="btn btn-primary" v-on:click="editItem(index)">Edit</button>
<button type="button" class="btn btn-danger" v-on:click="removeItem(index)">
<i class="fa fa-trash"></i>
</button>
<div class="gap-3 d-flex">
<button type="button" class="btn btn-primary" v-on:click="editItem(index)">Edit</button>
<button type="button" class="btn btn-danger" v-on:click="removeItem(index)">
<i class="fa fa-trash"></i>
</button>
</div>
</div>
</div>
<div v-if="!items || items.length === 0" class="col-12 text-center">
@ -31,11 +33,11 @@
</button>
</div>
</div>
<div class="card-footer text-start p-3">
<div class="card-footer text-start p-3 gap-3 d-flex">
<button type="button" class="btn btn-primary" v-on:click="editItem(-1)" id="btn-add">
<i class="fa fa-plus fa-fw"></i> Add
</button>
<button type="button" class="btn btn-secondary ms-2" v-on:click="toggleTemplateElement()" id="ToggleRawEditor">
<button type="button" class="btn btn-secondary" v-on:click="toggleTemplateElement()" id="ToggleRawEditor">
Toggle raw editor
</button>
</div>

View File

@ -7,6 +7,9 @@
@section PageHeadContent {
<bundle name="wwwroot/bundles/crowdfund-admin-bundle.min.css" asp-append-version="true"></bundle>
<style>
.flatpickr-wrapper { flex-grow: 1; }
</style>
}
@section PageFootContent {
@ -63,58 +66,6 @@
<textarea asp-for="Description" rows="20" cols="40" class="form-control richtext"></textarea>
<span asp-validation-for="Description" class="text-danger"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-8 col-xxl-constrain">
<div class="form-group">
<label asp-for="TargetCurrency" class="form-label"></label>
<input asp-for="TargetCurrency" class="form-control" placeholder="Use store's default settings" />
<span asp-validation-for="TargetCurrency" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="TargetAmount" class="form-label"></label>
<input asp-for="TargetAmount" class="form-control" />
<span asp-validation-for="TargetAmount" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="StartDate" class="form-label"></label>
<div class="input-group">
<input type="datetime-local" asp-for="StartDate"
value="@(Model.StartDate?.ToString("u", CultureInfo.InvariantCulture))"
class="form-control flatdtpicker"
placeholder="No start date has been set" />
<button class="btn btn-secondary input-group-clear" type="button" title="Clear">
<span class="fa fa-times"></span>
</button>
</div>
<span asp-validation-for="StartDate" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="EndDate" class="form-label"></label>
<div class="input-group">
<input type="datetime-local" asp-for="EndDate"
value="@(Model.EndDate?.ToString("u", CultureInfo.InvariantCulture))"
class="form-control flatdtpicker"
placeholder="No end date has been set" />
<button class="btn btn-secondary input-group-clear input-group-text" type="button" title="Clear">
<span class="fa fa-times"></span>
</button>
</div>
<span asp-validation-for="EndDate" class="text-danger"></span>
</div>
<div class="form-group mb-4">
<label asp-for="ResetEvery" class="form-label"></label>
<div class="input-group">
<input type="number" asp-for="ResetEveryAmount" placeholder="Amount" class="form-control">
<select class="form-select" asp-for="ResetEvery">
@foreach (var opt in Model.ResetEveryValues)
{
<option value="@opt">@opt</option>
}
</select>
</div>
</div>
<div class="form-group mb-0">
<div class="d-flex align-items-center mb-3">
<input asp-for="Enabled" type="checkbox" class="btcpay-toggle me-2"/>
@ -126,6 +77,67 @@
</div>
</div>
</div>
<div class="row">
<div class="col-xl-8 col-xxl-constrain">
<h3 class="mt-5 mb-4">Goal</h3>
<div class="d-flex justify-content-between">
<div class="form-group flex-fill me-4">
<label asp-for="TargetAmount" class="form-label"></label>
<input asp-for="TargetAmount" class="form-control" />
<span asp-validation-for="TargetAmount" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="TargetCurrency" class="form-label"></label>
<input asp-for="TargetCurrency" class="form-control" placeholder="Use store's default settings" />
<span asp-validation-for="TargetCurrency" class="text-danger"></span>
</div>
</div>
<div class="row g-3">
<div class="col col-12 col-sm-6">
<div class="form-group">
<label asp-for="StartDate" class="form-label"></label>
<div class="input-group flex-nowrap">
<input type="datetime-local" asp-for="StartDate"
value="@(Model.StartDate?.ToString("u", CultureInfo.InvariantCulture))"
class="form-control flatdtpicker"
placeholder="No start date has been set" />
<button class="btn btn-secondary input-group-clear" type="button" title="Clear">
<span class="fa fa-times"></span>
</button>
</div>
<span asp-validation-for="StartDate" class="text-danger"></span>
</div>
</div>
<div class="col col-12 col-sm-6">
<div class="form-group">
<label asp-for="EndDate" class="form-label"></label>
<div class="input-group flex-nowrap">
<input type="datetime-local" asp-for="EndDate"
value="@(Model.EndDate?.ToString("u", CultureInfo.InvariantCulture))"
class="form-control flatdtpicker"
placeholder="No end date has been set" />
<button class="btn btn-secondary input-group-clear input-group-text" type="button" title="Clear">
<span class="fa fa-times"></span>
</button>
</div>
<span asp-validation-for="EndDate" class="text-danger"></span>
</div>
</div>
</div>
<div class="form-group mb-0">
<label asp-for="ResetEvery" class="form-label"></label>
<div class="input-group">
<input type="number" asp-for="ResetEveryAmount" placeholder="Amount" class="form-control">
<select class="form-select" asp-for="ResetEvery">
@foreach (var opt in Model.ResetEveryValues)
{
<option value="@opt">@opt</option>
}
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xxl-constrain">
<partial name="TemplateEditor" model="@(nameof(Model.PerksTemplate), "Perks")" />
@ -162,11 +174,6 @@
</div>
<h3 class="mt-5 mb-4">Crowdfund Behavior</h3>
<div class="form-group">
<label asp-for="NotificationUrl" class="form-label"></label>
<input asp-for="NotificationUrl" class="form-control" />
<span asp-validation-for="NotificationUrl" class="text-danger"></span>
</div>
<div class="form-check">
<input asp-for="UseAllStoreInvoices" type="checkbox" class="form-check-input" />
<label asp-for="UseAllStoreInvoices" class="form-check-label"></label>
@ -175,9 +182,11 @@
<h3 class="mt-5 mb-4">Sound</h3>
<div class="form-group mb-0">
<input asp-for="SoundsEnabled" type="checkbox" class="btcpay-toggle me-2" data-bs-toggle="collapse" data-bs-target="#SoundsEnabledSettings" aria-expanded="@Model.SoundsEnabled" aria-controls="SoundsEnabledSettings"/>
<label asp-for="SoundsEnabled" class="form-label mb-0"></label>
<span asp-validation-for="SoundsEnabled" class="text-danger"></span>
<div class="d-flex align-items-center">
<input asp-for="SoundsEnabled" type="checkbox" class="btcpay-toggle me-2" data-bs-toggle="collapse" data-bs-target="#SoundsEnabledSettings" aria-expanded="@Model.SoundsEnabled" aria-controls="SoundsEnabledSettings"/>
<label asp-for="SoundsEnabled" class="form-label mb-0"></label>
<span asp-validation-for="SoundsEnabled" class="text-danger"></span>
</div>
</div>
<div class="collapse @(Model.SoundsEnabled ? "show" : "")" id="SoundsEnabledSettings">
<div class="form-group mb-0 pt-3">
@ -189,9 +198,11 @@
<h3 class="mt-5 mb-4">Animation</h3>
<div class="form-group mb-3">
<input asp-for="AnimationsEnabled" type="checkbox" class="btcpay-toggle me-2" data-bs-toggle="collapse" data-bs-target="#AnimationsEnabledSettings" aria-expanded="@Model.AnimationsEnabled" aria-controls="AnimationsEnabledSettings"/>
<label asp-for="AnimationsEnabled" class="form-label mb-0"></label>
<span asp-validation-for="AnimationsEnabled" class="text-danger"></span>
<div class="d-flex align-items-center">
<input asp-for="AnimationsEnabled" type="checkbox" class="btcpay-toggle me-2" data-bs-toggle="collapse" data-bs-target="#AnimationsEnabledSettings" aria-expanded="@Model.AnimationsEnabled" aria-controls="AnimationsEnabledSettings"/>
<label asp-for="AnimationsEnabled" class="form-label mb-0"></label>
<span asp-validation-for="AnimationsEnabled" class="text-danger"></span>
</div>
</div>
<div class="collapse @(Model.AnimationsEnabled ? "show" : "")" id="AnimationsEnabledSettings">
<div class="form-group mb-0 pt-3">
@ -203,9 +214,11 @@
<h3 class="mt-5 mb-4">Discussion</h3>
<div class="form-group mb-3">
<input asp-for="DisqusEnabled" type="checkbox" class="btcpay-toggle me-2" data-bs-toggle="collapse" data-bs-target="#DisqusEnabledSettings" aria-expanded="@Model.DisqusEnabled" aria-controls="DisqusEnabledSettings"/>
<label asp-for="DisqusEnabled" class="form-label mb-0"></label>
<span asp-validation-for="DisqusEnabled" class="text-danger"></span>
<div class="d-flex align-items-center">
<input asp-for="DisqusEnabled" type="checkbox" class="btcpay-toggle me-2" data-bs-toggle="collapse" data-bs-target="#DisqusEnabledSettings" aria-expanded="@Model.DisqusEnabled" aria-controls="DisqusEnabledSettings"/>
<label asp-for="DisqusEnabled" class="form-label mb-0"></label>
<span asp-validation-for="DisqusEnabled" class="text-danger"></span>
</div>
</div>
<div class="collapse @(Model.DisqusEnabled ? "show" : "")" id="DisqusEnabledSettings">
<div class="form-group mb-0 pt-3">
@ -248,13 +261,29 @@
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="additional-notification-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#additional-notification" aria-expanded="false" aria-controls="additional-notification">
Notification URL Callbacks
<vc:icon symbol="caret-down" />
</button>
</h2>
<div id="additional-notification" class="accordion-collapse collapse" aria-labelledby="additional-notification-header">
<div class="accordion-body">
<div class="form-group">
<label asp-for="NotificationUrl" class="form-label"></label>
<input asp-for="NotificationUrl" class="form-control" />
<span asp-validation-for="NotificationUrl" class="text-danger"></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<h3 class="mt-5 mb-4">Other Actions</h3>
<div id="danger-zone">
<a id="DeleteApp" class="btn btn-outline-danger" asp-action="DeleteApp" asp-route-appId="@Model.AppId" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-description="The app <strong>@Model.AppName</strong> and its settings will be permanently deleted." data-confirm-input="DELETE">Delete this app</a>
</div>