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

CMSKit - MenuItem & Page relation enhancements #18782

Merged
merged 26 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0e4fcca
Add FindTitleAsync to IPageRepository
enisn Jan 17, 2024
673adf1
Add tests for FindTitleAsync to IPageRepository
enisn Jan 17, 2024
b311372
Add MenuItemWithDetailsDto to IMenuItemAdminAppService
enisn Jan 17, 2024
fe86d1a
Update client-proxies
enisn Jan 17, 2024
1e9d537
Update CreateModal for MenuItem
enisn Jan 17, 2024
425333c
Update mappings for MenuItem UpdateModal
enisn Jan 17, 2024
f268bbf
Fix bug for unrelating menuitem with a page
enisn Jan 17, 2024
3a7998f
Update logic in MenuItem UpdateModal
enisn Jan 17, 2024
6c54e01
Add validation for MenuItem URL
enisn Jan 17, 2024
9115fb1
Handle CmsKit Page feature in Menu Items
enisn Jan 17, 2024
47c6406
Update localization on update modal
enisn Jan 17, 2024
73cac92
Add parent selector for select2
enisn Jan 17, 2024
0989098
Add test for unrelating Page from MenuItem
enisn Jan 17, 2024
dccf298
Fix the broken test
enisn Jan 17, 2024
84bae26
Update MenuItemAdminAppService.cs
enisn Jan 17, 2024
bf8c6cd
Fix broken test
enisn Jan 18, 2024
3e47be4
Fix MongoDB tests
enisn Jan 18, 2024
7cb99d0
Merge branch 'dev' into cmskit-menuitem-page-relation
enisn Jan 18, 2024
1c98a3b
Make Url of MenuItem as Required in DTOs
enisn Jan 19, 2024
df6061e
Merge branch 'dev' into cmskit-menuitem-page-relation
enisn Jan 19, 2024
9a94038
Merge branch 'dev' into cmskit-menuitem-page-relation
enisn Jan 22, 2024
2d69007
Update MenuItemAdminAppService_Tests.cs
enisn Jan 22, 2024
64e19ac
Fix parent-selector in create modal
enisn Jan 22, 2024
594b644
Remove [Required] attribute from MenuItem DTOs
enisn Jan 22, 2024
d3d7e1b
Add test-case for related page title
enisn Jan 23, 2024
2184b53
Fix FindTitleAsync return type
enisn Jan 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public interface IMenuItemAdminAppService : IApplicationService
{
Task<ListResultDto<MenuItemDto>> GetListAsync();

Task<MenuItemDto> GetAsync(Guid id);
Task<MenuItemWithDetailsDto> GetAsync(Guid id);

Task<MenuItemDto> CreateAsync(MenuItemCreateInput input);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;
using Volo.CmsKit.Menus;

namespace Volo.CmsKit.Admin.Menus;

[Serializable]
public class MenuItemWithDetailsDto : MenuItemDto
{
public string? PageTitle { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@ public CmsKitAdminApplicationAutoMapperProfile()
CreateMap<MediaDescriptor, MediaDescriptorDto>().MapExtraProperties();

CreateMap<MenuItem, MenuItemDto>().MapExtraProperties();
CreateMap<MenuItem, MenuItemWithDetailsDto>()
.Ignore(x => x.PageTitle)
.MapExtraProperties();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,17 @@ public virtual async Task<ListResultDto<MenuItemDto>> GetListAsync()
);
}

public virtual async Task<MenuItemDto> GetAsync(Guid id)
public virtual async Task<MenuItemWithDetailsDto> GetAsync(Guid id)
{
var menu = await MenuItemRepository.GetAsync(id);
return ObjectMapper.Map<MenuItem, MenuItemDto>(menu);
var menuItem = await MenuItemRepository.GetAsync(id);
var dto = ObjectMapper.Map<MenuItem, MenuItemWithDetailsDto>(menuItem);

if (menuItem.PageId.HasValue)
{
dto.PageTitle = await PageRepository.FindTitleAsync(menuItem.PageId.Value);
}

return dto;
}

[Authorize(CmsKitAdminPermissions.Menus.Create)]
Expand Down Expand Up @@ -87,7 +94,7 @@ public virtual async Task<MenuItemDto> UpdateAsync(Guid id, MenuItemUpdateInput
}
else
{
menuItem.SetUrl(input.Url);
MenuManager.SetPageUrl(menuItem, input.Url);
}

menuItem.SetDisplayName(input.DisplayName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public virtual async Task<ListResultDto<MenuItemDto>> GetListAsync()
return await RequestAsync<ListResultDto<MenuItemDto>>(nameof(GetListAsync));
}

public virtual async Task<MenuItemDto> GetAsync(Guid id)
public virtual async Task<MenuItemWithDetailsDto> GetAsync(Guid id)
{
return await RequestAsync<MenuItemDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
return await RequestAsync<MenuItemWithDetailsDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
Expand Down