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.

Migrate CreateOrUpdate.SpecificationAttributes.cshtml to AdminShared (ARCH-001 Phase 2)

KrzysztofPajak8cf623c5099f
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml
deleted file mode 100644
index 509401a68..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml
+++ /dev/null
@@ -1,159 +0,0 @@
-@model ProductModel
-
-@if (!string.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <vc:admin-widget widget-zone="product_details_specification_attribute_details_top" additional-data="Model"/>
- <div class="panel-body">
- <div id="specificationattributes-grid"></div>
- </div>
- <vc:admin-widget widget-zone="product_details_specification_attribute_details_bottom" additional-data="Model"/>
- <div class="panel-footer">
- <a id="btnAddNewSpecification" href="@(Url.Action("ProductSpecAttrPopup", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Catalog.Products.SpecificationAttributes.AddButton"]</a>
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
-
- $('#btnAddNewSpecification').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
-
- $("#specificationattributes-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ProductSpecAttrList", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ProductSpecAttrDelete", "Product", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- AttributeTypeName: { editable: false, type: "string" },
- AttributeTypeId: { editable: false, type: "int" },
- AttributeName: { editable: false, type: "string" },
- ValueRaw: { editable: false, type: "string" },
- AllowFiltering: { editable: false, type: "boolean" },
- ShowOnProductPage: { editable: false, type: "boolean" },
- DisplayOrder: { editable: false, type: "number" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- autoBind: false,
- dataBound: function () {
- var data = this.dataSource.data();
- $('.btnMagnificPopup').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "AttributeTypeName",
- title: "@Loc["Admin.Catalog.Products.SpecificationAttributes.Fields.AttributeType"]",
- template: "<a class='k-link btnMagnificPopup' href='@Url.Action("ProductSpecAttrPopup", "Product", new { area = Constants.AreaAdmin })/?productId=@(Model.Id)&id=#=Id#'>#=kendo.htmlEncode(AttributeTypeName)#</a>"
- }, {
- field: "ValueRaw",
- encoded: false,
- title: "@Loc["Admin.Catalog.Products.SpecificationAttributes.Fields.Value"]",
- template: "<a class='k-link btnMagnificPopup' href='@Url.Action("ProductSpecAttrPopup", "Product", new { area = Constants.AreaAdmin })/?productId=@(Model.Id)&id=#=Id#'>#=kendo.htmlEncode(AttributeName)# : #=ValueRaw# </a>"
- }, {
- field: "AllowFiltering",
- title: "@Loc["Admin.Catalog.Products.SpecificationAttributes.Fields.AllowFiltering"]",
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(AllowFiltering) {# <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> #} #'
- }, {
- field: "ShowOnProductPage",
- title: "@Loc["Admin.Catalog.Products.SpecificationAttributes.Fields.ShowOnProductPage"]",
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(ShowOnProductPage) {# <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> #} #'
- }, {
- command: [
- {
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }
- ]
- }]
- });
- });
- </script>
- <input type="submit" id="btnRefreshProductSpec" style="display: none"/>
- <script>
- $(document).ready(function () {
- $('#btnRefreshProductSpec').click(function () {
- //refresh grid
- var grid = $("#specificationattributes-grid").data('kendoGrid');
- grid.dataSource.read();
- //return false to don't reload a page
- return false;
- });
- });
- </script>
-}
-else
-{
- <div class="note note-info">
- @Loc["Admin.Catalog.Products.SpecificationAttributes.SaveBeforeEdit"]
- </div>
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml
similarity index 81%
rename from src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml
rename to src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml
index e4a587b9e..3fb6bf6fc 100644
--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml
@@ -1,15 +1,18 @@
@model ProductModel
+@{
+ var area = ViewContext.RouteData.Values["area"]?.ToString();
+}
@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
- <vc:vendor-widget widget-zone="vendor_product_details_specification_attribute_details_top" additional-data="Model"/>
+ <partial name="Partials/WidgetZone.SpecificationAttributes.Top" model="Model"/>
<div class="panel-body">
<div id="specificationattributes-grid"></div>
</div>
- <vc:vendor-widget widget-zone="vendor_product_details_specification_attribute_details_bottom" additional-data="Model"/>
+ <partial name="Partials/WidgetZone.SpecificationAttributes.Bottom" model="Model"/>
<div class="panel-footer">
- <a id="btnAddNewSpecification" href="@(Url.Action("ProductSpecAttrPopup", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Vendor.Catalog.Products.SpecificationAttributes.AddButton"]</a>
+ <a id="btnAddNewSpecification" href="@(Url.Action("ProductSpecAttrPopup", "Product", new { productId = Model.Id, area = area }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.SpecificationAttributes.AddButton"]</a>
</div>
</div>
@@ -34,13 +37,13 @@
dataSource: {
transport: {
read: {
- url: "@Html.Raw(Url.Action("ProductSpecAttrList", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))",
+ url: "@Html.Raw(Url.Action("ProductSpecAttrList", "Product", new { productId = Model.Id, area = area }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
},
destroy: {
- url: "@Html.Raw(Url.Action("ProductSpecAttrDelete", "Product", new { area = Constants.AreaVendor }))",
+ url: "@Html.Raw(Url.Action("ProductSpecAttrDelete", "Product", new { area = area }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
@@ -108,22 +111,22 @@
scrollable: false,
columns: [{
field: "AttributeTypeName",
- title: "@Loc["Vendor.Catalog.Products.SpecificationAttributes.Fields.AttributeType"]",
- template: "<a class='k-link btnMagnificPopup' href='@Url.Action("ProductSpecAttrPopup", "Product", new { area = Constants.AreaVendor })/?productId=@(Model.Id)&id=#=Id#'>#=kendo.htmlEncode(AttributeTypeName)#</a>"
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.SpecificationAttributes.Fields.AttributeType"]",
+ template: "<a class='k-link btnMagnificPopup' href='@Url.Action("ProductSpecAttrPopup", "Product", new { area = area })/?productId=@(Model.Id)&id=#=Id#'>#=kendo.htmlEncode(AttributeTypeName)#</a>"
}, {
field: "ValueRaw",
encoded: false,
- title: "@Loc["Vendor.Catalog.Products.SpecificationAttributes.Fields.Value"]",
- template: "<a class='k-link btnMagnificPopup' href='@Url.Action("ProductSpecAttrPopup", "Product", new { area = Constants.AreaVendor })/?productId=@(Model.Id)&id=#=Id#'>#=kendo.htmlEncode(AttributeName)# : #=ValueRaw# </a>"
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.SpecificationAttributes.Fields.Value"]",
+ template: "<a class='k-link btnMagnificPopup' href='@Url.Action("ProductSpecAttrPopup", "Product", new { area = area })/?productId=@(Model.Id)&id=#=Id#'>#=kendo.htmlEncode(AttributeName)# : #=ValueRaw# </a>"
}, {
field: "AllowFiltering",
- title: "@Loc["Vendor.Catalog.Products.SpecificationAttributes.Fields.AllowFiltering"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.SpecificationAttributes.Fields.AllowFiltering"]",
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" },
template: '# if(AllowFiltering) {# <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> #} #'
}, {
field: "ShowOnProductPage",
- title: "@Loc["Vendor.Catalog.Products.SpecificationAttributes.Fields.ShowOnProductPage"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.SpecificationAttributes.Fields.ShowOnProductPage"]",
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" },
template: '# if(ShowOnProductPage) {# <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> #} #'
@@ -131,7 +134,7 @@
command: [
{
name: "destroy",
- text: "@Loc["Vendor.Common.Delete"]"
+ text: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Delete"]"
}
]
}]
@@ -154,6 +157,6 @@
else
{
<div class="note note-info">
- @Loc["Vendor.Catalog.Products.SpecificationAttributes.SaveBeforeEdit"]
+ @Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.SpecificationAttributes.SaveBeforeEdit"]
</div>
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.AdminShared/Views/Product/Partials/WidgetZone.SpecificationAttributes.Bottom.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/WidgetZone.SpecificationAttributes.Bottom.cshtml
new file mode 100644
index 000000000..91c03fd27
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/WidgetZone.SpecificationAttributes.Bottom.cshtml
@@ -0,0 +1,2 @@
+@model ProductModel
+<vc:admin-widget widget-zone="product_details_specification_attribute_details_bottom" additional-data="Model"/>
diff --git a/src/Web/Grand.Web.AdminShared/Views/Product/Partials/WidgetZone.SpecificationAttributes.Top.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/WidgetZone.SpecificationAttributes.Top.cshtml
new file mode 100644
index 000000000..b7958f1be
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/WidgetZone.SpecificationAttributes.Top.cshtml
@@ -0,0 +1,2 @@
+@model ProductModel
+<vc:admin-widget widget-zone="product_details_specification_attribute_details_top" additional-data="Model"/>
diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml
deleted file mode 100644
index 21805ad8f..000000000
--- a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml
+++ /dev/null
@@ -1,159 +0,0 @@
-@model ProductModel
-
-@if (!string.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <vc:admin-widget widget-zone="product_details_specification_attribute_details_top" additional-data="Model"/>
- <div class="panel-body">
- <div id="specificationattributes-grid"></div>
- </div>
- <vc:admin-widget widget-zone="product_details_specification_attribute_details_bottom" additional-data="Model"/>
- <div class="panel-footer">
- <a id="btnAddNewSpecification" href="@(Url.Action("ProductSpecAttrPopup", "Product", new { productId = Model.Id, area = Constants.AreaStore }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Catalog.Products.SpecificationAttributes.AddButton"]</a>
- </div>
- </div>
-
- <script>
- $(document).ready(function () {
-
- $('#btnAddNewSpecification').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
-
- $("#specificationattributes-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ProductSpecAttrList", "Product", new { productId = Model.Id, area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ProductSpecAttrDelete", "Product", new { area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- AttributeTypeName: { editable: false, type: "string" },
- AttributeTypeId: { editable: false, type: "int" },
- AttributeName: { editable: false, type: "string" },
- ValueRaw: { editable: false, type: "string" },
- AllowFiltering: { editable: false, type: "boolean" },
- ShowOnProductPage: { editable: false, type: "boolean" },
- DisplayOrder: { editable: false, type: "number" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "create" || e.type == "update") {
- this.read();
- }
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- autoBind: false,
- dataBound: function () {
- var data = this.dataSource.data();
- $('.btnMagnificPopup').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- },
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "AttributeTypeName",
- title: "@Loc["Admin.Catalog.Products.SpecificationAttributes.Fields.AttributeType"]",
- template: "<a class='k-link btnMagnificPopup' href='@Url.Action("ProductSpecAttrPopup", "Product", new { area = Constants.AreaStore })/?productId=@(Model.Id)&id=#=Id#'>#=kendo.htmlEncode(AttributeTypeName)#</a>"
- }, {
- field: "ValueRaw",
- encoded: false,
- title: "@Loc["Admin.Catalog.Products.SpecificationAttributes.Fields.Value"]",
- template: "<a class='k-link btnMagnificPopup' href='@Url.Action("ProductSpecAttrPopup", "Product", new { area = Constants.AreaStore })/?productId=@(Model.Id)&id=#=Id#'>#=kendo.htmlEncode(AttributeName)# : #=ValueRaw# </a>"
- }, {
- field: "AllowFiltering",
- title: "@Loc["Admin.Catalog.Products.SpecificationAttributes.Fields.AllowFiltering"]",
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(AllowFiltering) {# <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> #} #'
- }, {
- field: "ShowOnProductPage",
- title: "@Loc["Admin.Catalog.Products.SpecificationAttributes.Fields.ShowOnProductPage"]",
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(ShowOnProductPage) {# <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> #} #'
- }, {
- command: [
- {
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }
- ]
- }]
- });
- });
- </script>
- <input type="submit" id="btnRefreshProductSpec" style="display: none"/>
- <script>
- $(document).ready(function () {
- $('#btnRefreshProductSpec').click(function () {
- //refresh grid
- var grid = $("#specificationattributes-grid").data('kendoGrid');
- grid.dataSource.read();
- //return false to don't reload a page
- return false;
- });
- });
- </script>
-}
-else
-{
- <div class="note note-info">
- @Loc["Admin.Catalog.Products.SpecificationAttributes.SaveBeforeEdit"]
- </div>
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/WidgetZone.SpecificationAttributes.Bottom.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/WidgetZone.SpecificationAttributes.Bottom.cshtml
new file mode 100644
index 000000000..f612fa5a4
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/WidgetZone.SpecificationAttributes.Bottom.cshtml
@@ -0,0 +1,2 @@
+@model ProductModel
+<vc:vendor-widget widget-zone="vendor_product_details_specification_attribute_details_bottom" additional-data="Model"/>
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/WidgetZone.SpecificationAttributes.Top.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/WidgetZone.SpecificationAttributes.Top.cshtml
new file mode 100644
index 000000000..7669a0c52
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/WidgetZone.SpecificationAttributes.Top.cshtml
@@ -0,0 +1,2 @@
+@model ProductModel
+<vc:vendor-widget widget-zone="vendor_product_details_specification_attribute_details_top" additional-data="Model"/>