Skip to content

Commit 303203d

Browse files
committed
#7515 Next minor changes
1 parent 21d2f71 commit 303203d

File tree

7 files changed

+42
-41
lines changed

7 files changed

+42
-41
lines changed

src/Libraries/Nop.Services/Catalog/IProductAttributeService.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ public partial interface IProductAttributeService
2727
/// <summary>
2828
/// Gets all product attributes
2929
/// </summary>
30+
/// <param name="name">Filter by name</param>
3031
/// <param name="pageIndex">Page index</param>
3132
/// <param name="pageSize">Page size</param>
32-
/// <param name="name">Filter by name</param>
3333
/// <returns>
3434
/// A task that represents the asynchronous operation
3535
/// The task result contains the product attributes
3636
/// </returns>
37-
Task<IPagedList<ProductAttribute>> GetAllProductAttributesAsync(int pageIndex = 0, int pageSize = int.MaxValue, string name = "");
37+
Task<IPagedList<ProductAttribute>> GetAllProductAttributesAsync(string name = null, int pageIndex = 0, int pageSize = int.MaxValue);
3838

3939
/// <summary>
4040
/// Gets a product attribute

src/Libraries/Nop.Services/Catalog/ProductAttributeService.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,14 @@ public virtual async Task DeleteProductAttributesAsync(IList<ProductAttribute> p
8585
/// <summary>
8686
/// Gets all product attributes
8787
/// </summary>
88+
/// <param name="name">Filter by name</param>
8889
/// <param name="pageIndex">Page index</param>
8990
/// <param name="pageSize">Page size</param>
90-
/// <param name="name">Filter by name</param>
9191
/// <returns>
9292
/// A task that represents the asynchronous operation
9393
/// The task result contains the product attributes
9494
/// </returns>
95-
public virtual async Task<IPagedList<ProductAttribute>> GetAllProductAttributesAsync(int pageIndex = 0,
96-
int pageSize = int.MaxValue, string name = "")
95+
public virtual async Task<IPagedList<ProductAttribute>> GetAllProductAttributesAsync(string name = null, int pageIndex = 0, int pageSize = int.MaxValue)
9796
{
9897
var query = _productAttributeRepository.Table;
9998

src/Presentation/Nop.Web.Framework/Migrations/UpgradeTo490/LocalizationMigration.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public override void Up()
137137

138138
//#7515
139139
["Admin.Catalog.Attributes.ProductAttributes.List.SearchProductAttributeName"] = "Product attribute name",
140-
["Admin.Catalog.Attributes.ProductAttributes.List.SearchProductAttributeName.Hint"] = "A Product attribute name.",
140+
["Admin.Catalog.Attributes.ProductAttributes.List.SearchProductAttributeName.Hint"] = "A product attribute name.",
141141
}, languageId);
142142

143143
#endregion

src/Presentation/Nop.Web/App_Data/Localization/defaultResources.nopres.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1966,7 +1966,7 @@
19661966
<Value>Product attribute name</Value>
19671967
</LocaleResource>
19681968
<LocaleResource Name="Admin.Catalog.Attributes.ProductAttributes.List.SearchProductAttributeName.Hint">
1969-
<Value>A Product attribute name.</Value>
1969+
<Value>A product attribute name.</Value>
19701970
</LocaleResource>
19711971
<LocaleResource Name="Admin.Catalog.Attributes.SpecificationAttributes">
19721972
<Value>Specification attributes</Value>

src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductAttributeController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public partial class ProductAttributeController : BaseAdminController
2525
protected readonly IProductAttributeModelFactory _productAttributeModelFactory;
2626
protected readonly IProductAttributeService _productAttributeService;
2727

28-
#endregion Fields
28+
#endregion
2929

3030
#region Ctor
3131

src/Presentation/Nop.Web/Areas/Admin/Factories/ProductAttributeModelFactory.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ public virtual async Task<ProductAttributeListModel> PrepareProductAttributeList
116116
ArgumentNullException.ThrowIfNull(searchModel);
117117

