Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2199 Remove EditLayout from project #2202

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ public class Site : AuditableEntity
public List<string> Urls { get; set; } = [];
public Guid LayoutId { get; set; }
public Guid DetailLayoutId { get; set; }
public Guid EditLayoutId { get; set; }
}
2 changes: 1 addition & 1 deletion src/Backend/FluentCMS.Services/LayoutService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public async Task<Layout> 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) ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ public async Task Handle(Message<Layout> notification, CancellationToken cancell
page.DetailLayoutId = null;
await pageService.Update(page, cancellationToken);
}
if (page.EditLayoutId == layoutId)
{
page.EditLayoutId = null;
await pageService.Update(page, cancellationToken);
}
}
break;

Expand Down Expand Up @@ -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,
};
Expand Down
1 change: 0 additions & 1 deletion src/Backend/FluentCMS.Services/Models/PageTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PageTemplate> Children { get; set; } = [];
public List<PluginTemplate> Plugins { get; set; } = [];
public bool Locked { get; set; } = false;
Expand Down
1 change: 0 additions & 1 deletion src/Backend/FluentCMS.Services/Models/SiteTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public class SiteTemplate
public List<Layout> Layouts { get; set; } = [];
public List<Block> Blocks { get; set; } = [];
public string Layout { get; set; } = default!;
public string EditLayout { get; set; } = default!;
public string DetailLayout { get; set; } = default!;
public List<PageTemplate> Pages { get; set; } = [];
public List<string> AdminRoles { get; set; } = [];
Expand Down
1 change: 0 additions & 1 deletion src/Backend/FluentCMS.Services/SiteService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public async Task<Site> 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);
Expand Down
2 changes: 0 additions & 2 deletions src/Backend/FluentCMS.Web.Api/Controllers/PageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,13 @@ private async Task<PageFullDetailResponse> 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<PageFullDetailResponse>(page);
pageResponse.Site = mapper.Map<SiteDetailResponse>(site);
pageResponse.Site.AllRoles = mapper.Map<List<RoleDetailResponse>>(roles);
pageResponse.Site.Settings = siteSettings.Values;
pageResponse.Layout = mapper.Map<LayoutDetailResponse>(layoutsDict[layoutId]);
pageResponse.EditLayout = mapper.Map<LayoutDetailResponse>(layoutsDict[editLayoutId]);
pageResponse.DetailLayout = mapper.Map<LayoutDetailResponse>(layoutsDict[detailLayoutId]);
pageResponse.Sections = [];
pageResponse.Settings = pageSettings.Values;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Guid> ViewRoleIds { get; set; } = [];
public IEnumerable<Guid> AdminRoleIds { get; set; } = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, List<PluginDetailResponse>> Sections { get; set; } = [];
public bool Locked { get; set; } = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public class SiteDetailResponse : BaseAuditableResponse
public List<string> Urls { get; set; } = [];
public Guid LayoutId { get; set; }
public Guid DetailLayoutId { get; set; }
public Guid EditLayoutId { get; set; }
public IEnumerable<Guid> AdminRoleIds { get; set; } = [];
public IEnumerable<Guid> ContributorRoleIds { get; set; } = [];
public List<RoleDetailResponse> AllRoles { get; set; } = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public class SiteUpdateRequest
[Required]
public Guid DetailLayoutId { get; set; } = default!;

[Required]
public Guid EditLayoutId { get; set; } = default!;

[Required]
public List<Guid> ContributorRoleIds { get; set; } = [];

Expand Down
9 changes: 0 additions & 9 deletions src/FluentCMS/Templates/Blank/EditLayout.body.html

This file was deleted.

51 changes: 0 additions & 51 deletions src/FluentCMS/Templates/Blank/EditLayout.head.html

This file was deleted.

1 change: 0 additions & 1 deletion src/FluentCMS/Templates/Blank/EditLayout.html

This file was deleted.

18 changes: 0 additions & 18 deletions src/FluentCMS/Templates/Blank/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"Name": "FluentCMS Administration",
"Description": "FluentCMS blank site template",
"Layout": "DefaultLayout",
"EditLayout": "EditLayout",
"DetailLayout": "SingleLayout",
"AdminRoles": [ "Administrators" ],
"ContributorRoles": [ "Contributors" ],
Expand Down Expand Up @@ -43,9 +42,6 @@
{
"Name": "AuthLayout"
},
{
"Name": "EditLayout"
},
{
"Name": "SingleLayout"
}
Expand All @@ -54,15 +50,13 @@
{
"Title": "Home",
"Path": "/",
"EditLayout": "EditLayout",
"ViewRoles": [ "All Users" ],
"Plugins": []
},
{
"Title": "Admin",
"Path": "/admin",
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"AdminRoles": [ "Administrators" ],
"Locked": true,
"Plugins": [],
Expand All @@ -71,7 +65,6 @@
"Title": "Content Type Builder",
"Path": "/content-types",
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"AdminRoles": [ "Administrators" ],
"Locked": true,
"Plugins": [
Expand All @@ -86,7 +79,6 @@
"Title": "Users",
"Path": "/users",
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"AdminRoles": [ "Administrators" ],
"Locked": true,
"Plugins": [
Expand All @@ -101,7 +93,6 @@
"Title": "File Management",
"Path": "/files",
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"AdminRoles": [ "Administrators" ],
"Locked": true,
"Plugins": [
Expand All @@ -116,7 +107,6 @@
"Title": "Api Tokens",
"Path": "/api-tokens",
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"AdminRoles": [ "Administrators" ],
"Locked": true,
"Plugins": [
Expand All @@ -131,7 +121,6 @@
"Title": "Roles",
"Path": "/roles",
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"AdminRoles": [ "Administrators" ],
"Locked": true,
"Plugins": [
Expand All @@ -146,7 +135,6 @@
"Title": "Sites",
"Path": "/sites",
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"AdminRoles": [ "Administrators" ],
"Locked": true,
"Plugins": [
Expand All @@ -161,7 +149,6 @@
"Title": "Plugins",
"Path": "/plugins",
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"AdminRoles": [ "Administrators" ],
"Locked": true,
"Plugins": [
Expand All @@ -176,7 +163,6 @@
"Title": "Pages",
"Path": "/pages",
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"AdminRoles": [ "Administrators" ],
"Locked": true,
"Plugins": [
Expand All @@ -191,7 +177,6 @@
"Title": "Blocks",
"Path": "/blocks",
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"AdminRoles": [ "Administrators" ],
"Locked": true,
"Plugins": [
Expand All @@ -206,7 +191,6 @@
"Title": "Layouts",
"Path": "/layouts",
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"AdminRoles": [ "Administrators" ],
"Locked": true,
"Plugins": [
Expand All @@ -221,7 +205,6 @@
"Title": "GlobalSettings",
"Path": "/globalsettings",
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"AdminRoles": [ "Administrators" ],
"Locked": true,
"Plugins": [
Expand Down Expand Up @@ -307,7 +290,6 @@
"Path": "/profile",
"ViewRoles": [ "Authenticated Users" ],
"Layout": "AdminLayout",
"EditLayout": "AdminLayout",
"Locked": true,
"Plugins": [
{
Expand Down
9 changes: 0 additions & 9 deletions src/FluentCMS/Templates/Default/EditLayout.body.html

This file was deleted.

51 changes: 0 additions & 51 deletions src/FluentCMS/Templates/Default/EditLayout.head.html

This file was deleted.

1 change: 0 additions & 1 deletion src/FluentCMS/Templates/Default/EditLayout.html

This file was deleted.

Loading