pr changes

This commit is contained in:
Kukks
2019-01-07 14:39:04 +01:00
parent 3e48a54ab5
commit d1d03c98ba
6 changed files with 42 additions and 52 deletions

View File

@@ -46,6 +46,10 @@ namespace BTCPayServer.Models.AppViewModels
public DateTime? LastResetDate { get; set; }
public DateTime? NextResetDate { get; set; }
}
public bool Started => !StartDate.HasValue || DateTime.Now.ToUniversalTime() > StartDate;
public bool Ended => !EndDate.HasValue || DateTime.Now.ToUniversalTime() > EndDate;
}

View File

@@ -177,21 +177,9 @@
</section>
@section Scripts {
<link rel="stylesheet" href="~/vendor/highlightjs/default.min.css">
<script src="~/vendor/highlightjs/highlight.min.js"></script>
<script src="~/vendor/richtext/jquery.richtext.min.js"></script>
<link rel="stylesheet" href="~/vendor/richtext/richtext.min.css">
<script src="~/vendor/flatpickr/flatpickr.js"></script>
<link rel="stylesheet" href="~/vendor/flatpickr/flatpickr.min.css">
<script>
hljs.initHighlightingOnLoad();
$(document).ready(function() {
$(".richtext").richText();
$(".datetime").flatpickr({
enableTime: true
});
});
</script>
<bundle name="wwwroot/bundles/crowdfund-admin-bundle.min.js"></bundle>
<bundle name="wwwroot/bundles/crowdfund-admin-bundle.min.css"></bundle>
<script id="template-product-item" type="text/template">
<div class="col-sm-4 col-md-3 mb-3">
@@ -240,8 +228,5 @@
</div>
</div>
</script>
<script src="~/products/js/products.js"></script>
<script src="~/products/js/products.jquery.js"></script>
}

View File

@@ -1,18 +1,5 @@
@model BTCPayServer.Models.AppViewModels.ContributeToCrowdfund
@functions{
public bool Started()
{
return !Model.ViewCrowdfundViewModel.StartDate.HasValue || DateTime.Now.ToUniversalTime() > Model.ViewCrowdfundViewModel.StartDate;
}
public bool Ended()
{
return !Model.ViewCrowdfundViewModel.EndDate.HasValue || DateTime.Now.ToUniversalTime() > Model.ViewCrowdfundViewModel.EndDate;
}
}
<form method="post">
@foreach (var item in Model.ViewCrowdfundViewModel.Perks)
{
@@ -26,7 +13,7 @@
<div class="card-title d-flex justify-content-between" >
<label class="h5">
@if (Started() && !Ended() && (item.Price.Value > 0 || item.Custom))
@if (Model.ViewCrowdfundViewModel.Started && !Model.ViewCrowdfundViewModel.Ended && (item.Price.Value > 0 || item.Custom))
{
<input type="radio" asp-for="ChoiceKey" value="@item.Id"/>
@@ -53,7 +40,7 @@
</div>
</div>
}
@if (Started() && !Ended())
@if (Model.ViewCrowdfundViewModel.Started && !Model.ViewCrowdfundViewModel.Ended)
{
<div class="form-group">
<label asp-for="Email"></label>

View File

@@ -2,19 +2,6 @@
@using Microsoft.CodeAnalysis.CSharp.Syntax
@model BTCPayServer.Models.AppViewModels.ViewCrowdfundViewModel
@functions{
public bool Started()
{
return !Model.StartDate.HasValue || DateTime.Now.ToUniversalTime() > Model.StartDate;
}
public bool Ended()
{
return !Model.EndDate.HasValue || DateTime.Now.ToUniversalTime() > Model.EndDate;
}
}
<div class="container p-0">
<div class="row h-100 w-100 py-sm-0 py-md-4 mx-0">
@@ -26,19 +13,19 @@
<div class="d-flex justify-content-between px-2">
<h1>
@Model.Title
@if (!Started() && Model.StartDate.HasValue)
@if (!Model.Started && Model.StartDate.HasValue)
{
<span class="h6 text-muted" >
Starts @Model.StartDate.Value.Subtract(DateTime.Now.ToUniversalTime())
</span>
}
else if (Started() && !Ended() && Model.EndDate.HasValue)
else if (Model.Started && !Model.Ended && Model.EndDate.HasValue)
{
<span class="h6 text-muted" >
Ends @Model.EndDate.Value.Subtract(DateTime.Now.ToUniversalTime())
</span>
}
else if (Started() && !Ended() && !Model.EndDate.HasValue)
else if (Model.Started && !Model.Ended && !Model.EndDate.HasValue)
{
<span class="h6 text-muted" :title="startDate" title="No set end date">
Currently Active!
@@ -100,7 +87,7 @@
</h5>
<h5 class="text-muted">Contributors</h5>
</div>
@if (Started() && !Ended())
@if (Model.Started && !Model.Ended)
{
<div class="col-sm" v-if="endDiff">
<h5>
@@ -109,7 +96,7 @@
</h5>
<h5 class="text-muted">Ends</h5>
</div>
} else if (!Started())
} else if (!Model.Started)
{
<div class="col-sm" v-if="startDiff">
<h5>
@@ -117,7 +104,7 @@
</h5>
<h5 class="text-muted">Starts</h5>
</div>
}else if (Ended())
}else if (Model.Ended)
{
<div class="col-sm" v-if="ended" id="inactive-campaign">

View File

@@ -97,6 +97,26 @@
"enabled": false
}
},
{
"outputFileName": "wwwroot/bundles/crowdfund-admin-bundle.min.js",
"inputFiles": [
"wwwroot/vendor/highlightjs/highlight.min.js",
"wwwroot/vendor/richtext/jquery.richtext.min.js",
"wwwroot/vendor/flatpickr/flatpickr.js",
"wwwroot/crowdfund-admin/**/*.js",
"wwwroot/products/js/products.js",
"wwwroot/products/js/products.jquery.js"
]
},
{
"outputFileName": "wwwroot/bundles/crowdfund-admin-bundle.min.css",
"inputFiles": [
"wwwroot/vendor/highlightjs/default.min.css",
"wwwroot/vendor/richtext/richtext.min.css",
"wwwroot/vendor/flatpickr/flatpickr.min.css",
"wwwroot/crowdfund-admin/**/*.js"
]
},
{
"outputFileName": "wwwroot/bundles/crowdfund-bundle.min.css",
"inputFiles": [

View File

@@ -0,0 +1,7 @@
hljs.initHighlightingOnLoad();
$(document).ready(function() {
$(".richtext").richText();
$(".datetime").flatpickr({
enableTime: true
});
});