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.Pictures.cshtml to AdminShared (ARCH-001 Phase 2)

KrzysztofPajak0058ffcc25c4
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml
similarity index 76%
rename from src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml
rename to src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml
index 74961f433..30f1e492d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml
@@ -1,13 +1,29 @@
-@model ProductModel
-
+@model ProductModel
+@{
+ var area = ViewContext.RouteData.Values["area"]?.ToString();
+}
@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
- <vc:admin-widget widget-zone="product_details_pictures_top" additional-data="Model"/>
+ @if (Scope.ResourceKeyPrefix == "Vendor")
+ {
+ <vc:vendor-widget widget-zone="vendor_product_details_pictures_top" additional-data="Model"/>
+ }
+ else
+ {
+ <vc:admin-widget widget-zone="product_details_pictures_top" additional-data="Model"/>
+ }
<div class="panel-body">
<div id="productpictures-grid"></div>
</div>
- <vc:admin-widget widget-zone="product_details_pictures_bottom" additional-data="Model"/>
+ @if (Scope.ResourceKeyPrefix == "Vendor")
+ {
+ <vc:vendor-widget widget-zone="vendor_product_details_pictures_bottom" additional-data="Model"/>
+ }
+ else
+ {
+ <vc:admin-widget widget-zone="product_details_pictures_bottom" additional-data="Model"/>
+ }
</div>
<script>
$(document).ready(function () {
@@ -30,13 +46,13 @@
dataSource: {
transport: {
read: {
- url: "@Html.Raw(Url.Action("ProductPictureList", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",
+ url: "@Html.Raw(Url.Action("ProductPictureList", "Product", new { productId = Model.Id, area = area }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
- },
+ },
destroy: {
- url: "@Html.Raw(Url.Action("ProductPictureDelete", "Product", new { area = Constants.AreaAdmin }))",
+ url: "@Html.Raw(Url.Action("ProductPictureDelete", "Product", new { area = area }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
@@ -85,13 +101,13 @@
scrollable: false,
columns: [{
field: "PictureUrl",
- title: "@Loc["Admin.Catalog.Products.Pictures.Fields.Picture"]",
- template: "<a class='k-link editpicture' href=\"@Url.Action("ProductPicturePopup", "Product", new { area = Constants.AreaAdmin })/?productId=@(Model.Id)&Id=#=Id#&btnId=btnRefreshProductPictures&formId=product-form\"><img alt='#=PictureId#' src='#=PictureUrl#' width='150' /></a>",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Pictures.Fields.Picture"]",
+ template: "<a class='k-link editpicture' href=\"@Url.Action("ProductPicturePopup", "Product", new { area = area })/?productId=@(Model.Id)&Id=#=Id#&btnId=btnRefreshProductPictures&formId=product-form\"><img alt='#=PictureId#' src='#=PictureUrl#' width='150' /></a>",
width: 165
},
{
field: "IsDefault",
- title: "@Loc["Admin.Catalog.Products.Pictures.Fields.IsDefault"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Pictures.Fields.IsDefault"]",
width: 100,
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" },
@@ -99,7 +115,7 @@
},
{
field: "DisplayOrder",
- title: "@Loc["Admin.Catalog.Products.Pictures.Fields.DisplayOrder"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Pictures.Fields.DisplayOrder"]",
minScreenWidth: 750,
width: 100,
headerAttributes: { style: "text-align:center" },
@@ -108,15 +124,15 @@
}, {
field: "AltAttribute",
minScreenWidth: 500,
- title: "@Loc["Admin.Catalog.Products.Pictures.Fields.OverrideAltAttribute"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Pictures.Fields.OverrideAltAttribute"]",
}, {
field: "TitleAttribute",
- title: "@Loc["Admin.Catalog.Products.Pictures.Fields.OverrideTitleAttribute"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Pictures.Fields.OverrideTitleAttribute"]",
minScreenWidth: 500,
}, {
command: [{
name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
+ text: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Delete"]"
}],
width: 200
}]
@@ -125,7 +141,7 @@
</script>
<p>
- <strong>@Loc["Admin.Catalog.Products.Pictures.AddNew"]</strong>
+ <strong>@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Pictures.AddNew"]</strong>
</p>
<div class="form-horizontal">
<div class="form-body">
@@ -133,7 +149,7 @@
@{
ViewData["Reference"] = "Product";
ViewData["ObjectId"] = Model.Id;
- ViewData["Endpoint"] = Url.Action("ProductPictureAdd", "Product", new { area = Constants.AreaAdmin });
+ ViewData["Endpoint"] = Url.Action("ProductPictureAdd", "Product", new { area = area });
ViewData["Click"] = "btnRefreshProductPictures";
}
<div class="col-md-9 col-sm-9">
@@ -160,6 +176,6 @@
else
{
<div class="note note-info">
- @Loc["Admin.Catalog.Products.Pictures.SaveBeforeEdit"]
+ @Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Pictures.SaveBeforeEdit"]
</div>
-}
\ No newline at end of file
+}
diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml
deleted file mode 100644
index 068149512..000000000
--- a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml
+++ /dev/null
@@ -1,165 +0,0 @@
-@model ProductModel
-
-@if (!string.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <vc:admin-widget widget-zone="product_details_pictures_top" additional-data="Model"/>
- <div class="panel-body">
- <div id="productpictures-grid"></div>
- </div>
- <vc:admin-widget widget-zone="product_details_pictures_bottom" additional-data="Model"/>
- </div>
- <script>
- $(document).ready(function () {
- $("#productpictures-grid").kendoGrid({
- dataBound: function () {
- $('.editpicture').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');
- }
- }
- });
- },
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ProductPictureList", "Product", new { productId = Model.Id, area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ProductPictureDelete", "Product", new { area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- PictureUrl: {editable: false, type: "string" },
- DisplayOrder: {editable: true, type: "number" },
- IsDefault: { editable: true, type: "boolean" },
- AltAttribute: {editable: true, type: "string" },
- TitleAttribute: {editable: true, type: "string" }
- }
- }
- },
- requestEnd: function(e) {
- if(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,
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: true,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "PictureUrl",
- title: "@Loc["Admin.Catalog.Products.Pictures.Fields.Picture"]",
- template: "<a class='k-link editpicture' href=\"@Url.Action("ProductPicturePopup", "Product", new { area = Constants.AreaStore })/?productId=@(Model.Id)&Id=#=Id#&btnId=btnRefreshProductPictures&formId=product-form\"><img alt='#=PictureId#' src='#=PictureUrl#' width='150' /></a>",
- width: 165
- },
- {
- field: "IsDefault",
- title: "@Loc["Admin.Catalog.Products.Pictures.Fields.IsDefault"]",
- width: 100,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(IsDefault) {# <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: "DisplayOrder",
- title: "@Loc["Admin.Catalog.Products.Pictures.Fields.DisplayOrder"]",
- minScreenWidth: 750,
- width: 100,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- format: "{0:0}",
- }, {
- field: "AltAttribute",
- minScreenWidth: 500,
- title: "@Loc["Admin.Catalog.Products.Pictures.Fields.OverrideAltAttribute"]",
- }, {
- field: "TitleAttribute",
- title: "@Loc["Admin.Catalog.Products.Pictures.Fields.OverrideTitleAttribute"]",
- minScreenWidth: 500,
- }, {
- command: [{
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }],
- width: 200
- }]
- });
- });
-</script>
-
- <p>
- <strong>@Loc["Admin.Catalog.Products.Pictures.AddNew"]</strong>
- </p>
- <div class="form-horizontal">
- <div class="form-body">
- <div class="form-group">
- @{
- ViewData["Reference"] = "Product";
- ViewData["ObjectId"] = Model.Id;
- ViewData["Endpoint"] = Url.Action("ProductPictureAdd", "Product", new { area = Constants.AreaStore });
- ViewData["Click"] = "btnRefreshProductPictures";
- }
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="AddPictureModel.PictureId"/>
- <span asp-validation-for="AddPictureModel.PictureId"></span>
- </div>
- <input type="submit" id="btnRefreshProductPictures" style="display: none"/>
- <script>
- $(document).ready(function () {
- $('#btnRefreshProductPictures').click(function () {
- //refresh grid
- var grid = $("#productpictures-grid").data('kendoGrid');
- grid.dataSource.read();
-
- //return false to don't reload a page
- return false;
- });
- });
- </script>
- </div>
- </div>
- </div>
-}
-else
-{
- <div class="note note-info">
- @Loc["Admin.Catalog.Products.Pictures.SaveBeforeEdit"]
- </div>
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml
deleted file mode 100644
index ea70f54d1..000000000
--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml
+++ /dev/null
@@ -1,165 +0,0 @@
-@model ProductModel
-
-@if (!string.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <vc:vendor-widget widget-zone="vendor_product_details_pictures_top" additional-data="Model"/>
- <div class="panel-body">
- <div id="productpictures-grid"></div>
- </div>
- <vc:vendor-widget widget-zone="vendor_product_details_pictures_bottom" additional-data="Model"/>
- </div>
- <script>
- $(document).ready(function () {
- $("#productpictures-grid").kendoGrid({
- dataBound: function () {
- $('.editpicture').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');
- }
- }
- });
- },
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ProductPictureList", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ProductPictureDelete", "Product", new { area = Constants.AreaVendor }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- PictureUrl: {editable: false, type: "string" },
- DisplayOrder: {editable: true, type: "number" },
- IsDefault: { editable: true, type: "boolean" },
- AltAttribute: {editable: true, type: "string" },
- TitleAttribute: {editable: true, type: "string" }
- }
- }
- },
- requestEnd: function(e) {
- if(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,
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: true,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "PictureUrl",
- title: "@Loc["Vendor.Catalog.Products.Pictures.Fields.Picture"]",
- template: "<a class='k-link editpicture' href=\"@Url.Action("ProductPicturePopup", "Product", new { area = Constants.AreaVendor })/?productId=@(Model.Id)&Id=#=Id#&btnId=btnRefreshProductPictures&formId=product-form\"><img alt='#=PictureId#' src='#=PictureUrl#' width='150' /></a>",
- width: 165
- },
- {
- field: "IsDefault",
- title: "@Loc["Admin.Catalog.Products.Pictures.Fields.IsDefault"]",
- width: 100,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(IsDefault) {# <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: "DisplayOrder",
- title: "@Loc["Vendor.Catalog.Products.Pictures.Fields.DisplayOrder"]",
- minScreenWidth: 750,
- width: 100,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- format: "{0:0}",
- }, {
- field: "AltAttribute",
- minScreenWidth: 500,
- title: "@Loc["Vendor.Catalog.Products.Pictures.Fields.OverrideAltAttribute"]",
- }, {
- field: "TitleAttribute",
- title: "@Loc["Vendor.Catalog.Products.Pictures.Fields.OverrideTitleAttribute"]",
- minScreenWidth: 500,
- }, {
- command: [{
- name: "destroy",
- text: "@Loc["Vendor.Common.Delete"]"
- }],
- width: 200
- }]
- });
- });
-</script>
-
- <p>
- <strong>@Loc["Vendor.Catalog.Products.Pictures.AddNew"]</strong>
- </p>
- <div class="form-horizontal">
- <div class="form-body">
- <div class="form-group">
- @{
- ViewData["Reference"] = "Product";
- ViewData["ObjectId"] = Model.Id;
- ViewData["Endpoint"] = Url.Action("ProductPictureAdd", "Product", new { area = Constants.AreaVendor });
- ViewData["Click"] = "btnRefreshProductPictures";
- }
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="AddPictureModel.PictureId"/>
- <span asp-validation-for="AddPictureModel.PictureId"></span>
- </div>
- <input type="submit" id="btnRefreshProductPictures" style="display: none"/>
- <script>
- $(document).ready(function () {
- $('#btnRefreshProductPictures').click(function () {
- //refresh grid
- var grid = $("#productpictures-grid").data('kendoGrid');
- grid.dataSource.read();
-
- //return false to don't reload a page
- return false;
- });
- });
- </script>
- </div>
- </div>
- </div>
-}
-else
-{
- <div class="note note-info">
- @Loc["Vendor.Catalog.Products.Pictures.SaveBeforeEdit"]
- </div>
-}
\ No newline at end of file