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

KrzysztofPajakb0b4cb99fd30
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Create.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/Create.cshtml
similarity index 54%
rename from src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Create.cshtml
rename to src/Web/Grand.Web.AdminShared/Views/Product/Create.cshtml
index 718f3ce5b..30c425390 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Create.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/Product/Create.cshtml
@@ -1,9 +1,10 @@
-@model ProductModel
+@model ProductModel
@{
//page title
- ViewBag.Title = Loc["Admin.Catalog.Products.AddNew"];
+ ViewBag.Title = Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.AddNew"];
+ var area = ViewContext.RouteData.Values["area"]?.ToString();
}
-<form asp-area="@Constants.AreaAdmin" asp-controller="Product" asp-action="Create" method="post" id="product-form">
+<form asp-area="@area" asp-controller="Product" asp-action="Create" method="post" id="product-form">
<div class="row">
<div class="col-md-12">
@@ -11,20 +12,27 @@
<div class="x_title">
<div class="caption">
<i class="fa fa-cube"></i>
- @Loc["Admin.Catalog.Products.AddNew"]
+ @Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.AddNew"]
<small>
- <i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.Catalog.Products.BackToList"], "List")
+ <i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.BackToList"], "List")
</small>
</div>
<div class="actions">
<div class="btn-group btn-group-devided">
<button class="btn btn-success" type="submit" name="save">
- <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]
+ <i class="fa fa-check"></i> @Loc[$"{Scope.ResourceKeyPrefix}.Common.Save"]
</button>
<button class="btn btn-success" type="submit" name="save-continue">
- <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"]
+ <i class="fa fa-check-circle"></i> @Loc[$"{Scope.ResourceKeyPrefix}.Common.SaveContinue"]
</button>
- <vc:admin-widget widget-zone="product_details_buttons" additional-data="null"/>
+ @if (Scope.ResourceKeyPrefix == "Vendor")
+ {
+ <vc:vendor-widget widget-zone="vendor_product_details_buttons" additional-data="null"/>
+ }
+ else
+ {
+ <vc:admin-widget widget-zone="product_details_buttons" additional-data="null"/>
+ }
</div>
</div>
</div>
@@ -34,4 +42,4 @@
</div>
</div>
</div>
-</form>
\ No newline at end of file
+</form>
diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Create.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Create.cshtml
deleted file mode 100644
index 0ff5e79e4..000000000
--- a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Create.cshtml
+++ /dev/null
@@ -1,37 +0,0 @@
-@model ProductModel
-@{
- //page title
- ViewBag.Title = Loc["Admin.Catalog.Products.AddNew"];
-}
-<form asp-area="@Constants.AreaStore" asp-controller="Product" asp-action="Create" method="post" id="product-form">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-cube"></i>
- @Loc["Admin.Catalog.Products.AddNew"]
- <small>
- <i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.Catalog.Products.BackToList"], "List")
- </small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save">
- <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]
- </button>
- <button class="btn btn-success" type="submit" name="save-continue">
- <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"]
- </button>
- <vc:admin-widget widget-zone="product_details_buttons" additional-data="null"/>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdate" model="Model"/>
- </div>
- </div>
- </div>
- </div>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Create.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Create.cshtml
deleted file mode 100644
index d5f41e079..000000000
--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Create.cshtml
+++ /dev/null
@@ -1,37 +0,0 @@
-@model ProductModel
-@{
- //page title
- ViewBag.Title = Loc["Vendor.Catalog.Products.AddNew"];
-}
-<form asp-area="@Constants.AreaVendor" asp-controller="Product" asp-action="Create" method="post" id="product-form">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-cube"></i>
- @Loc["Vendor.Catalog.Products.AddNew"]
- <small>
- <i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Vendor.Catalog.Products.BackToList"], "List")
- </small>
- </div>
- <div class="actions">
- <div class="btn-group btn-group-devided">
- <button class="btn btn-success" type="submit" name="save">
- <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]
- </button>
- <button class="btn btn-success" type="submit" name="save-continue">
- <i class="fa fa-check-circle"></i> @Loc["Vendor.Common.SaveContinue"]
- </button>
- <vc:vendor-widget widget-zone="vendor_product_details_buttons" additional-data="null"/>
- </div>
- </div>
- </div>
- <div class="x_content form">
- <partial name="Partials/CreateOrUpdate" model="Model"/>
- </div>
- </div>
- </div>
- </div>
-</form>
\ No newline at end of file