Skip to content

Commit c0047b5

Browse files
authored
Merge pull request #21088 from abpframework/auto-merge/prerel-9-0/3085
Merge branch dev with prerel-9.0
2 parents 55599ca + c5c2520 commit c0047b5

File tree

20 files changed

+119
-4
lines changed

20 files changed

+119
-4
lines changed

docs/en/modules/cms-kit/marked-items.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,32 @@ The marking system provides a toggle widget to allow users to add/remove the mar
5858
* `entityId` should be the unique id of the product, in this example. If you have a Product entity, you can use its Id here.
5959
* `needsConfirmation` An optional parameter to let the user confirm when removing the mark.
6060

61+
### Filtering on Marked Items
62+
63+
Users can filter their marked items to easily find their favorites. Here's how to utilize the `GetEntityIdsFilteredByUserAsync` method to filter the user's marked items within your repository queries:
64+
65+
```csharp
66+
List<string> entityIdFilters = null;
67+
if (userId.HasValue)
68+
{
69+
entityIdFilters = await UserMarkedItemRepository.GetEntityIdsFilteredByUserAsync(
70+
userId.Value,
71+
entityType,
72+
cancellationToken: cancellationToken
73+
);
74+
}
75+
76+
var queryable = (await GetDbSetAsync())
77+
.WhereIf(entityIdFilters != null, x => entityIdFilters.Contains(x.Id.ToString()));
78+
79+
// Additional query logic...
80+
```
81+
82+
- `GetEntityIdsFilteredByUserAsync`: Retrieves a list of entity IDs marked by the user for the given entity type.
83+
- `userId`: The ID of the user performing the filtering.
84+
- `entityType`: The type of entity being filtered (e.g., "product").
85+
- `entityIdFilters`: A list of marked entity IDs that will be used to filter the items in the database.
86+
6187
# Internals
6288

6389
## Domain Layer

modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ public class CreatePageInputDto: ExtensibleObject
1717
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))]
1818
public string Slug { get; set; }
1919

20+
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxLayoutNameLength))]
21+
public string LayoutName { get; set; }
22+
2023
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxContentLength))]
2124
public string Content { get; set; }
2225

modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class PageDto : ExtensibleAuditedEntityDto<Guid>, IHasConcurrencyStamp
1111

1212
public string Slug { get; set; }
1313

14+
public string LayoutName { get; set; }
15+
1416
public string Content { get; set; }
1517

1618
public string Script { get; set; }

modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public class UpdatePageInputDto : ExtensibleObject, IHasConcurrencyStamp
1818
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))]
1919
public string Slug { get; set; }
2020

21+
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxLayoutNameLength))]
22+
public string LayoutName { get; set; }
23+
2124
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxContentLength))]
2225
public string Content { get; set; }
2326

modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public virtual async Task<PagedResultDto<PageDto>> GetListAsync(GetPagesInputDto
6262
[Authorize(CmsKitAdminPermissions.Pages.Create)]
6363
public virtual async Task<PageDto> CreateAsync(CreatePageInputDto input)
6464
{
65-
var page = await PageManager.CreateAsync(input.Title, input.Slug, input.Content, input.Script, input.Style);
65+
var page = await PageManager.CreateAsync(input.Title, input.Slug, input.Content, input.Script, input.Style, input.LayoutName);
6666
input.MapExtraPropertiesTo(page);
6767
await PageRepository.InsertAsync(page);
6868

@@ -88,6 +88,7 @@ public virtual async Task<PageDto> UpdateAsync(Guid id, UpdatePageInputDto input
8888
page.SetContent(input.Content);
8989
page.SetScript(input.Script);
9090
page.SetStyle(input.Style);
91+
page.SetLayoutName(input.LayoutName);
9192
page.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp);
9293
input.MapExtraPropertiesTo(page);
9394

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System.Collections.Generic;
2+
using Microsoft.AspNetCore.Mvc.Rendering;
3+
using Volo.Abp.AspNetCore.Mvc.UI.Theming;
4+
5+
namespace Volo.CmsKit.Admin.Web.Layouts;
6+
7+
public static class LayoutConstants
8+
{
9+
public const string Account = StandardLayouts.Account;
10+
public const string Public = StandardLayouts.Public;
11+
public const string Empty = StandardLayouts.Empty;
12+
public const string Application = StandardLayouts.Application;
13+
public static SelectList GetLayoutsSelectList()
14+
{
15+
return new SelectList(new List<string> { Account, Public, Empty, Application }, Application);
16+
}
17+
}

modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.Codemirror
1212
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor
1313
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.Uppy
14+
@using Volo.CmsKit.Admin.Web.Layouts
1415
@using Volo.CmsKit.Admin.Web.Pages
1516
@using Volo.CmsKit.Admin.Web.Menus
1617
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.Slugify
@@ -61,6 +62,8 @@
6162

6263
<abp-input asp-for="ViewModel.Slug" label-tooltip-icon="fa fa-info-circle" label-tooltip="@L["PageSlugInformation"]" />
6364

65+
<abp-select id="Layout" asp-for="ViewModel.LayoutName" asp-items="@LayoutConstants.GetLayoutsSelectList()" label="@L["SelectLayout"]"></abp-select>
66+
6467
<abp-input asp-for="@Model.ViewModel.Content" />
6568

6669
<abp-tabs tab-style="Tab">

modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public class CreatePageViewModel : ExtensibleObject
3939
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))]
4040
public string Title { get; set; }
4141

42+
[Required]
43+
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxLayoutNameLength))]
44+
public string LayoutName { get; set; }
45+
4246
[Required]
4347
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))]
4448
public string Slug { get; set; }

modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
@using Volo.Abp.Data
1616
@using Volo.Abp.Localization
1717
@using Volo.Abp.ObjectExtending
18+
@using Volo.CmsKit.Admin.Web.Layouts
1819
@using Volo.CmsKit.Admin.Web.Menus
1920
@using Volo.CmsKit.Admin.Web.Pages
2021
@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages
@@ -66,6 +67,8 @@
6667

6768
<abp-input asp-for="ViewModel.Slug" label-tooltip-icon="fa fa-info-circle" label-tooltip="@L["PageSlugInformation"]" />
6869

70+
<abp-select id="Layout" asp-for="ViewModel.LayoutName" asp-items="@LayoutConstants.GetLayoutsSelectList()" label="@L["SelectLayout"]"></abp-select>
71+
6972
<abp-input asp-for="@Model.ViewModel.Content" />
7073

7174
<abp-tabs tab-style="Tab">

modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public class UpdatePageViewModel : ExtensibleObject, IHasConcurrencyStamp
5656
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))]
5757
public string Slug { get; set; }
5858

59+
[Required]
60+
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxLayoutNameLength))]
61+
public string LayoutName { get; set; }
62+
5963
[HiddenInput]
6064
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))]
6165
public string Content { get; set; }

0 commit comments

Comments
 (0)