Skip to content

Commit

Permalink
Razor Views - change asp-validation-summary=ModelOnly to asp-validati…
Browse files Browse the repository at this point in the history
…on-summary="All"
  • Loading branch information
support committed Jan 15, 2024
1 parent 74c71c3 commit 5fc4ba5
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@Model.Result
</section>
}
<div asp-validation-summary="ModelOnly" class="message-error"></div>
<div asp-validation-summary="All" class="message-error"></div>

<fieldset>
<div class="form-fields">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@Loc["Account.Navigation"]
</div>
</a>
<div asp-validation-summary="ModelOnly" class="message-error"></div>
<div asp-validation-summary="All" class="message-error"></div>
<div class="alert alert-danger" role="alert">
@Loc["Account.DeleteAccount.DangerAlert"]
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/Theme.Modern/Views/Modern/Account/Info.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
</a>
<validation-observer v-slot="{ handleSubmit }">
<form asp-route="CustomerInfo" method="post" ref="form" v-on:submit.prevent="handleSubmit(formSubmit)">
<div asp-validation-summary="ModelOnly" class="message-error"></div>
<div asp-validation-summary="All" class="message-error"></div>
<div class="card mb-3">
<h3 class="card-header">@Loc["Account.YourPersonalDetails"]</h3>
<div class="card-body">
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/Theme.Modern/Views/Modern/Account/Login.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</h3>
</div>
<div class="card-body">
<div asp-validation-summary="ModelOnly" class="message-error w-100 alert alert-danger pb-0 text-center">@Loc["Account.Login.Unsuccessful"]</div>
<div asp-validation-summary="All" class="message-error w-100 text-center"></div>
<div class="col-12 form-group mb-0">
@if (Model.UsernamesEnabled)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<validation-observer v-slot="{ handleSubmit }">
<form asp-route="PasswordRecovery" method="post" ref="form" v-on:submit.prevent="handleSubmit(formSubmit)">
<input type="hidden" asp-for="DisplayCaptcha" />
<div asp-validation-summary="ModelOnly" class="message-error"></div>
<div asp-validation-summary="All" class="message-error"></div>
<div class="form-group">
<validation-provider tag="div" rules="required|email" name="Email" v-slot="{ errors, classes }">
<label asp-for="Email" class="col-form-label">@Loc["Account.PasswordRecovery.Email"]:</label>
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/Theme.Modern/Views/Modern/Blog/BlogPost.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<div class="fieldset new-comment generalMarginSupporter d-flex flex-column w-100" id="comments">
<h4 class="generalTitle generalMarginSupporter">@Loc["Blog.Comments.LeaveYourComment"]</h4>
<div class="notifications">
<div asp-validation-summary="ModelOnly" class="message-error"></div>
<div asp-validation-summary="All" class="message-error"></div>
@{
var result = TempData["Grand.blog.addcomment.result"] as string;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/Theme.Modern/Views/Modern/News/NewsItem.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<fieldset class="new-comment py-3 px-0" id="comments">
<h5><strong>@Loc["News.Comments.LeaveYourComment"]</strong></h5>
<div class="notifications">
<div asp-validation-summary="ModelOnly" class="message-error"></div>
<div asp-validation-summary="All" class="message-error"></div>
@{
var result = TempData["Grand.news.addcomment.result"] as string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<form id="addReviewForm" asp-route="ProductReviews" asp-route-ProductId="@Model.ProductId" method="post" ref="modalForm"
v-on:submit.prevent="handleSubmit(productreviews.submitProductReview)" :data-title="'@Loc["Reviews.ProductReviewsFor"] ' + productreviews.Model.ProductName">
<input type="hidden" asp-for="@Model.ProductId" />
<div asp-validation-summary="ModelOnly" class="message-error alert alert-danger my-3"></div>
<div asp-validation-summary="All" class="message-error my-3"></div>
<fieldset>
<div class="form-fields">
<div class="form-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
else
{
<form asp-route="ProductEmailAFriend" method="post" v-on:submit.prevent="validateBeforeSubmit($event)">
<div asp-validation-summary="ModelOnly" class="message-error"></div>
<div asp-validation-summary="All" class="message-error"></div>
<div class="form-fields">
<div class="form-group">
<label asp-for="FriendEmail" class="col-form-label">@Loc["Products.EmailAFriend.FriendEmail"]:</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<h5 class="card-header"><strong>@Loc["Admin.Login.Title"]</strong></h5>
<div class="card-body">
<div class="row">
<div asp-validation-summary="ModelOnly" class="message-error w-100 text-center">@Loc["Admin.Login.Unsuccessful"]</div>
<div asp-validation-summary="All" class="message-error text-center"></div>
<div class="col-12 form-group mb-0">
@if (Model.UsernamesEnabled)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<h5 class="card-header"><strong>@Loc["Admin.Login.TwoFactorAuth.EnterCode"]</strong></h5>
<div class="card-body">
<div class="row">
<div asp-validation-summary="ModelOnly" class="col-12 justify-content-around text-danger"></div>
<div asp-validation-summary="All" class="col-12 justify-content-around text-danger"></div>
<div class="col-12 form-group mb-0 d-flex justify-content-around">
<div class="form-group row">
<div class="col-lg-3 col-12 d-flex align-items-start justify-content-sm-start">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<h5 class="card-header"><strong>@Loc["Vendor.Login.Title"]</strong></h5>
<div class="card-body">
<div class="row">
<div asp-validation-summary="ModelOnly" class="message-error w-100 text-center">@Loc["Vendor.Login.Unsuccessful"]</div>
<div asp-validation-summary="All" class="message-error text-center"></div>
<div class="col-12 form-group mb-0">
@if (Model.UsernamesEnabled)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<h5 class="card-header"><strong>@Loc["Vendor.Login.TwoFactor.EnterCode"]</strong></h5>
<div class="card-body">
<div class="row">
<div asp-validation-summary="ModelOnly" class="col-12 justify-content-around text-danger"></div>
<div asp-validation-summary="All" class="col-12 justify-content-around text-danger"></div>
<div class="col-12 form-group mb-0 d-flex justify-content-around">
<div class="form-group row">
<div class="col-lg-3 col-12 d-flex align-items-start justify-content-sm-start">
Expand Down
22 changes: 22 additions & 0 deletions src/Web/Grand.Web/Models/Customer/CustomerInfoModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Grand.Domain.Customers;
using Grand.Infrastructure.ModelBinding;
using Grand.Infrastructure.Models;
using Grand.SharedKernel;
using Grand.Web.Common.Binders;
using Grand.Web.Common.Models;
using Grand.Web.Models.Newsletter;
Expand All @@ -22,6 +23,7 @@ public CustomerInfoModel()
NewsletterCategories = new List<NewsletterSimpleCategory>();
}

[MaxLength(FieldSizeLimits.EmailMaxLength)]
[DataType(DataType.EmailAddress)]
[GrandResourceDisplayName("Account.Fields.Email")]
public string Email { get; set; }
Expand All @@ -30,6 +32,8 @@ public CustomerInfoModel()
public bool CheckUsernameAvailabilityEnabled { get; set; }
public bool AllowUsersToChangeUsernames { get; set; }
public bool UsernamesEnabled { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.Username")]
public string Username { get; set; }

Expand All @@ -38,8 +42,11 @@ public CustomerInfoModel()
[GrandResourceDisplayName("Account.Fields.Gender")]
public string Gender { get; set; }

[StringLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.FirstName")]
public string FirstName { get; set; }

[StringLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.LastName")]
public string LastName { get; set; }
public bool FirstLastNameRequired { get; set; }
Expand Down Expand Up @@ -67,31 +74,42 @@ public CustomerInfoModel()

public bool CompanyEnabled { get; set; }
public bool CompanyRequired { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.Company")]
public string Company { get; set; }

public bool StreetAddressEnabled { get; set; }
public bool StreetAddressRequired { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.StreetAddress")]
public string StreetAddress { get; set; }

public bool StreetAddress2Enabled { get; set; }
public bool StreetAddress2Required { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.StreetAddress2")]
public string StreetAddress2 { get; set; }

public bool ZipPostalCodeEnabled { get; set; }
public bool ZipPostalCodeRequired { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.ZipPostalCode")]
public string ZipPostalCode { get; set; }

public bool CityEnabled { get; set; }
public bool CityRequired { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.City")]
public string City { get; set; }

public bool CountryEnabled { get; set; }
public bool CountryRequired { get; set; }

[GrandResourceDisplayName("Account.Fields.Country")]
public string CountryId { get; set; }
public IList<SelectListItem> AvailableCountries { get; set; }
Expand All @@ -104,13 +122,16 @@ public CustomerInfoModel()

public bool PhoneEnabled { get; set; }
public bool PhoneRequired { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[DataType(DataType.PhoneNumber)]
[GrandResourceDisplayName("Account.Fields.Phone")]
public string Phone { get; set; }

public bool FaxEnabled { get; set; }
public bool FaxRequired { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.Fax")]
public string Fax { get; set; }

Expand All @@ -123,6 +144,7 @@ public CustomerInfoModel()
public bool Is2faEnabled { get; set; }

//EU VAT
[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.VatNumber")]
public string VatNumber { get; set; }
public string VatNumberStatusNote { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions src/Web/Grand.Web/Models/Customer/LoginModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Grand.Infrastructure.ModelBinding;
using Grand.Infrastructure.Models;
using Grand.SharedKernel;
using System.ComponentModel.DataAnnotations;

namespace Grand.Web.Models.Customer
Expand All @@ -12,11 +13,13 @@ public LoginModel()
}
public bool CheckoutAsGuest { get; set; }

[MaxLength(FieldSizeLimits.EmailMaxLength)]
[DataType(DataType.EmailAddress)]
[GrandResourceDisplayName("Account.Login.Fields.Email")]
public string Email { get; set; }

public bool UsernamesEnabled { get; set; }
[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Login.Fields.UserName")]
public string Username { get; set; }

Expand Down
20 changes: 20 additions & 0 deletions src/Web/Grand.Web/Models/Customer/RegisterModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Grand.Infrastructure.ModelBinding;
using Grand.Infrastructure.Models;
using Grand.SharedKernel;
using Grand.Web.Common.Binders;
using Grand.Web.Common.Models;
using Grand.Web.Models.Newsletter;
Expand All @@ -20,11 +21,14 @@ public RegisterModel()
NewsletterCategories = new List<NewsletterSimpleCategory>();
Captcha = new CaptchaModel();
}
[MaxLength(FieldSizeLimits.EmailMaxLength)]
[DataType(DataType.EmailAddress)]
[GrandResourceDisplayName("Account.Fields.Email")]
public string Email { get; set; }

public bool UsernamesEnabled { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.Username")]
public string Username { get; set; }

Expand All @@ -43,9 +47,11 @@ public RegisterModel()
[GrandResourceDisplayName("Account.Fields.Gender")]
public string Gender { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.FirstName")]
public string FirstName { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.LastName")]
public string LastName { get; set; }

Expand Down Expand Up @@ -75,31 +81,42 @@ public RegisterModel()

public bool CompanyEnabled { get; set; }
public bool CompanyRequired { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.Company")]
public string Company { get; set; }

public bool StreetAddressEnabled { get; set; }
public bool StreetAddressRequired { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.StreetAddress")]
public string StreetAddress { get; set; }

public bool StreetAddress2Enabled { get; set; }
public bool StreetAddress2Required { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.StreetAddress2")]
public string StreetAddress2 { get; set; }

public bool ZipPostalCodeEnabled { get; set; }
public bool ZipPostalCodeRequired { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.ZipPostalCode")]
public string ZipPostalCode { get; set; }

public bool CityEnabled { get; set; }
public bool CityRequired { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.City")]
public string City { get; set; }

public bool CountryEnabled { get; set; }
public bool CountryRequired { get; set; }

[GrandResourceDisplayName("Account.Fields.Country")]
public string CountryId { get; set; }
public IList<SelectListItem> AvailableCountries { get; set; }
Expand All @@ -112,13 +129,15 @@ public RegisterModel()

public bool PhoneEnabled { get; set; }
public bool PhoneRequired { get; set; }
[MaxLength(FieldSizeLimits.NameMaxLength)]
[DataType(DataType.PhoneNumber)]
[GrandResourceDisplayName("Account.Fields.Phone")]
public string Phone { get; set; }

public bool FaxEnabled { get; set; }
public bool FaxRequired { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.Fax")]
public string Fax { get; set; }

Expand All @@ -129,6 +148,7 @@ public RegisterModel()
public bool AcceptPrivacyPolicyEnabled { get; set; }

//EU VAT
[MaxLength(FieldSizeLimits.NameMaxLength)]
[GrandResourceDisplayName("Account.Fields.VatNumber")]
public string VatNumber { get; set; }
public bool DisplayVatNumber { get; set; }
Expand Down
6 changes: 6 additions & 0 deletions src/Web/Grand.Web/Models/Customer/SubAccountCreateModel.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
using Grand.Infrastructure.Models;
using Grand.SharedKernel;
using System.ComponentModel.DataAnnotations;

namespace Grand.Web.Models.Customer
{
public class SubAccountCreateModel : BaseEntityModel
{
[MaxLength(FieldSizeLimits.EmailMaxLength)]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
public string FirstName { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
public string LastName { get; set; }
public bool Active { get; set; }
[DataType(DataType.Password)]
Expand Down
6 changes: 6 additions & 0 deletions src/Web/Grand.Web/Models/Customer/SubAccountEditModel.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
using Grand.Infrastructure.Models;
using Grand.SharedKernel;
using System.ComponentModel.DataAnnotations;

namespace Grand.Web.Models.Customer
{
public class SubAccountEditModel : BaseEntityModel
{
[MaxLength(FieldSizeLimits.EmailMaxLength)]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
public string FirstName { get; set; }

[MaxLength(FieldSizeLimits.NameMaxLength)]
public string LastName { get; set; }
public bool Active { get; set; }

Expand Down

0 comments on commit 5fc4ba5

Please sign in to comment.