From 65ff8b4d859121c943190801ff2166069016d605 Mon Sep 17 00:00:00 2001 From: TheHadiAhmadi Date: Sat, 26 Oct 2024 18:05:40 +0430 Subject: [PATCH] #2199 Remove EditLayout from project --- .../SiteAssociatedEntities/Page.cs | 1 - .../SiteAssociatedEntities/Site.cs | 1 - .../FluentCMS.Services/LayoutService.cs | 2 +- .../MessageHandlers/PageMessageHandler.cs | 6 --- .../FluentCMS.Services/Models/PageTemplate.cs | 1 - .../FluentCMS.Services/Models/SiteTemplate.cs | 1 - src/Backend/FluentCMS.Services/SiteService.cs | 1 - .../Controllers/PageController.cs | 2 - .../Models/Pages/PageCreateRequest.cs | 2 - .../Models/Pages/PageDetailResponse.cs | 1 - .../Models/Pages/PageFullDetailResponse.cs | 1 - .../Models/Site/SiteDetailResponse.cs | 1 - .../Models/Site/SiteUpdateRequest.cs | 3 -- .../Templates/Blank/EditLayout.body.html | 9 ---- .../Templates/Blank/EditLayout.head.html | 51 ------------------- src/FluentCMS/Templates/Blank/EditLayout.html | 1 - src/FluentCMS/Templates/Blank/site.json | 18 ------- .../Templates/Default/EditLayout.body.html | 9 ---- .../Templates/Default/EditLayout.head.html | 51 ------------------- .../Templates/Default/EditLayout.html | 1 - src/FluentCMS/Templates/Default/site.json | 19 ------- .../GeneratedApiClients.cs | 19 ------- .../Components/PageSettingsModal.razor | 3 +- .../Components/PluginsSection.razor | 2 +- src/Frontend/FluentCMS.Web.UI/Default.razor | 10 +--- .../FluentCMS.Web.UI/PageSettingsModel.cs | 4 -- .../FluentCMS.Web.UI/ServiceExtensions.cs | 12 +---- .../LayoutManagement/LayoutListPlugin.razor | 2 +- .../PageManagement/PageCreatePlugin.razor | 3 +- .../PageManagement/PageSettingsModel.cs | 4 -- .../PageManagement/PageUpdatePlugin.razor | 3 +- .../SiteManagement/SiteListPlugin.razor | 3 -- .../SiteManagement/SiteUpdateModel.cs | 1 - .../SiteManagement/SiteUpdatePlugin.razor | 3 +- .../SiteManagement/SiteUpdatePlugin.razor.cs | 2 - src/Shared/ViewState.cs | 2 - 36 files changed, 10 insertions(+), 245 deletions(-) delete mode 100644 src/FluentCMS/Templates/Blank/EditLayout.body.html delete mode 100644 src/FluentCMS/Templates/Blank/EditLayout.head.html delete mode 100644 src/FluentCMS/Templates/Blank/EditLayout.html delete mode 100644 src/FluentCMS/Templates/Default/EditLayout.body.html delete mode 100644 src/FluentCMS/Templates/Default/EditLayout.head.html delete mode 100644 src/FluentCMS/Templates/Default/EditLayout.html diff --git a/src/Backend/FluentCMS.Entities/SiteAssociatedEntities/Page.cs b/src/Backend/FluentCMS.Entities/SiteAssociatedEntities/Page.cs index a6ff3178c..70e34e304 100644 --- a/src/Backend/FluentCMS.Entities/SiteAssociatedEntities/Page.cs +++ b/src/Backend/FluentCMS.Entities/SiteAssociatedEntities/Page.cs @@ -7,7 +7,6 @@ public class Page : SiteAssociatedEntity public int Order { get; set; } public string Path { get; set; } = string.Empty; // URL path, only one segment without forward slash (/) public Guid? LayoutId { get; set; } - public Guid? EditLayoutId { get; set; } public Guid? DetailLayoutId { get; set; } public bool Locked { get; set; } = false; } diff --git a/src/Backend/FluentCMS.Entities/SiteAssociatedEntities/Site.cs b/src/Backend/FluentCMS.Entities/SiteAssociatedEntities/Site.cs index 1b65ed454..7fc91e95f 100644 --- a/src/Backend/FluentCMS.Entities/SiteAssociatedEntities/Site.cs +++ b/src/Backend/FluentCMS.Entities/SiteAssociatedEntities/Site.cs @@ -7,5 +7,4 @@ public class Site : AuditableEntity public List Urls { get; set; } = []; public Guid LayoutId { get; set; } public Guid DetailLayoutId { get; set; } - public Guid EditLayoutId { get; set; } } diff --git a/src/Backend/FluentCMS.Services/LayoutService.cs b/src/Backend/FluentCMS.Services/LayoutService.cs index f52a31de0..f39c52827 100644 --- a/src/Backend/FluentCMS.Services/LayoutService.cs +++ b/src/Backend/FluentCMS.Services/LayoutService.cs @@ -68,7 +68,7 @@ public async Task Delete(Guid id, CancellationToken cancellationToken = var site = await siteRepository.GetById(siteId, cancellationToken) ?? throw new AppException(ExceptionCodes.SiteNotFound); - if (site.LayoutId == id || site.EditLayoutId == id || site.DetailLayoutId == id) + if (site.LayoutId == id || site.DetailLayoutId == id) throw new AppException(ExceptionCodes.LayoutUnableToDeleteDefaultLayout); var deleted = await layoutRepository.Delete(id, cancellationToken) ?? diff --git a/src/Backend/FluentCMS.Services/MessageHandlers/PageMessageHandler.cs b/src/Backend/FluentCMS.Services/MessageHandlers/PageMessageHandler.cs index aa38203ca..6fdbff798 100644 --- a/src/Backend/FluentCMS.Services/MessageHandlers/PageMessageHandler.cs +++ b/src/Backend/FluentCMS.Services/MessageHandlers/PageMessageHandler.cs @@ -22,11 +22,6 @@ public async Task Handle(Message notification, CancellationToken cancell page.DetailLayoutId = null; await pageService.Update(page, cancellationToken); } - if (page.EditLayoutId == layoutId) - { - page.EditLayoutId = null; - await pageService.Update(page, cancellationToken); - } } break; @@ -71,7 +66,6 @@ private async Task CreatePageTemplate(Guid? parentPageId, int order, PageTemplat Title = pageTemplate.Title, LayoutId = layouts.Where(x => x.Name == pageTemplate.Layout).SingleOrDefault()?.Id, DetailLayoutId = layouts.Where(x => x.Name == pageTemplate.DetailLayout).SingleOrDefault()?.Id, - EditLayoutId = layouts.Where(x => x.Name == pageTemplate.EditLayout).SingleOrDefault()?.Id, Order = order, Locked = pageTemplate.Locked, }; diff --git a/src/Backend/FluentCMS.Services/Models/PageTemplate.cs b/src/Backend/FluentCMS.Services/Models/PageTemplate.cs index 3a4516761..e7eddc9bd 100644 --- a/src/Backend/FluentCMS.Services/Models/PageTemplate.cs +++ b/src/Backend/FluentCMS.Services/Models/PageTemplate.cs @@ -8,7 +8,6 @@ public class PageTemplate public string Title { get; set; } = default!; public string? Layout { get; set; } = default!; public string? DetailLayout { get; set; } = default!; - public string? EditLayout { get; set; } = default!; public List Children { get; set; } = []; public List Plugins { get; set; } = []; public bool Locked { get; set; } = false; diff --git a/src/Backend/FluentCMS.Services/Models/SiteTemplate.cs b/src/Backend/FluentCMS.Services/Models/SiteTemplate.cs index c1cd13a75..133e401e7 100644 --- a/src/Backend/FluentCMS.Services/Models/SiteTemplate.cs +++ b/src/Backend/FluentCMS.Services/Models/SiteTemplate.cs @@ -10,7 +10,6 @@ public class SiteTemplate public List Layouts { get; set; } = []; public List Blocks { get; set; } = []; public string Layout { get; set; } = default!; - public string EditLayout { get; set; } = default!; public string DetailLayout { get; set; } = default!; public List Pages { get; set; } = []; public List AdminRoles { get; set; } = []; diff --git a/src/Backend/FluentCMS.Services/SiteService.cs b/src/Backend/FluentCMS.Services/SiteService.cs index 6a2e34607..86f46376d 100644 --- a/src/Backend/FluentCMS.Services/SiteService.cs +++ b/src/Backend/FluentCMS.Services/SiteService.cs @@ -91,7 +91,6 @@ public async Task Create(SiteTemplate siteTemplate, CancellationToken canc site.Urls = [ValidateAndFormatUrl(siteTemplate.Url)]; site.LayoutId = layouts.Where(x => x.Name == siteTemplate.Layout).Single().Id; - site.EditLayoutId = layouts.Where(x => x.Name == siteTemplate.EditLayout).Single().Id; site.DetailLayoutId = layouts.Where(x => x.Name == siteTemplate.DetailLayout).Single().Id; ValidateAndFormatUrls(site); diff --git a/src/Backend/FluentCMS.Web.Api/Controllers/PageController.cs b/src/Backend/FluentCMS.Web.Api/Controllers/PageController.cs index d18e53791..4a9257b0f 100644 --- a/src/Backend/FluentCMS.Web.Api/Controllers/PageController.cs +++ b/src/Backend/FluentCMS.Web.Api/Controllers/PageController.cs @@ -122,7 +122,6 @@ private async Task GetPageResponse(string domain, string var roles = await roleService.GetAllForSite(site.Id, cancellationToken) ?? []; var layoutId = page.LayoutId ?? site.LayoutId; - var editLayoutId = page.EditLayoutId ?? site.EditLayoutId; var detailLayoutId = page.DetailLayoutId ?? site.DetailLayoutId; var pageResponse = mapper.Map(page); @@ -130,7 +129,6 @@ private async Task GetPageResponse(string domain, string pageResponse.Site.AllRoles = mapper.Map>(roles); pageResponse.Site.Settings = siteSettings.Values; pageResponse.Layout = mapper.Map(layoutsDict[layoutId]); - pageResponse.EditLayout = mapper.Map(layoutsDict[editLayoutId]); pageResponse.DetailLayout = mapper.Map(layoutsDict[detailLayoutId]); pageResponse.Sections = []; pageResponse.Settings = pageSettings.Values; diff --git a/src/Backend/FluentCMS.Web.Api/Models/Pages/PageCreateRequest.cs b/src/Backend/FluentCMS.Web.Api/Models/Pages/PageCreateRequest.cs index 7b557319d..b29320a4b 100644 --- a/src/Backend/FluentCMS.Web.Api/Models/Pages/PageCreateRequest.cs +++ b/src/Backend/FluentCMS.Web.Api/Models/Pages/PageCreateRequest.cs @@ -11,8 +11,6 @@ public class PageCreateRequest public Guid? DetailLayoutId { get; set; } = default!; - public Guid? EditLayoutId { get; set; } = default!; - [Required] public string Title { get; set; } = string.Empty; diff --git a/src/Backend/FluentCMS.Web.Api/Models/Pages/PageDetailResponse.cs b/src/Backend/FluentCMS.Web.Api/Models/Pages/PageDetailResponse.cs index 0b907153f..056414c8c 100644 --- a/src/Backend/FluentCMS.Web.Api/Models/Pages/PageDetailResponse.cs +++ b/src/Backend/FluentCMS.Web.Api/Models/Pages/PageDetailResponse.cs @@ -10,7 +10,6 @@ public class PageDetailResponse : BaseSiteAssociatedResponse public string FullPath { get; set; } = default!; public Guid? LayoutId { get; set; } public Guid? DetailLayoutId { get; set; } - public Guid? EditLayoutId { get; set; } public bool Locked { get; set; } = false; public IEnumerable ViewRoleIds { get; set; } = []; public IEnumerable AdminRoleIds { get; set; } = []; diff --git a/src/Backend/FluentCMS.Web.Api/Models/Pages/PageFullDetailResponse.cs b/src/Backend/FluentCMS.Web.Api/Models/Pages/PageFullDetailResponse.cs index 3958333e9..e9a540ea1 100644 --- a/src/Backend/FluentCMS.Web.Api/Models/Pages/PageFullDetailResponse.cs +++ b/src/Backend/FluentCMS.Web.Api/Models/Pages/PageFullDetailResponse.cs @@ -9,7 +9,6 @@ public class PageFullDetailResponse : BaseSiteAssociatedResponse public string FullPath { get; set; } = default!; public LayoutDetailResponse Layout { get; set; } = default!; public LayoutDetailResponse DetailLayout { get; set; } = default!; - public LayoutDetailResponse EditLayout { get; set; } = default!; public SiteDetailResponse Site { get; set; } = default!; public Dictionary> Sections { get; set; } = []; public bool Locked { get; set; } = false; diff --git a/src/Backend/FluentCMS.Web.Api/Models/Site/SiteDetailResponse.cs b/src/Backend/FluentCMS.Web.Api/Models/Site/SiteDetailResponse.cs index 2a89e20c3..75ed9dc22 100644 --- a/src/Backend/FluentCMS.Web.Api/Models/Site/SiteDetailResponse.cs +++ b/src/Backend/FluentCMS.Web.Api/Models/Site/SiteDetailResponse.cs @@ -7,7 +7,6 @@ public class SiteDetailResponse : BaseAuditableResponse public List Urls { get; set; } = []; public Guid LayoutId { get; set; } public Guid DetailLayoutId { get; set; } - public Guid EditLayoutId { get; set; } public IEnumerable AdminRoleIds { get; set; } = []; public IEnumerable ContributorRoleIds { get; set; } = []; public List AllRoles { get; set; } = []; diff --git a/src/Backend/FluentCMS.Web.Api/Models/Site/SiteUpdateRequest.cs b/src/Backend/FluentCMS.Web.Api/Models/Site/SiteUpdateRequest.cs index e12b87a0b..2226b1adb 100644 --- a/src/Backend/FluentCMS.Web.Api/Models/Site/SiteUpdateRequest.cs +++ b/src/Backend/FluentCMS.Web.Api/Models/Site/SiteUpdateRequest.cs @@ -19,9 +19,6 @@ public class SiteUpdateRequest [Required] public Guid DetailLayoutId { get; set; } = default!; - [Required] - public Guid EditLayoutId { get; set; } = default!; - [Required] public List ContributorRoleIds { get; set; } = []; diff --git a/src/FluentCMS/Templates/Blank/EditLayout.body.html b/src/FluentCMS/Templates/Blank/EditLayout.body.html deleted file mode 100644 index 02dd6d152..000000000 --- a/src/FluentCMS/Templates/Blank/EditLayout.body.html +++ /dev/null @@ -1,9 +0,0 @@ -
-
- -
-
- - - - \ No newline at end of file diff --git a/src/FluentCMS/Templates/Blank/EditLayout.head.html b/src/FluentCMS/Templates/Blank/EditLayout.head.html deleted file mode 100644 index aaf664310..000000000 --- a/src/FluentCMS/Templates/Blank/EditLayout.head.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/FluentCMS/Templates/Blank/EditLayout.html b/src/FluentCMS/Templates/Blank/EditLayout.html deleted file mode 100644 index 5f282702b..000000000 --- a/src/FluentCMS/Templates/Blank/EditLayout.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/FluentCMS/Templates/Blank/site.json b/src/FluentCMS/Templates/Blank/site.json index a9e68bbf8..4fce00faf 100644 --- a/src/FluentCMS/Templates/Blank/site.json +++ b/src/FluentCMS/Templates/Blank/site.json @@ -2,7 +2,6 @@ "Name": "FluentCMS Administration", "Description": "FluentCMS blank site template", "Layout": "DefaultLayout", - "EditLayout": "EditLayout", "DetailLayout": "SingleLayout", "AdminRoles": [ "Administrators" ], "ContributorRoles": [ "Contributors" ], @@ -43,9 +42,6 @@ { "Name": "AuthLayout" }, - { - "Name": "EditLayout" - }, { "Name": "SingleLayout" } @@ -54,7 +50,6 @@ { "Title": "Home", "Path": "/", - "EditLayout": "EditLayout", "ViewRoles": [ "All Users" ], "Plugins": [] }, @@ -62,7 +57,6 @@ "Title": "Admin", "Path": "/admin", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [], @@ -71,7 +65,6 @@ "Title": "Content Type Builder", "Path": "/content-types", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -86,7 +79,6 @@ "Title": "Users", "Path": "/users", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -101,7 +93,6 @@ "Title": "File Management", "Path": "/files", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -116,7 +107,6 @@ "Title": "Api Tokens", "Path": "/api-tokens", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -131,7 +121,6 @@ "Title": "Roles", "Path": "/roles", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -146,7 +135,6 @@ "Title": "Sites", "Path": "/sites", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -161,7 +149,6 @@ "Title": "Plugins", "Path": "/plugins", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -176,7 +163,6 @@ "Title": "Pages", "Path": "/pages", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -191,7 +177,6 @@ "Title": "Blocks", "Path": "/blocks", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -206,7 +191,6 @@ "Title": "Layouts", "Path": "/layouts", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -221,7 +205,6 @@ "Title": "GlobalSettings", "Path": "/globalsettings", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -307,7 +290,6 @@ "Path": "/profile", "ViewRoles": [ "Authenticated Users" ], "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "Locked": true, "Plugins": [ { diff --git a/src/FluentCMS/Templates/Default/EditLayout.body.html b/src/FluentCMS/Templates/Default/EditLayout.body.html deleted file mode 100644 index 02dd6d152..000000000 --- a/src/FluentCMS/Templates/Default/EditLayout.body.html +++ /dev/null @@ -1,9 +0,0 @@ -
-
- -
-
- - - - \ No newline at end of file diff --git a/src/FluentCMS/Templates/Default/EditLayout.head.html b/src/FluentCMS/Templates/Default/EditLayout.head.html deleted file mode 100644 index aaf664310..000000000 --- a/src/FluentCMS/Templates/Default/EditLayout.head.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/FluentCMS/Templates/Default/EditLayout.html b/src/FluentCMS/Templates/Default/EditLayout.html deleted file mode 100644 index 5f282702b..000000000 --- a/src/FluentCMS/Templates/Default/EditLayout.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/FluentCMS/Templates/Default/site.json b/src/FluentCMS/Templates/Default/site.json index 44b1220b6..eae7a0e30 100644 --- a/src/FluentCMS/Templates/Default/site.json +++ b/src/FluentCMS/Templates/Default/site.json @@ -2,7 +2,6 @@ "Name": "FluentCMS", "Description": "FluentCMS default site template including some samples", "Layout": "DefaultLayout", - "EditLayout": "EditLayout", "DetailLayout": "SingleLayout", "AdminRoles": [ "Administrators" ], "ContributorRoles": [ "Contributors" ], @@ -51,9 +50,6 @@ { "Name": "AuthLayout" }, - { - "Name": "EditLayout" - }, { "Name": "SingleLayout" } @@ -62,7 +58,6 @@ { "Title": "Home", "Path": "/", - "EditLayout": "EditLayout", "ViewRoles": [ "All Users" ], "Plugins": [ { @@ -164,7 +159,6 @@ { "Title": "Blogs", "Path": "/blogs", - "EditLayout": "EditLayout", "ViewRoles": [ "All Users" ], "Plugins": [ @@ -222,7 +216,6 @@ "Title": "Admin", "Path": "/admin", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [], @@ -231,7 +224,6 @@ "Title": "Content Type Builder", "Path": "/content-types", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -246,7 +238,6 @@ "Title": "Users", "Path": "/users", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -261,7 +252,6 @@ "Title": "File Management", "Path": "/files", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -276,7 +266,6 @@ "Title": "Api Tokens", "Path": "/api-tokens", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -291,7 +280,6 @@ "Title": "Roles", "Path": "/roles", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -306,7 +294,6 @@ "Title": "Sites", "Path": "/sites", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -321,7 +308,6 @@ "Title": "Plugins", "Path": "/plugins", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -336,7 +322,6 @@ "Title": "Pages", "Path": "/pages", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -351,7 +336,6 @@ "Title": "Blocks", "Path": "/blocks", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -366,7 +350,6 @@ "Title": "Layouts", "Path": "/layouts", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -381,7 +364,6 @@ "Title": "GlobalSettings", "Path": "/globalsettings", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "AdminRoles": [ "Administrators" ], "Locked": true, "Plugins": [ @@ -466,7 +448,6 @@ "Title": "Profile", "Path": "/profile", "Layout": "AdminLayout", - "EditLayout": "AdminLayout", "ViewRoles": [ "Authenticated Users" ], "Locked": true, "Plugins": [ diff --git a/src/Frontend/FluentCMS.Web.ApiClients/GeneratedApiClients.cs b/src/Frontend/FluentCMS.Web.ApiClients/GeneratedApiClients.cs index d9b183b27..c6d999ed4 100644 --- a/src/Frontend/FluentCMS.Web.ApiClients/GeneratedApiClients.cs +++ b/src/Frontend/FluentCMS.Web.ApiClients/GeneratedApiClients.cs @@ -12286,9 +12286,6 @@ public partial class PageCreateRequest [System.Text.Json.Serialization.JsonPropertyName("detailLayoutId")] public System.Guid? DetailLayoutId { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("editLayoutId")] - public System.Guid? EditLayoutId { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("title")] [System.ComponentModel.DataAnnotations.Required] public string Title { get; set; } = default!; @@ -12359,9 +12356,6 @@ public partial class PageDetailResponse [System.Text.Json.Serialization.JsonPropertyName("detailLayoutId")] public System.Guid? DetailLayoutId { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("editLayoutId")] - public System.Guid? EditLayoutId { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("locked")] public bool Locked { get; set; } = default!; @@ -12497,9 +12491,6 @@ public partial class PageFullDetailResponse [System.Text.Json.Serialization.JsonPropertyName("detailLayout")] public LayoutDetailResponse DetailLayout { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("editLayout")] - public LayoutDetailResponse EditLayout { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("site")] public SiteDetailResponse Site { get; set; } = default!; @@ -12603,9 +12594,6 @@ public partial class PageUpdateRequest [System.Text.Json.Serialization.JsonPropertyName("detailLayoutId")] public System.Guid? DetailLayoutId { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("editLayoutId")] - public System.Guid? EditLayoutId { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("title")] [System.ComponentModel.DataAnnotations.Required] public string Title { get; set; } = default!; @@ -13465,9 +13453,6 @@ public partial class SiteDetailResponse [System.Text.Json.Serialization.JsonPropertyName("detailLayoutId")] public System.Guid DetailLayoutId { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("editLayoutId")] - public System.Guid EditLayoutId { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("adminRoleIds")] public System.Collections.Generic.ICollection? AdminRoleIds { get; set; } = default!; @@ -13584,10 +13569,6 @@ public partial class SiteUpdateRequest [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public System.Guid DetailLayoutId { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("editLayoutId")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.Guid EditLayoutId { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("contributorRoleIds")] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.ICollection ContributorRoleIds { get; set; } = new System.Collections.ObjectModel.Collection(); diff --git a/src/Frontend/FluentCMS.Web.UI/Components/PageSettingsModal.razor b/src/Frontend/FluentCMS.Web.UI/Components/PageSettingsModal.razor index de65c3205..97a0ee284 100644 --- a/src/Frontend/FluentCMS.Web.UI/Components/PageSettingsModal.razor +++ b/src/Frontend/FluentCMS.Web.UI/Components/PageSettingsModal.razor @@ -21,10 +21,9 @@ + - - diff --git a/src/Frontend/FluentCMS.Web.UI/Components/PluginsSection.razor b/src/Frontend/FluentCMS.Web.UI/Components/PluginsSection.razor index 26ae60fcf..927bf2c52 100644 --- a/src/Frontend/FluentCMS.Web.UI/Components/PluginsSection.razor +++ b/src/Frontend/FluentCMS.Web.UI/Components/PluginsSection.razor @@ -10,7 +10,7 @@ } -@if (ViewState.Plugin != null && (ViewState.Type == ViewStateType.PluginEdit || ViewState.Type == ViewStateType.PluginDetail) && Name.ToLower() == "main") +@if (ViewState.Plugin != null && (ViewState.Type == ViewStateType.PluginDetail) && Name.ToLower() == "main") {
diff --git a/src/Frontend/FluentCMS.Web.UI/Default.razor b/src/Frontend/FluentCMS.Web.UI/Default.razor index 1876152a6..ae8f76744 100644 --- a/src/Frontend/FluentCMS.Web.UI/Default.razor +++ b/src/Frontend/FluentCMS.Web.UI/Default.razor @@ -15,15 +15,7 @@ else if (ViewState.Type == ViewStateType.PagePreview) } -else if (ViewState.Type == ViewStateType.PluginEdit) -{ - - @RenderDynamicContent(ViewState.EditLayout?.Head ?? string.Empty) - - - @RenderDynamicContent(ViewState.EditLayout?.Body ?? string.Empty) -} -else if (ViewState.Type == ViewStateType.PluginDetail) +else if (ViewState.Type == ViewStateType.PluginDetail && !ViewState.Page.Locked) { @RenderDynamicContent(ViewState.DetailLayout?.Head ?? string.Empty) diff --git a/src/Frontend/FluentCMS.Web.UI/PageSettingsModel.cs b/src/Frontend/FluentCMS.Web.UI/PageSettingsModel.cs index 75881a9ec..7c5fef645 100644 --- a/src/Frontend/FluentCMS.Web.UI/PageSettingsModel.cs +++ b/src/Frontend/FluentCMS.Web.UI/PageSettingsModel.cs @@ -13,7 +13,6 @@ public class PageSettingsModel public Guid? ParentId { get; set; } = default; public Guid? LayoutId { get; set; } = default; - public Guid? EditLayoutId { get; set; } = default; public Guid? DetailLayoutId { get; set; } = default; [Required] @@ -44,7 +43,6 @@ public PageCreateRequest ToCreateRequest(Guid siteId) Path = Path, ParentId = ParentId != Guid.Empty ? ParentId : default!, LayoutId = LayoutId != Guid.Empty ? LayoutId : default!, - EditLayoutId = EditLayoutId != Guid.Empty ? EditLayoutId : default!, DetailLayoutId = DetailLayoutId != Guid.Empty ? DetailLayoutId : default!, Order = Order, AdminRoleIds = AdminRoleIds, @@ -58,7 +56,6 @@ public void Initialize(PageDetailResponse response) Path = response.Path ?? string.Empty; ParentId = response.ParentId; LayoutId = response.LayoutId; - EditLayoutId = response.EditLayoutId; DetailLayoutId = response.DetailLayoutId; Order = response.Order; AdminRoleIds = response.AdminRoleIds ?? []; @@ -89,7 +86,6 @@ public PageUpdateRequest ToUpdateRequest(Guid siteId, Guid pageId) Path = Path, ParentId = ParentId != Guid.Empty ? ParentId : default!, LayoutId = LayoutId != Guid.Empty ? LayoutId : default!, - EditLayoutId = EditLayoutId != Guid.Empty ? EditLayoutId : default!, DetailLayoutId = DetailLayoutId != Guid.Empty ? DetailLayoutId : default!, Order = Order, AdminRoleIds = AdminRoleIds, diff --git a/src/Frontend/FluentCMS.Web.UI/ServiceExtensions.cs b/src/Frontend/FluentCMS.Web.UI/ServiceExtensions.cs index 641d06e05..4536bacf6 100644 --- a/src/Frontend/FluentCMS.Web.UI/ServiceExtensions.cs +++ b/src/Frontend/FluentCMS.Web.UI/ServiceExtensions.cs @@ -86,7 +86,6 @@ private static IServiceCollection AddViewState(this IServiceCollection services) viewState.Page.Slug = pageResponse.Data.Slug; viewState.Layout = mapper.Map(page.Layout); viewState.DetailLayout = mapper.Map(page.DetailLayout); - viewState.EditLayout = mapper.Map(page.EditLayout); viewState.Site = mapper.Map(page.Site); viewState.Plugins = page.Sections!.Values.SelectMany(x => x).Select(p => mapper.Map(p)).ToList(); viewState.User = mapper.Map(page.User); @@ -107,15 +106,8 @@ private static IServiceCollection AddViewState(this IServiceCollection services) // check if the pluginId is valid if (Guid.TryParse(queryParams["pluginId"], out var pluginId)) { - // TODO: Decide when show edit and when show detail view - if (queryParams["viewMode"] == "detail") - { - viewState.Type = ViewStateType.PluginDetail; - } - else - { - viewState.Type = ViewStateType.PluginEdit; - } + viewState.Type = ViewStateType.PluginDetail; + viewState.Plugin = viewState.Plugins.Single(x => x.Id == pluginId); viewState.PluginViewName = queryParams["viewName"]; } diff --git a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/LayoutManagement/LayoutListPlugin.razor b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/LayoutManagement/LayoutListPlugin.razor index a92f17e76..186f0a642 100644 --- a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/LayoutManagement/LayoutListPlugin.razor +++ b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/LayoutManagement/LayoutListPlugin.razor @@ -13,7 +13,7 @@ @(context.ModifiedBy ?? string.Empty) @context.ModifiedAt - + diff --git a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/PageManagement/PageCreatePlugin.razor b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/PageManagement/PageCreatePlugin.razor index 2de1b1add..f4a6cb8e8 100644 --- a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/PageManagement/PageCreatePlugin.razor +++ b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/PageManagement/PageCreatePlugin.razor @@ -5,10 +5,9 @@ + - - diff --git a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/PageManagement/PageSettingsModel.cs b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/PageManagement/PageSettingsModel.cs index 8d1a9d579..d56b20de0 100644 --- a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/PageManagement/PageSettingsModel.cs +++ b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/PageManagement/PageSettingsModel.cs @@ -13,7 +13,6 @@ public class PageSettingsModel public Guid? ParentId { get; set; } = default; public Guid? LayoutId { get; set; } = default; - public Guid? EditLayoutId { get; set; } = default; public Guid? DetailLayoutId { get; set; } = default; [Required] @@ -41,7 +40,6 @@ public void Initialize(PageDetailResponse response) Path = response.Path ?? string.Empty; ParentId = response.ParentId; LayoutId = response.LayoutId; - EditLayoutId = response.EditLayoutId; DetailLayoutId = response.DetailLayoutId; Order = response.Order; AdminRoleIds = response.AdminRoleIds ?? []; @@ -71,7 +69,6 @@ public PageCreateRequest ToCreateRequest(Guid siteId) Path = Path, ParentId = ParentId != Guid.Empty ? ParentId : default!, LayoutId = LayoutId != Guid.Empty ? LayoutId : default!, - EditLayoutId = EditLayoutId != Guid.Empty ? EditLayoutId : default!, DetailLayoutId = DetailLayoutId != Guid.Empty ? DetailLayoutId : default!, Order = Order, AdminRoleIds = AdminRoleIds, @@ -89,7 +86,6 @@ public PageUpdateRequest ToUpdateRequest(Guid siteId, Guid pageId) Path = Path, ParentId = ParentId != Guid.Empty ? ParentId : default!, LayoutId = LayoutId != Guid.Empty ? LayoutId : default!, - EditLayoutId = EditLayoutId != Guid.Empty ? EditLayoutId : default!, DetailLayoutId = DetailLayoutId != Guid.Empty ? DetailLayoutId : default!, Order = Order, AdminRoleIds = AdminRoleIds, diff --git a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/PageManagement/PageUpdatePlugin.razor b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/PageManagement/PageUpdatePlugin.razor index 33847d6f1..b575075a0 100644 --- a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/PageManagement/PageUpdatePlugin.razor +++ b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/PageManagement/PageUpdatePlugin.razor @@ -5,10 +5,9 @@ + - - diff --git a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteListPlugin.razor b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteListPlugin.razor index 3e66a7ff4..ee00c42f0 100644 --- a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteListPlugin.razor +++ b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteListPlugin.razor @@ -23,9 +23,6 @@ @Layouts.Find(x => x.Id == context.DetailLayoutId)?.Name - - @Layouts.Find(x => x.Id == context.EditLayoutId)?.Name - diff --git a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteUpdateModel.cs b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteUpdateModel.cs index 0e7d7499c..5bc3bae70 100644 --- a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteUpdateModel.cs +++ b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteUpdateModel.cs @@ -7,7 +7,6 @@ public class SiteUpdateModel public string Description { get; set; } = default!; public Guid LayoutId { get; set; } public Guid DetailLayoutId { get; set; } - public Guid EditLayoutId { get; set; } public ICollection AdminRoleIds { get; set; } = []; public ICollection ContributorRoleIds { get; set; } = []; public string MetaTitle { get; set; } = default!; diff --git a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteUpdatePlugin.razor b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteUpdatePlugin.razor index d59ce206d..ac0ae7cb4 100644 --- a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteUpdatePlugin.razor +++ b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteUpdatePlugin.razor @@ -3,9 +3,8 @@ - + - diff --git a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteUpdatePlugin.razor.cs b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteUpdatePlugin.razor.cs index e10991be8..599cf1597 100644 --- a/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteUpdatePlugin.razor.cs +++ b/src/Frontend/Plugins/FluentCMS.Web.Plugins.Admin/SiteManagement/SiteUpdatePlugin.razor.cs @@ -104,7 +104,6 @@ private SiteUpdateModel GetSiteUpdateModel(SiteDetailResponse siteDetailResponse Description = siteDetailResponse.Description ?? string.Empty, LayoutId = siteDetailResponse.LayoutId, DetailLayoutId = siteDetailResponse.DetailLayoutId, - EditLayoutId = siteDetailResponse.EditLayoutId, AdminRoleIds = siteDetailResponse.AdminRoleIds!, ContributorRoleIds = siteDetailResponse.ContributorRoleIds!, MetaTitle = settings["MetaTitle"] ?? string.Empty, @@ -127,7 +126,6 @@ private SiteUpdateRequest GetSiteUpdateRequest() Description = Model.Description, LayoutId = Model.LayoutId, DetailLayoutId = Model.DetailLayoutId, - EditLayoutId = Model.EditLayoutId, AdminRoleIds = Model.AdminRoleIds, ContributorRoleIds = Model.ContributorRoleIds, Urls = [.. Model.Urls.Split(",")] diff --git a/src/Shared/ViewState.cs b/src/Shared/ViewState.cs index 041cc7754..002b1d7a7 100644 --- a/src/Shared/ViewState.cs +++ b/src/Shared/ViewState.cs @@ -7,7 +7,6 @@ public class ViewState : IDisposable public PageViewState Page { get; set; } = default!; public LayoutViewState Layout { get; set; } = default!; public LayoutViewState DetailLayout { get; set; } = default!; - public LayoutViewState EditLayout { get; set; } = default!; public List Plugins { get; set; } = default!; public UserViewState User { get; set; } = default!; public PluginViewState? Plugin { get; set; } @@ -38,7 +37,6 @@ public void Dispose() public enum ViewStateType { Default, - PluginEdit, PluginDetail, PagePreview, PageEdit