118118
//get product attributes
119-
var productAttributes = await _productAttributeService
120-
.GetAllProductAttributesAsync(pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize, name: searchModel.SearchProductAttributeName);
119+
var productAttributes = await _productAttributeService.GetAllProductAttributesAsync(
120+
name: searchModel.SearchProductAttributeName,
121+
pageIndex: searchModel.Page - 1,
122+
pageSize: searchModel.PageSize);
121123

122124
//prepare list model
123125
var model = new ProductAttributeListModel().PrepareToGrid(searchModel, productAttributes, () =>

src/Presentation/Nop.Web/Areas/Admin/Views/ProductAttribute/List.cshtml

+31-31
Original file line numberDiff line numberDiff line change
@@ -74,38 +74,38 @@
7474
<nop-doc-reference asp-string-resource="@T("Admin.Documentation.Reference.ProductAttributes", Docs.ProductAttributes + Utm.OnAdmin)" asp-add-wrapper="false" />
7575
</p>
7676
@await Html.PartialAsync("Table", new DataTablesModel
77-
{
78-
Name = "products-grid",
79-
UrlRead = new DataUrl("List", "ProductAttribute", null),
80-
SearchButtonId = "search-productattributes",
81-
Length = Model.PageSize,
82-
LengthMenu = Model.AvailablePageSizes,
83-
Filters = new List<FilterParameter>
8477
{
85-
new FilterParameter(nameof(Model.SearchProductAttributeName))
86-
},
87-
ColumnCollection = new List<ColumnProperty>
88-
{
89-
new ColumnProperty(nameof(ProductAttributeModel.Id))
90-
{
91-
IsMasterCheckBox = true,
92-
Render = new RenderCheckBox("checkbox_productattributes"),
93-
ClassName = NopColumnClassDefaults.CenterAll,
94-
Width = "50"
95-
},
96-
new ColumnProperty(nameof(ProductAttributeModel.Name))
97-
{
98-
Title = T("Admin.Catalog.Attributes.ProductAttributes.Fields.Name").Text
99-
},
100-
new ColumnProperty(nameof(ProductAttributeModel.Id))
101-
{
102-
Title = T("Admin.Common.Edit").Text,
103-
Width = "100",
104-
ClassName = NopColumnClassDefaults.Button,
105-
Render = new RenderButtonEdit(new DataUrl("~/Admin/ProductAttribute/Edit"))
106-
}
107-
}
108-
})
78+
Name = "products-grid",
79+
UrlRead = new DataUrl("List", "ProductAttribute", null),
80+
SearchButtonId = "search-productattributes",
81+
Length = Model.PageSize,
82+
LengthMenu = Model.AvailablePageSizes,
83+
Filters = new List<FilterParameter>
84+
{
85+
new FilterParameter(nameof(Model.SearchProductAttributeName))
86+
},
87+
ColumnCollection = new List<ColumnProperty>
88+
{
89+
new ColumnProperty(nameof(ProductAttributeModel.Id))
90+
{
91+
IsMasterCheckBox = true,
92+
Render = new RenderCheckBox("checkbox_productattributes"),
93+
ClassName = NopColumnClassDefaults.CenterAll,
94+
Width = "50"
95+
},
96+
new ColumnProperty(nameof(ProductAttributeModel.Name))
97+
{
98+
Title = T("Admin.Catalog.Attributes.ProductAttributes.Fields.Name").Text
99+
},
100+
new ColumnProperty(nameof(ProductAttributeModel.Id))
101+
{
102+
Title = T("Admin.Common.Edit").Text,
103+
Width = "100",
104+
ClassName = NopColumnClassDefaults.Button,
105+
Render = new RenderButtonEdit(new DataUrl("~/Admin/ProductAttribute/Edit"))
106+
}
107+
}
108+
})
109109

110110
<script>
111111
$(function() {

0 commit comments

Comments
 (0)