Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Retire ResourceKeyPrefix as a content-gating idiom in Product views

KrzysztofPajak9db96128073a
diff --git a/docs/superpowers/specs/2026-08-17-arch001-phase2-view-consolidation-design.md b/docs/superpowers/specs/2026-08-17-arch001-phase2-view-consolidation-design.md
index dff493390..ec8bfc352 100644
--- a/docs/superpowers/specs/2026-08-17-arch001-phase2-view-consolidation-design.md
+++ b/docs/superpowers/specs/2026-08-17-arch001-phase2-view-consolidation-design.md
@@ -485,6 +485,10 @@ Same override-wins mechanism as section 4a, applied to three shapes of content d
`template: '<a class="k-link" href="...">#:Category#</a>'`; Vendor:
`template: '#:Category#'`).
- `CreateOrUpdate.Collections.cshtml` → `Partials/Collections.LinkTemplate.cshtml`, same shape.
+ - `CreateOrUpdate.Reviews.cshtml` (found during implementation - not in the original six-site
+ audit, which only searched for `!= "Vendor"` and missed this file's `== "Vendor"` phrasing of
+ the same idiom) → `Partials/Reviews.CustomerLinkTemplate.cshtml` and
+ `Partials/Reviews.TitleLinkTemplate.cshtml`, same shape, two occurrences in one file.
3. **C# capability gate** (no partial mechanism applies outside Razor): add a named boolean to
`IAdminDataScope<TEntity>` instead of comparing `ResourceKeyPrefix`, matching the pattern
`ShowStoreSelector`/`DefaultVendorId` already establish for capability flags.
diff --git a/src/Tests/Grand.Web.Admin.Tests/Services/GlobalAdminDataScopeTests.cs b/src/Tests/Grand.Web.Admin.Tests/Services/GlobalAdminDataScopeTests.cs
index 1f01ea0bd..4d4cee044 100644
--- a/src/Tests/Grand.Web.Admin.Tests/Services/GlobalAdminDataScopeTests.cs
+++ b/src/Tests/Grand.Web.Admin.Tests/Services/GlobalAdminDataScopeTests.cs
@@ -46,4 +46,11 @@ public class GlobalAdminDataScopeTests
var scope = new GlobalAdminDataScope<Product>();
Assert.IsTrue(scope.ShowStoreSelector);
}
+
+ [TestMethod]
+ public void CanFeatureOnHomepage_IsTrue()
+ {
+ var scope = new GlobalAdminDataScope<Product>();
+ Assert.IsTrue(scope.CanFeatureOnHomepage);
+ }
}
diff --git a/src/Tests/Grand.Web.Admin.Tests/Services/ProductViewModelServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/Services/ProductViewModelServiceTests.cs
index 250255df3..421b06294 100644
--- a/src/Tests/Grand.Web.Admin.Tests/Services/ProductViewModelServiceTests.cs
+++ b/src/Tests/Grand.Web.Admin.Tests/Services/ProductViewModelServiceTests.cs
@@ -123,6 +123,7 @@ public class ProductViewModelServiceTests
_scopeMock.Setup(s => s.ResourceKeyPrefix).Returns("Admin");
_scopeMock.Setup(s => s.ShowStoreSelector).Returns(true);
_scopeMock.Setup(s => s.DefaultVendorId).Returns((string)null);
+ _scopeMock.Setup(s => s.CanFeatureOnHomepage).Returns(true);
_productViewModelService = new ProductViewModelService(
_productServiceMock.Object,
@@ -255,6 +256,7 @@ public class ProductViewModelServiceTests
_scopeMock.Setup(s => s.DefaultStoreId).Returns((string)null);
_scopeMock.Setup(s => s.ResourceKeyPrefix).Returns("Vendor");
_scopeMock.Setup(s => s.ShowStoreSelector).Returns(false);
+ _scopeMock.Setup(s => s.CanFeatureOnHomepage).Returns(false);
_storeServiceMock.Setup(s => s.GetAllStores()).ReturnsAsync(new List<Store> {
new() { Id = "store1", Shortcut = "Store 1" }
});
diff --git a/src/Tests/Grand.Web.Admin.Tests/Services/RoutedProductDataScopeTests.cs b/src/Tests/Grand.Web.Admin.Tests/Services/RoutedProductDataScopeTests.cs
index aac5d0ee0..45d5b9d05 100644
--- a/src/Tests/Grand.Web.Admin.Tests/Services/RoutedProductDataScopeTests.cs
+++ b/src/Tests/Grand.Web.Admin.Tests/Services/RoutedProductDataScopeTests.cs
@@ -56,6 +56,7 @@ public class RoutedProductDataScopeTests
Assert.AreEqual("Admin", resolver.ResourceKeyPrefix);
Assert.IsNull(resolver.DefaultStoreId);
Assert.IsNull(resolver.DefaultVendorId);
+ Assert.IsTrue(resolver.CanFeatureOnHomepage);
}
[TestMethod]
@@ -65,6 +66,7 @@ public class RoutedProductDataScopeTests
Assert.AreEqual("Admin", resolver.ResourceKeyPrefix);
Assert.AreEqual(StaffStoreId, resolver.DefaultStoreId);
Assert.IsNull(resolver.DefaultVendorId);
+ Assert.IsTrue(resolver.CanFeatureOnHomepage);
}
[TestMethod]
@@ -74,6 +76,7 @@ public class RoutedProductDataScopeTests
Assert.AreEqual("Vendor", resolver.ResourceKeyPrefix);
Assert.AreEqual(VendorId, resolver.DefaultVendorId);
Assert.IsFalse(resolver.ShowStoreSelector);
+ Assert.IsFalse(resolver.CanFeatureOnHomepage);
}
[TestMethod]
diff --git a/src/Tests/Grand.Web.Store.Tests/Services/StoreAdminDataScopeTests.cs b/src/Tests/Grand.Web.Store.Tests/Services/StoreAdminDataScopeTests.cs
index f0326fea8..d14eadf12 100644
--- a/src/Tests/Grand.Web.Store.Tests/Services/StoreAdminDataScopeTests.cs
+++ b/src/Tests/Grand.Web.Store.Tests/Services/StoreAdminDataScopeTests.cs
@@ -90,6 +90,13 @@ public class StoreAdminDataScopeTests
Assert.IsTrue(scope.ShowStoreSelector);
}
+ [TestMethod]
+ public void CanFeatureOnHomepage_IsTrue()
+ {
+ var scope = new StoreAdminDataScope<Product>(_contextAccessor.Object);
+ Assert.IsTrue(scope.CanFeatureOnHomepage);
+ }
+
// CanView is deliberately looser than HasAccess: it mirrors Store's original Edit(GET)/CopyProduct
// rule (a global or multi-store product including the staff member's store may be viewed/copied;
// only a product limited to stores that exclude the staff member's store is denied). See the
diff --git a/src/Tests/Grand.Web.Vendor.Tests/Services/VendorProductDataScopeTests.cs b/src/Tests/Grand.Web.Vendor.Tests/Services/VendorProductDataScopeTests.cs
index 39772d5c7..f90d4f257 100644
--- a/src/Tests/Grand.Web.Vendor.Tests/Services/VendorProductDataScopeTests.cs
+++ b/src/Tests/Grand.Web.Vendor.Tests/Services/VendorProductDataScopeTests.cs
@@ -80,4 +80,11 @@ public class VendorProductDataScopeTests
var scope = new VendorProductDataScope(_contextAccessor.Object);
Assert.IsFalse(scope.ShowStoreSelector);
}
+
+ [TestMethod]
+ public void CanFeatureOnHomepage_IsFalse()
+ {
+ var scope = new VendorProductDataScope(_contextAccessor.Object);
+ Assert.IsFalse(scope.CanFeatureOnHomepage);
+ }
}
diff --git a/src/Web/Grand.Web.AdminShared/Interfaces/IAdminDataScope.cs b/src/Web/Grand.Web.AdminShared/Interfaces/IAdminDataScope.cs
index 639de8354..b92f5f8b6 100644
--- a/src/Web/Grand.Web.AdminShared/Interfaces/IAdminDataScope.cs
+++ b/src/Web/Grand.Web.AdminShared/Interfaces/IAdminDataScope.cs
@@ -46,4 +46,11 @@ public interface IAdminDataScope<TEntity>
/// <c>PrepareProductList</c> regardless of any vendor filter a client-supplied model field might carry,
/// so a vendor can never search or bulk-list another vendor's products.</summary>
string? DefaultVendorId { get; }
+
+ /// <summary>Whether the host's product list/search screens should offer the "Show on homepage"
+ /// filter option. True for Global and Store; false for Vendor - vendors can't feature products
+ /// on the homepage, a real capability difference, not a naming difference. Replaces the earlier
+ /// `ResourceKeyPrefix != "Vendor"` check in ProductViewModelService, which overloaded a
+ /// localization-key property for behavior gating.</summary>
+ bool CanFeatureOnHomepage { get; }
}
diff --git a/src/Web/Grand.Web.AdminShared/Services/GlobalAdminDataScope.cs b/src/Web/Grand.Web.AdminShared/Services/GlobalAdminDataScope.cs
index aa6b9647c..c44291b2c 100644
--- a/src/Web/Grand.Web.AdminShared/Services/GlobalAdminDataScope.cs
+++ b/src/Web/Grand.Web.AdminShared/Services/GlobalAdminDataScope.cs
@@ -17,4 +17,6 @@ public class GlobalAdminDataScope<TEntity> : IAdminDataScope<TEntity>
public bool ShowStoreSelector => true;
public string? DefaultVendorId => null;
+
+ public bool CanFeatureOnHomepage => true;
}
diff --git a/src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs
index 7006a2c8f..9c85e49c5 100644
--- a/src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs
+++ b/src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs
@@ -570,11 +570,7 @@ public class ProductViewModelService(
// Admin/Store show "Show on homepage" (value 3); Vendor's original copy omits it entirely - vendors
// can't feature products on the homepage, a real capability difference, not a naming difference.
- // Using ResourceKeyPrefix as the gate works today (only Vendor differs) but is semantically about
- // capability, not localization - if a fourth host is ever added, replace this with a proper
- // bool CanFeatureOnHomepage on IAdminDataScope<TEntity> rather than continuing to overload
- // ResourceKeyPrefix for behavior gating.
- if (scope.ResourceKeyPrefix != "Vendor")
+ if (scope.CanFeatureOnHomepage)
model.AvailablePublishedOptions.Add(new SelectListItem {
Text = translationService.GetResource($"{scope.ResourceKeyPrefix}.Catalog.Products.List.SearchPublished.ShowOnHomePage"),
Value = "3"
diff --git a/src/Web/Grand.Web.AdminShared/Services/RoutedProductDataScope.cs b/src/Web/Grand.Web.AdminShared/Services/RoutedProductDataScope.cs
index 7e17968ec..bbf068851 100644
--- a/src/Web/Grand.Web.AdminShared/Services/RoutedProductDataScope.cs
+++ b/src/Web/Grand.Web.AdminShared/Services/RoutedProductDataScope.cs
@@ -62,4 +62,6 @@ public class RoutedProductDataScope(
public bool ShowStoreSelector => Resolved.ShowStoreSelector;
public string? DefaultVendorId => Resolved.DefaultVendorId;
+
+ public bool CanFeatureOnHomepage => Resolved.CanFeatureOnHomepage;
}
diff --git a/src/Web/Grand.Web.AdminShared/Services/StoreAdminDataScope.cs b/src/Web/Grand.Web.AdminShared/Services/StoreAdminDataScope.cs
index b1956ff0e..0a6269350 100644
--- a/src/Web/Grand.Web.AdminShared/Services/StoreAdminDataScope.cs
+++ b/src/Web/Grand.Web.AdminShared/Services/StoreAdminDataScope.cs
@@ -43,4 +43,6 @@ public class StoreAdminDataScope<TEntity>(IContextAccessor contextAccessor) : IA
public bool ShowStoreSelector => true;
public string? DefaultVendorId => null;
+
+ public bool CanFeatureOnHomepage => true;
}
diff --git a/src/Web/Grand.Web.AdminShared/Services/VendorProductDataScope.cs b/src/Web/Grand.Web.AdminShared/Services/VendorProductDataScope.cs
index 250313a6f..cea9c9854 100644
--- a/src/Web/Grand.Web.AdminShared/Services/VendorProductDataScope.cs
+++ b/src/Web/Grand.Web.AdminShared/Services/VendorProductDataScope.cs
@@ -27,4 +27,6 @@ public class VendorProductDataScope(IContextAccessor contextAccessor) : IAdminDa
public bool ShowStoreSelector => false;
public string? DefaultVendorId => contextAccessor.WorkContext.CurrentVendor.Id;
+
+ public bool CanFeatureOnHomepage => false;
}
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Additional.Downloads.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Additional.Downloads.cshtml
new file mode 100644
index 000000000..9e2e2f7c1
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Additional.Downloads.cshtml
@@ -0,0 +1,88 @@
+@using Grand.Domain.Media
+@model ProductModel
+<div class="form-horizontal" id="group-downloads">
+ <div class="form-body">
+ <div class="form-group">
+ <admin-label asp-for="IsDownload"/>
+ <div class="col-md-9 col-sm-9">
+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
+ <admin-input asp-for="IsDownload"/>
+ <div class="control__indicator"></div>
+ </label>
+ <span asp-validation-for="IsDownload"></span>
+ </div>
+ </div>
+ <div class="form-group" id="pnlDownloadFile">
+ <admin-label asp-for="DownloadId"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-input asp-for="DownloadId"/>
+ <span asp-validation-for="DownloadId"></span>
+ </div>
+ </div>
+ <div class="form-group" id="pnlUnlimitedDownloads">
+ <admin-label asp-for="UnlimitedDownloads"/>
+ <div class="col-md-9 col-sm-9">
+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
+ <admin-input asp-for="UnlimitedDownloads"/>
+ <div class="control__indicator"></div>
+ </label>
+ <span asp-validation-for="UnlimitedDownloads"></span>
+ </div>
+ </div>
+ <div class="form-group" id="pnlMaxNumberOfDownloads">
+ <admin-label asp-for="MaxNumberOfDownloads"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-input asp-for="MaxNumberOfDownloads"/>
+ <span asp-validation-for="MaxNumberOfDownloads"></span>
+ </div>
+ </div>
+ <div class="form-group" id="pnlDownloadExpirationDays">
+ <admin-label asp-for="DownloadExpirationDays"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-input asp-for="DownloadExpirationDays"/>
+ <span asp-validation-for="DownloadExpirationDays"></span>
+ </div>
+ </div>
+ <div class="form-group" id="pnlDownloadActivationType">
+ <admin-label asp-for="DownloadActivationTypeId"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="DownloadActivationTypeId" asp-items="EnumTranslationService.ToSelectList((DownloadActivationType)Model.DownloadActivationTypeId)"/>
+ <span asp-validation-for="DownloadActivationTypeId"></span>
+ </div>
+ </div>
+ <div class="form-group" id="pnlHasUserAgreement">
+ <admin-label asp-for="HasUserAgreement"/>
+ <div class="col-md-9 col-sm-9">
+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
+ <admin-input asp-for="HasUserAgreement"/>
+ <div class="control__indicator"></div>
+ </label>
+ <span asp-validation-for="HasUserAgreement"></span>
+ </div>
+ </div>
+ <div class="form-group" id="pnlUserAgreementText">
+ <admin-label asp-for="UserAgreementText"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-textarea asp-for="UserAgreementText"></admin-textarea>
+ <span asp-validation-for="UserAgreementText"></span>
+ </div>
+ </div>
+ <div class="form-group" id="pnlHasSampleDownload">
+ <admin-label asp-for="HasSampleDownload"/>
+ <div class="col-md-9 col-sm-9">
+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
+ <admin-input asp-for="HasSampleDownload"/>
+ <div class="control__indicator"></div>
+ </label>
+ <span asp-validation-for="HasSampleDownload"></span>
+ </div>
+ </div>
+ <div class="form-group" id="pnlSampleDownloadFile">
+ <admin-label asp-for="SampleDownloadId"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-input asp-for="SampleDownloadId"/>
+ <span asp-validation-for="SampleDownloadId"></span>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Categories.FeaturedColumn.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Categories.FeaturedColumn.cshtml
new file mode 100644
index 000000000..997f469d5
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Categories.FeaturedColumn.cshtml
@@ -0,0 +1,10 @@
+<text>
+{
+ field: "IsFeaturedProduct",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Categories.Fields.IsFeaturedProduct"]",
+ width: 100,
+ headerAttributes: { style: "text-align:center" },
+ attributes: { style: "text-align:center" },
+ template: '# if(IsFeaturedProduct) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
+},
+</text>
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Categories.LinkTemplate.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Categories.LinkTemplate.cshtml
new file mode 100644
index 000000000..697507bfb
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Categories.LinkTemplate.cshtml
@@ -0,0 +1,4 @@
+@{
+ var area = ViewContext.RouteData.Values["area"]?.ToString();
+}
+template: '<a class="k-link" href="@Url.Action("Edit", "Category", new { area = area })/#=CategoryId#">#:Category#</a>'
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Collections.FeaturedColumn.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Collections.FeaturedColumn.cshtml
new file mode 100644
index 000000000..d79d6177b
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Collections.FeaturedColumn.cshtml
@@ -0,0 +1,10 @@
+<text>
+{
+ field: "IsFeaturedProduct",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Collections.Fields.IsFeaturedProduct"]",
+ width: 100,
+ headerAttributes: { style: "text-align:center" },
+ attributes: { style: "text-align:center" },
+ template: '# if(IsFeaturedProduct) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
+},
+</text>
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Collections.LinkTemplate.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Collections.LinkTemplate.cshtml
new file mode 100644
index 000000000..64efce9c5
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Collections.LinkTemplate.cshtml
@@ -0,0 +1,4 @@
+@{
+ var area = ViewContext.RouteData.Values["area"]?.ToString();
+}
+template: '<a class="k-link" href="@Url.Action("Edit", "Collection", new { area = area })/#=CollectionId#">#:Collection#</a>'
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Additional.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Additional.cshtml
index 37088da81..ffb86592a 100644
--- a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Additional.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Additional.cshtml
@@ -68,95 +68,7 @@
</div>
</div>
-@if (Scope.ResourceKeyPrefix != "Vendor")
-{
- <div class="form-horizontal" id="group-downloads">
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="IsDownload"/>
- <div class="col-md-9 col-sm-9">
- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
- <admin-input asp-for="IsDownload"/>
- <div class="control__indicator"></div>
- </label>
- <span asp-validation-for="IsDownload"></span>
- </div>
- </div>
- <div class="form-group" id="pnlDownloadFile">
- <admin-label asp-for="DownloadId"/>
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="DownloadId"/>
- <span asp-validation-for="DownloadId"></span>
- </div>
- </div>
- <div class="form-group" id="pnlUnlimitedDownloads">
- <admin-label asp-for="UnlimitedDownloads"/>
- <div class="col-md-9 col-sm-9">
- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
- <admin-input asp-for="UnlimitedDownloads"/>
- <div class="control__indicator"></div>
- </label>
- <span asp-validation-for="UnlimitedDownloads"></span>
- </div>
- </div>
- <div class="form-group" id="pnlMaxNumberOfDownloads">
- <admin-label asp-for="MaxNumberOfDownloads"/>
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="MaxNumberOfDownloads"/>
- <span asp-validation-for="MaxNumberOfDownloads"></span>
- </div>
- </div>
- <div class="form-group" id="pnlDownloadExpirationDays">
- <admin-label asp-for="DownloadExpirationDays"/>
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="DownloadExpirationDays"/>
- <span asp-validation-for="DownloadExpirationDays"></span>
- </div>
- </div>
- <div class="form-group" id="pnlDownloadActivationType">
- <admin-label asp-for="DownloadActivationTypeId"/>
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="DownloadActivationTypeId" asp-items="EnumTranslationService.ToSelectList((DownloadActivationType)Model.DownloadActivationTypeId)"/>
- <span asp-validation-for="DownloadActivationTypeId"></span>
- </div>
- </div>
- <div class="form-group" id="pnlHasUserAgreement">
- <admin-label asp-for="HasUserAgreement"/>
- <div class="col-md-9 col-sm-9">
- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
- <admin-input asp-for="HasUserAgreement"/>
- <div class="control__indicator"></div>
- </label>
- <span asp-validation-for="HasUserAgreement"></span>
- </div>
- </div>
- <div class="form-group" id="pnlUserAgreementText">
- <admin-label asp-for="UserAgreementText"/>
- <div class="col-md-9 col-sm-9">
- <admin-textarea asp-for="UserAgreementText"></admin-textarea>
- <span asp-validation-for="UserAgreementText"></span>
- </div>
- </div>
- <div class="form-group" id="pnlHasSampleDownload">
- <admin-label asp-for="HasSampleDownload"/>
- <div class="col-md-9 col-sm-9">
- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
- <admin-input asp-for="HasSampleDownload"/>
- <div class="control__indicator"></div>
- </label>
- <span asp-validation-for="HasSampleDownload"></span>
- </div>
- </div>
- <div class="form-group" id="pnlSampleDownloadFile">
- <admin-label asp-for="SampleDownloadId"/>
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SampleDownloadId"/>
- <span asp-validation-for="SampleDownloadId"></span>
- </div>
- </div>
- </div>
- </div>
-}
+<partial name="Partials/Additional.Downloads" model="Model"/>
<div class="form-horizontal" id="group-recurring">
<div class="form-body">
<div class="form-group">
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Categories.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Categories.cshtml
index f12208639..332003813 100644
--- a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Categories.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Categories.cshtml
@@ -97,28 +97,9 @@
title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Categories.Fields.Category"]",
width: 200,
editor: categoryDropDownEditor,
- @if (Scope.ResourceKeyPrefix == "Vendor")
- {
- <text>template: '#:Category#'</text>
- }
- else
- {
- <text>template: '<a class="k-link" href="@Url.Action("Edit", "Category", new { area = area })/#=CategoryId#">#:Category#</a>'</text>
- }
+ <partial name="Partials/Categories.LinkTemplate"/>
},
- @if (Scope.ResourceKeyPrefix != "Vendor")
- {
- <text>
- {
- field: "IsFeaturedProduct",
- title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Categories.Fields.IsFeaturedProduct"]",
- width: 100,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(IsFeaturedProduct) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- },
- </text>
- }
+ <partial name="Partials/Categories.FeaturedColumn"/>
{
field: "DisplayOrder",
title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Categories.Fields.DisplayOrder"]",
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Collections.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Collections.cshtml
index 17b7d376d..f90ac00f0 100644
--- a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Collections.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Collections.cshtml
@@ -98,28 +98,9 @@
title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Collections.Fields.Collection"]",
width: 200,
editor: collectionDropDownEditor,
- @if (Scope.ResourceKeyPrefix == "Vendor")
- {
- <text>template: '#:Collection#'</text>
- }
- else
- {
- <text>template: '<a class="k-link" href="@Url.Action("Edit", "Collection", new { area = area })/#=CollectionId#">#:Collection#</a>'</text>
- }
+ <partial name="Partials/Collections.LinkTemplate"/>
},
- @if (Scope.ResourceKeyPrefix != "Vendor")
- {
- <text>
- {
- field: "IsFeaturedProduct",
- title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Collections.Fields.IsFeaturedProduct"]",
- width: 100,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(IsFeaturedProduct) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- },
- </text>
- }
+ <partial name="Partials/Collections.FeaturedColumn"/>
{
field: "DisplayOrder",
title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Collections.Fields.DisplayOrder"]",
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Reviews.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Reviews.cshtml
index e3122522c..52813d42b 100644
--- a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Reviews.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.Reviews.cshtml
@@ -52,27 +52,13 @@
field: "CustomerId",
title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.ProductReviews.Fields.Customer"]",
width: 200,
- @if (Scope.ResourceKeyPrefix == "Vendor")
- {
- <text>template: '#:CustomerInfo#',</text>
- }
- else
- {
- <text>template: '<a class="k-link" href="@Url.Action("Edit", "Customer", new { area = area })/#=CustomerId#">#:CustomerInfo#</a>',</text>
- }
+ <partial name="Partials/Reviews.CustomerLinkTemplate"/>
minScreenWidth: 750,
},
{
field: "Title",
title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.ProductReviews.Fields.Title"]",
- @if (Scope.ResourceKeyPrefix == "Vendor")
- {
- <text>template: '#:Title#',</text>
- }
- else
- {
- <text>template: '<a class="k-link" href="@Url.Action("Edit", "ProductReview", new { area = area })/#=Id#">#:Title#</a>',</text>
- }
+ <partial name="Partials/Reviews.TitleLinkTemplate"/>
width: 280,
},
{
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.cshtml
index fc058904a..304d6217d 100644
--- a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdate.cshtml
@@ -1,11 +1,4 @@
-@using Grand.Business.Core.Interfaces.Common.Security
-@using Grand.Domain.Permissions
@model ProductModel
-@inject IPermissionService permissionService
-@{
- //has "Manage Documents" permission? (Vendor never shows the Documents tab, so skip the check entirely for it)
- var canManageDocuments = Scope.ResourceKeyPrefix != "Vendor" && await permissionService.Authorize(StandardPermission.ManageDocuments);
-}
<div asp-validation-summary="All"></div>
<input asp-for="Id" type="hidden"/>
<input asp-for="Ticks" type="hidden"/>
@@ -129,27 +122,8 @@
</div>
</content>
</tabstrip-item>
- @if (Scope.ResourceKeyPrefix != "Vendor")
- {
- if (canManageDocuments)
- {
- <tabstrip-item text="@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Documents"]" tab-index="16">
- <content>
- <div>
- <partial name="Partials/CreateOrUpdate.Documents" model="Model"/>
- </div>
- </content>
- </tabstrip-item>
- }
-
- <tabstrip-item text="@Loc[$"{Scope.ResourceKeyPrefix}.Common.UserFields.Tab"]" tab-index="17">
- <content>
- <div>
- <partial name="Partials/UserFields" model="Model"/>
- </div>
- </content>
- </tabstrip-item>
- }
+ <partial name="Partials/Tab.Documents" model="Model"/>
+ <partial name="Partials/Tab.UserFields" model="Model"/>
}
<partial name="Partials/WidgetZone.Tabs" model="Model"/>
</items>
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdateTierPrice.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdateTierPrice.cshtml
index b46b3040c..3f7cfc78d 100644
--- a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdateTierPrice.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/CreateOrUpdateTierPrice.cshtml
@@ -28,23 +28,7 @@
<span asp-validation-for="CurrencyCode"></span>
</div>
</div>
- @if (Scope.ResourceKeyPrefix != "Vendor")
- {
- <div class="form-group">
- <admin-label asp-for="StoreId" class="col-sm-3 control-label"/>
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="StoreId" asp-items="Model.AvailableStores"/>
- <span asp-validation-for="StoreId"></span>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="CustomerGroupId" class="col-sm-3 control-label"/>
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="CustomerGroupId" asp-items="Model.AvailableCustomerGroups"/>
- <span asp-validation-for="CustomerGroupId"></span>
- </div>
- </div>
- }
+ <partial name="Partials/TierPrice.StoreScope" model="Model"/>
<div class="form-group">
<admin-label asp-for="StartDateTime" class="col-sm-3 control-label"/>
<div class="col-md-9 col-sm-9">
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Reviews.CustomerLinkTemplate.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Reviews.CustomerLinkTemplate.cshtml
new file mode 100644
index 000000000..20c67efee
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Reviews.CustomerLinkTemplate.cshtml
@@ -0,0 +1,4 @@
+@{
+ var area = ViewContext.RouteData.Values["area"]?.ToString();
+}
+template: '<a class="k-link" href="@Url.Action("Edit", "Customer", new { area = area })/#=CustomerId#">#:CustomerInfo#</a>',
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Reviews.TitleLinkTemplate.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Reviews.TitleLinkTemplate.cshtml
new file mode 100644
index 000000000..f3c0fc5bd
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Reviews.TitleLinkTemplate.cshtml
@@ -0,0 +1,4 @@
+@{
+ var area = ViewContext.RouteData.Values["area"]?.ToString();
+}
+template: '<a class="k-link" href="@Url.Action("Edit", "ProductReview", new { area = area })/#=Id#">#:Title#</a>',
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Tab.Documents.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Tab.Documents.cshtml
new file mode 100644
index 000000000..f41e89669
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Tab.Documents.cshtml
@@ -0,0 +1,17 @@
+@using Grand.Business.Core.Interfaces.Common.Security
+@using Grand.Domain.Permissions
+@model ProductModel
+@inject IPermissionService permissionService
+@{
+ var canManageDocuments = await permissionService.Authorize(StandardPermission.ManageDocuments);
+}
+@if (canManageDocuments)
+{
+ <tabstrip-item text="@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Documents"]" tab-index="16">
+ <content>
+ <div>
+ <partial name="Partials/CreateOrUpdate.Documents" model="Model"/>
+ </div>
+ </content>
+ </tabstrip-item>
+}
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Tab.UserFields.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Tab.UserFields.cshtml
new file mode 100644
index 000000000..6cae6a420
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/Tab.UserFields.cshtml
@@ -0,0 +1,8 @@
+@model ProductModel
+<tabstrip-item text="@Loc[$"{Scope.ResourceKeyPrefix}.Common.UserFields.Tab"]" tab-index="17">
+ <content>
+ <div>
+ <partial name="Partials/UserFields" model="Model"/>
+ </div>
+ </content>
+</tabstrip-item>
diff --git a/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/TierPrice.StoreScope.cshtml b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/TierPrice.StoreScope.cshtml
new file mode 100644
index 000000000..e37ac65f1
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/AdminShared/Product/Partials/TierPrice.StoreScope.cshtml
@@ -0,0 +1,15 @@
+@model ProductModel.TierPriceModel
+<div class="form-group">
+ <admin-label asp-for="StoreId" class="col-sm-3 control-label"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="StoreId" asp-items="Model.AvailableStores"/>
+ <span asp-validation-for="StoreId"></span>
+ </div>
+</div>
+<div class="form-group">
+ <admin-label asp-for="CustomerGroupId" class="col-sm-3 control-label"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="CustomerGroupId" asp-items="Model.AvailableCustomerGroups"/>
+ <span asp-validation-for="CustomerGroupId"></span>
+ </div>
+</div>
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Additional.Downloads.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Additional.Downloads.cshtml
new file mode 100644
index 000000000..850a1eba6
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Additional.Downloads.cshtml
@@ -0,0 +1 @@
+@* Intentionally empty: Vendor products can't be downloads - see ARCH-001 Phase 2 spec section 6. *@
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Categories.FeaturedColumn.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Categories.FeaturedColumn.cshtml
new file mode 100644
index 000000000..09f8b528b
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Categories.FeaturedColumn.cshtml
@@ -0,0 +1 @@
+@* Intentionally empty: Vendor has no IsFeaturedProduct column - see ARCH-001 Phase 2 spec section 6. *@
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Categories.LinkTemplate.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Categories.LinkTemplate.cshtml
new file mode 100644
index 000000000..afa4c2a46
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Categories.LinkTemplate.cshtml
@@ -0,0 +1,2 @@
+@* Vendor can't open the Category edit page - see ARCH-001 Phase 2 spec section 6. *@
+template: '#:Category#'
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Collections.FeaturedColumn.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Collections.FeaturedColumn.cshtml
new file mode 100644
index 000000000..09f8b528b
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Collections.FeaturedColumn.cshtml
@@ -0,0 +1 @@
+@* Intentionally empty: Vendor has no IsFeaturedProduct column - see ARCH-001 Phase 2 spec section 6. *@
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Collections.LinkTemplate.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Collections.LinkTemplate.cshtml
new file mode 100644
index 000000000..343b623e7
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Collections.LinkTemplate.cshtml
@@ -0,0 +1,2 @@
+@* Vendor can't open the Collection edit page - see ARCH-001 Phase 2 spec section 6. *@
+template: '#:Collection#'
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Reviews.CustomerLinkTemplate.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Reviews.CustomerLinkTemplate.cshtml
new file mode 100644
index 000000000..a1b464903
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Reviews.CustomerLinkTemplate.cshtml
@@ -0,0 +1,2 @@
+@* Vendor can't open the Customer edit page - see ARCH-001 Phase 2 spec section 6. *@
+template: '#:CustomerInfo#',
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Reviews.TitleLinkTemplate.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Reviews.TitleLinkTemplate.cshtml
new file mode 100644
index 000000000..fd05e4bc4
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Reviews.TitleLinkTemplate.cshtml
@@ -0,0 +1,2 @@
+@* Vendor can't open the ProductReview edit page - see ARCH-001 Phase 2 spec section 6. *@
+template: '#:Title#',
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Tab.Documents.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Tab.Documents.cshtml
new file mode 100644
index 000000000..2804b78e6
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Tab.Documents.cshtml
@@ -0,0 +1 @@
+@* Intentionally empty: Vendor never shows a Documents tab - see ARCH-001 Phase 2 spec section 6. *@
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Tab.UserFields.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Tab.UserFields.cshtml
new file mode 100644
index 000000000..df0530588
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/Tab.UserFields.cshtml
@@ -0,0 +1 @@
+@* Intentionally empty: Vendor never shows a User fields tab - see ARCH-001 Phase 2 spec section 6. *@
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/TierPrice.StoreScope.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/TierPrice.StoreScope.cshtml
new file mode 100644
index 000000000..830d71369
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/TierPrice.StoreScope.cshtml
@@ -0,0 +1 @@
+@* Intentionally empty: Vendor isn't store-scoped, so tier prices have no Store/CustomerGroup fields - see ARCH-001 Phase 2 spec section 6. *@