Make ViewModel bool parameters nullable
This commit is contained in:
@@ -57,10 +57,10 @@ namespace LeafWeb.WebCms.Models
|
||||
public string phips2 { get; set; }
|
||||
|
||||
[Display(Name = "Show Only Successfully Completed")]
|
||||
public bool compl { get; set; }
|
||||
public bool? compl { get; set; }
|
||||
|
||||
[Display(Name = "Only my data")]
|
||||
public bool usr { get; set; }
|
||||
public bool? usr { get; set; }
|
||||
|
||||
public bool HasExtendedParameters =>
|
||||
!(
|
||||
@@ -74,12 +74,12 @@ namespace LeafWeb.WebCms.Models
|
||||
&& string.IsNullOrEmpty(pari)
|
||||
&& string.IsNullOrEmpty(tleaf)
|
||||
&& string.IsNullOrEmpty(phips2)
|
||||
&& !compl
|
||||
&& !(compl.HasValue && compl.Value)
|
||||
);
|
||||
|
||||
public bool HasParameters =>
|
||||
HasExtendedParameters
|
||||
|| !string.IsNullOrEmpty(q)
|
||||
|| usr;
|
||||
|| usr.HasValue && usr.Value;
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ namespace LeafWeb.WebCms.Utility
|
||||
select li;
|
||||
}
|
||||
|
||||
if (query.compl)
|
||||
if (query.compl.HasValue && query.compl.Value)
|
||||
{
|
||||
resultItems =
|
||||
from li in resultItems
|
||||
@@ -154,7 +154,7 @@ namespace LeafWeb.WebCms.Utility
|
||||
select li;
|
||||
}
|
||||
|
||||
if (query.usr && !string.IsNullOrEmpty(currentUserEmail))
|
||||
if (query.usr.HasValue && query.usr.Value && !string.IsNullOrEmpty(currentUserEmail))
|
||||
{
|
||||
resultItems =
|
||||
from li in resultItems
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
@using System.Web.Mvc.Html
|
||||
@using ClientDependency.Core.Mvc
|
||||
@using LeafWeb.WebCms.Utility
|
||||
@model LeafDataQuery
|
||||
@{
|
||||
Html.RequiresJs("~/scripts/jquery.validate.min.js", 2);
|
||||
Html.RequiresJs("~/scripts/jquery.validate.unobtrusive.min.js", 2);
|
||||
Html.RequiresJs("~/scripts/jquery.validate.custom.js", 2);
|
||||
Html.RequiresJs("~/scripts/jquery.validate.unobtrusive.bootstrap.js", 2);
|
||||
Html.RequiresJs("~/scripts/LeafDataQuery.js", 3);
|
||||
|
||||
var actionName = string.Empty;
|
||||
var controllerName = string.Empty;
|
||||
@@ -25,7 +25,7 @@
|
||||
htmlFormAction = (string)ViewData["htmlFormAction"];
|
||||
}
|
||||
}
|
||||
@using (Html.BeginUmbracoForm(actionName, controllerName, null, new { action = htmlFormAction }))
|
||||
@using (Html.BeginUmbracoForm(actionName, controllerName, null, new { action = htmlFormAction, id = "leafdataquery" }))
|
||||
{
|
||||
<div class="row justify-content-end">
|
||||
<div class="col text-right pt-2">
|
||||
|
||||
@@ -1130,6 +1130,7 @@
|
||||
<Compile Include="Models\QueueViewModel.cs" />
|
||||
<Compile Include="Models\SelectListViewModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Content Include="scripts\LeafDataQuery.js" />
|
||||
<Compile Include="Services\UrlService.cs" />
|
||||
<Compile Include="Services\EmailNotificationService.cs" />
|
||||
<Compile Include="Services\LeafGasCharter.cs" />
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
$(function() {
|
||||
$("form#leafdataquery .latr input.form-control")
|
||||
.rules("add",
|
||||
{
|
||||
//required: true
|
||||
required: function ()
|
||||
{
|
||||
return !!$(".lat input.form-control").val();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -29,6 +29,7 @@
|
||||
});
|
||||
|
||||
$("form:not(.confirm)").submit(function () {
|
||||
if (!$(this).valid()) return;
|
||||
var btn = $(this).find(":submit");
|
||||
btn.prop("disabled", true);
|
||||
btn.html(
|
||||
|
||||
Reference in New Issue
Block a user