From 86d89ebba52b99927f37ef9a592ed01d2b80d8e5 Mon Sep 17 00:00:00 2001 From: Necati Meral Date: Sat, 19 Mar 2022 20:44:44 +0100 Subject: [PATCH 01/38] Allow the exchange type to be specified --- .../RabbitMq/AbpRabbitMqEventBusOptions.cs | 20 ++++++++++++++++++- .../RabbitMq/RabbitMqDistributedEventBus.cs | 2 +- .../Volo/Abp/RabbitMQ/RabbitMqConsts.cs | 11 ++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs index ad09223f05..dd451d2127 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs @@ -1,10 +1,28 @@ -namespace Volo.Abp.EventBus.RabbitMq; +using Volo.Abp.RabbitMQ; + +namespace Volo.Abp.EventBus.RabbitMq; public class AbpRabbitMqEventBusOptions { + public const string DefaultExchangeType = RabbitMqConsts.ExchangeTypes.Direct; + public string ConnectionName { get; set; } public string ClientName { get; set; } public string ExchangeName { get; set; } + + public string ExchangeType { get; set; } + + public AbpRabbitMqEventBusOptions() + { + ExchangeType = "direct"; + } + + public string GetExchangeTypeOrDefault() + { + return string.IsNullOrEmpty(ExchangeType) + ? DefaultExchangeType + : ExchangeType; + } } diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs index c57d9e9417..38070ae7ce 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs @@ -69,7 +69,7 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe Consumer = MessageConsumerFactory.Create( new ExchangeDeclareConfiguration( AbpRabbitMqEventBusOptions.ExchangeName, - type: "direct", + type: AbpRabbitMqEventBusOptions.ExchangeType, durable: true ), new QueueDeclareConfiguration( diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConsts.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConsts.cs index 19b8ddb573..996e88959b 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConsts.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConsts.cs @@ -8,4 +8,15 @@ public static class RabbitMqConsts public const int Persistent = 2; } + + public static class ExchangeTypes + { + public const string Direct = "direct"; + + public const string Topic = "topic"; + + public const string Fanout = "fanout"; + + public const string Headers = "headers"; + } } From 5cfd2fa012817a521b12987ff68eec5ad5a6c5a6 Mon Sep 17 00:00:00 2001 From: Necati Meral Date: Sat, 19 Mar 2022 20:45:53 +0100 Subject: [PATCH 02/38] fix hardcoded reference --- .../Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs index 38070ae7ce..33663086c4 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs @@ -244,7 +244,7 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe { channel.ExchangeDeclare( AbpRabbitMqEventBusOptions.ExchangeName, - "direct", + AbpRabbitMqEventBusOptions.ExchangeType, durable: true ); From ff9ebdbcabbf0e3806644378a39d127bbccb882f Mon Sep 17 00:00:00 2001 From: Necati Meral Date: Sat, 19 Mar 2022 20:46:56 +0100 Subject: [PATCH 03/38] Update usage of default value --- .../Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs | 5 ----- .../Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs index dd451d2127..addbc49171 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs @@ -14,11 +14,6 @@ public class AbpRabbitMqEventBusOptions public string ExchangeType { get; set; } - public AbpRabbitMqEventBusOptions() - { - ExchangeType = "direct"; - } - public string GetExchangeTypeOrDefault() { return string.IsNullOrEmpty(ExchangeType) diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs index 33663086c4..a2932de52e 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs @@ -69,7 +69,7 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe Consumer = MessageConsumerFactory.Create( new ExchangeDeclareConfiguration( AbpRabbitMqEventBusOptions.ExchangeName, - type: AbpRabbitMqEventBusOptions.ExchangeType, + type: AbpRabbitMqEventBusOptions.GetExchangeTypeOrDefault(), durable: true ), new QueueDeclareConfiguration( @@ -244,7 +244,7 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe { channel.ExchangeDeclare( AbpRabbitMqEventBusOptions.ExchangeName, - AbpRabbitMqEventBusOptions.ExchangeType, + AbpRabbitMqEventBusOptions.GetExchangeTypeOrDefault(), durable: true ); From 59fed8a9ddb2b7fb2f6afb87aac04a740c3f9f69 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Tue, 22 Mar 2022 15:51:28 +0300 Subject: [PATCH 04/38] Update en.json --- .../Commercial/Localization/Resources/en.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json index 8fa96b5ee2..8aa62afbb4 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json @@ -495,7 +495,9 @@ "LicenseTypeNotCorrect": "The license type is not correct!", "Trainings": "Trainings", "ChoseTrainingPlaceholder": "Chose the training...", - "ContactUsToGetQuote": "Contact us to get a quote", + "DoYouNeedTrainings": "Do you need one of these trainings?", + "DoYouNeedTraining": "Do you need {0} training?", + "GetInTouchUs": "Get in touch with us", "ForMoreInformationClickHere": "For more information, click here.", "IsGetOnboardingTraining": "Would you like to get onboarding & web application development training?", "OnboardingWebApplicationDevelopmentTrainingMessage": "To schedule your training calendar, please contact {0} after creating the organization", From 31fafcfb6f18b07fec25657e61debaac41324832 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Mon, 14 Mar 2022 16:15:04 +0300 Subject: [PATCH 05/38] feat: user can set a variable on the environment without extending --- npm/ng-packs/packages/core/src/lib/models/environment.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/npm/ng-packs/packages/core/src/lib/models/environment.ts b/npm/ng-packs/packages/core/src/lib/models/environment.ts index 46596685b0..f48b9d4701 100644 --- a/npm/ng-packs/packages/core/src/lib/models/environment.ts +++ b/npm/ng-packs/packages/core/src/lib/models/environment.ts @@ -10,6 +10,9 @@ export interface Environment { oAuthConfig: AuthConfig; production: boolean; remoteEnv?: RemoteEnv; + customSettings?:{ + [key:string]: any; + } } export interface ApplicationInfo { From a4514167b5b3606b98a5770b71f9fc7dc4b683db Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Thu, 24 Mar 2022 10:07:30 +0300 Subject: [PATCH 06/38] Change Custom Settings to [key: string]:any in environment.ts --- npm/ng-packs/packages/core/src/lib/models/environment.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/models/environment.ts b/npm/ng-packs/packages/core/src/lib/models/environment.ts index f48b9d4701..062b1df82b 100644 --- a/npm/ng-packs/packages/core/src/lib/models/environment.ts +++ b/npm/ng-packs/packages/core/src/lib/models/environment.ts @@ -10,11 +10,8 @@ export interface Environment { oAuthConfig: AuthConfig; production: boolean; remoteEnv?: RemoteEnv; - customSettings?:{ - [key:string]: any; - } + [key:string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any } - export interface ApplicationInfo { name: string; baseUrl?: string; From ce61e6673e4f38f22b6ad2f611986cd6d089591a Mon Sep 17 00:00:00 2001 From: malik masis Date: Thu, 24 Mar 2022 17:36:03 +0300 Subject: [PATCH 07/38] Updated Distributed-Locking.md --- docs/en/Distributed-Locking.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/en/Distributed-Locking.md b/docs/en/Distributed-Locking.md index bea10645ca..4145a7fb1f 100644 --- a/docs/en/Distributed-Locking.md +++ b/docs/en/Distributed-Locking.md @@ -27,6 +27,10 @@ using Medallion.Threading.Redis; namespace AbpDemo { + [DependsOn( + typeof(AbpDistributedLockingModule) + //If you have the other dependencies, you should do here + )] public class MyModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) @@ -63,7 +67,7 @@ There are two ways to use the distributed locking API: ABP's `IAbpDistributedLoc **Example: Using the `IAbpDistributedLock.TryAcquireAsync` method** -````csharp + ````csharp using Volo.Abp.DistributedLocking; namespace AbpDemo From 8675f9d3e1aa3046622eb427959cd379f277a9c7 Mon Sep 17 00:00:00 2001 From: malik masis Date: Fri, 25 Mar 2022 09:21:05 +0300 Subject: [PATCH 08/38] Removed the unnecessary space --- docs/en/Distributed-Locking.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Distributed-Locking.md b/docs/en/Distributed-Locking.md index 4145a7fb1f..e3c57abdbd 100644 --- a/docs/en/Distributed-Locking.md +++ b/docs/en/Distributed-Locking.md @@ -67,7 +67,7 @@ There are two ways to use the distributed locking API: ABP's `IAbpDistributedLoc **Example: Using the `IAbpDistributedLock.TryAcquireAsync` method** - ````csharp +````csharp using Volo.Abp.DistributedLocking; namespace AbpDemo From 4a78cc14b5c0bb6abca19bb4cbe60e212b4cd9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 25 Mar 2022 09:37:39 +0300 Subject: [PATCH 09/38] Update discord server link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d7b7e51a7..ebba20da41 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Love ABP Framework? **Please give a star** to this repository :star: ## Discord Channel -You can use this link to join the ABP Community Discord Server: https://discord.gg/uVGt6hyhcm +You can use this link to join the ABP Community Discord Server: https://discord.gg/abp ## ABP Commercial From dca9f2965bcca342c226dc8a6cc302ee311aa76c Mon Sep 17 00:00:00 2001 From: Engincan VESKE Date: Fri, 25 Mar 2022 09:45:29 +0300 Subject: [PATCH 10/38] Add new localizations for admin website --- .../AbpIoLocalization/Admin/Localization/Resources/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index 023a4b18ed..9f8e88f180 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -380,6 +380,7 @@ "PurchaseItems": "Purchase Items", "SuccessfullyUpdated": "Successfully updated", "SuccessfullyAdded": "Successfully added", - "PurchaseState": "Purchase State" + "PurchaseState": "Purchase State", + "ShowBetweenDayCount": "Show Between Days" } } \ No newline at end of file From 8686e396fa25d881757b7ee0fbdcafed05c4c03a Mon Sep 17 00:00:00 2001 From: malik masis Date: Fri, 25 Mar 2022 09:49:51 +0300 Subject: [PATCH 11/38] Made code formatting --- docs/en/Distributed-Locking.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/en/Distributed-Locking.md b/docs/en/Distributed-Locking.md index e3c57abdbd..d57fd45c83 100644 --- a/docs/en/Distributed-Locking.md +++ b/docs/en/Distributed-Locking.md @@ -31,21 +31,21 @@ namespace AbpDemo typeof(AbpDistributedLockingModule) //If you have the other dependencies, you should do here )] - public class MyModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - - context.Services.AddSingleton(sp => - { - var connection = ConnectionMultiplexer + public class MyModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + + context.Services.AddSingleton(sp => + { + var connection = ConnectionMultiplexer .Connect(configuration["Redis:Configuration"]); - return new + return new RedisDistributedSynchronizationProvider(connection.GetDatabase()); - }); - } - } + }); + } + } } ```` From 450817c300b145b871e52a36c7eabb476c1e9818 Mon Sep 17 00:00:00 2001 From: Engincan VESKE Date: Fri, 25 Mar 2022 12:57:38 +0300 Subject: [PATCH 12/38] Update DatabaseManagementSystemChangeStep.cs --- .../Steps/DatabaseManagementSystemChangeStep.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/DatabaseManagementSystemChangeStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/DatabaseManagementSystemChangeStep.cs index 062868a99c..f014942486 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/DatabaseManagementSystemChangeStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/DatabaseManagementSystemChangeStep.cs @@ -81,12 +81,12 @@ public class DatabaseManagementSystemChangeStep : ProjectBuildPipelineStep private void ChangeEntityFrameworkCoreDependency(ProjectBuildContext context, string newPackageName, string newModuleNamespace, string newModuleClass) { - var efCoreProjectFile = context.Files.First(f => f.Name.EndsWith("EntityFrameworkCore.csproj", StringComparison.OrdinalIgnoreCase)); - efCoreProjectFile.ReplaceText("Volo.Abp.EntityFrameworkCore.SqlServer", newPackageName); + var efCoreProjectFile = context.Files.FirstOrDefault(f => f.Name.EndsWith("EntityFrameworkCore.csproj", StringComparison.OrdinalIgnoreCase)); + efCoreProjectFile?.ReplaceText("Volo.Abp.EntityFrameworkCore.SqlServer", newPackageName); - var efCoreModuleClass = context.Files.First(f => f.Name.EndsWith("EntityFrameworkCoreModule.cs", StringComparison.OrdinalIgnoreCase)); - efCoreModuleClass.ReplaceText("Volo.Abp.EntityFrameworkCore.SqlServer", newModuleNamespace); - efCoreModuleClass.ReplaceText("AbpEntityFrameworkCoreSqlServerModule", newModuleClass); + var efCoreModuleClass = context.Files.FirstOrDefault(f => f.Name.EndsWith("EntityFrameworkCoreModule.cs", StringComparison.OrdinalIgnoreCase)); + efCoreModuleClass?.ReplaceText("Volo.Abp.EntityFrameworkCore.SqlServer", newModuleNamespace); + efCoreModuleClass?.ReplaceText("AbpEntityFrameworkCoreSqlServerModule", newModuleClass); } private void ChangeUseSqlServer(ProjectBuildContext context, string newUseMethodForEfModule, string newUseMethodForDbContext = null) From ff7dbe113d31558b294c6fd09a49c215d5de574b Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Fri, 25 Mar 2022 20:37:20 +0800 Subject: [PATCH 13/38] Do not add default dom when customizing dom --- .../datatables/datatables-extensions.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js index b9bcde13e1..f87b7c27b1 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js @@ -431,9 +431,7 @@ var abp = abp || {}; configuration.language = datatables.defaultConfigurations.language(); - if(configuration.dom){ - configuration.dom += datatables.defaultConfigurations.dom; - }else{ + if(!configuration.dom){ configuration.dom = datatables.defaultConfigurations.dom; } From 4784e3e7656faae625560e2de2f922ec93e4908b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 25 Mar 2022 16:24:25 +0300 Subject: [PATCH 14/38] Get user's name, surname and phone number from external login, if available. --- .../Claims/AbpClaimActionCollectionExtensions.cs | 14 ++++++++++++++ .../Pages/Account/Login.cshtml.cs | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Microsoft/AspNetCore/Authentication/OAuth/Claims/AbpClaimActionCollectionExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Microsoft/AspNetCore/Authentication/OAuth/Claims/AbpClaimActionCollectionExtensions.cs index 01dc489c54..2aedea2608 100644 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Microsoft/AspNetCore/Authentication/OAuth/Claims/AbpClaimActionCollectionExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Microsoft/AspNetCore/Authentication/OAuth/Claims/AbpClaimActionCollectionExtensions.cs @@ -13,6 +13,20 @@ public static class AbpClaimActionCollectionExtensions claimActions.DeleteClaim("name"); claimActions.RemoveDuplicate(AbpClaimTypes.UserName); } + + if (AbpClaimTypes.Name != "given_name") + { + claimActions.MapJsonKey(AbpClaimTypes.Name, "given_name"); + claimActions.DeleteClaim("given_name"); + claimActions.RemoveDuplicate(AbpClaimTypes.Name); + } + + if (AbpClaimTypes.SurName != "family_name") + { + claimActions.MapJsonKey(AbpClaimTypes.SurName, "family_name"); + claimActions.DeleteClaim("family_name"); + claimActions.RemoveDuplicate(AbpClaimTypes.SurName); + } if (AbpClaimTypes.Email != "email") { diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs index fe94f47415..5ec85d4078 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs @@ -277,6 +277,18 @@ public class LoginModel : AccountPageModel CheckIdentityErrors(await UserManager.SetEmailAsync(user, emailAddress)); CheckIdentityErrors(await UserManager.AddLoginAsync(user, info)); CheckIdentityErrors(await UserManager.AddDefaultRolesAsync(user)); + + user.Name = info.Principal.FindFirstValue(AbpClaimTypes.Name); + user.Surname = info.Principal.FindFirstValue(AbpClaimTypes.SurName); + + var phoneNumber = info.Principal.FindFirstValue(AbpClaimTypes.PhoneNumber); + if (!phoneNumber.IsNullOrWhiteSpace()) + { + var phoneNumberConfirmed = string.Equals(info.Principal.FindFirstValue(AbpClaimTypes.PhoneNumberVerified), "true", StringComparison.InvariantCultureIgnoreCase); + user.SetPhoneNumber(phoneNumber, phoneNumberConfirmed); + } + + await UserManager.UpdateAsync(user); return user; } From 973b5789c8cabc211298f65a3b7f3ae6ba9b816f Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Fri, 25 Mar 2022 17:38:43 +0300 Subject: [PATCH 15/38] move changes to dev based branch moved from https://github.com/abpframework/abp/pull/12064 --- .../Admin/Blogs/IBlogPostAdminAppService.cs | 2 ++ .../Admin/Blogs/BlogPostAdminAppService.cs | 23 +++++++++++++++++-- .../BlogPostAdminClientProxy.Generated.cs | 8 +++++++ .../Admin/Blogs/BlogPostAdminController.cs | 8 +++++++ .../Pages/CmsKit/BlogPosts/Update.cshtml | 18 +++++++++------ .../Pages/CmsKit/BlogPosts/update.js | 18 ++++++++++++++- .../client-proxies/cms-kit-admin-proxy.js | 8 +++++++ .../CmsKit/Localization/Resources/en.json | 3 ++- .../CmsKit/Localization/Resources/tr.json | 3 ++- 9 files changed, 79 insertions(+), 12 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs index 314b7a1def..23562020d4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using Volo.Abp.Application.Services; namespace Volo.CmsKit.Admin.Blogs; @@ -12,4 +13,5 @@ public interface IBlogPostAdminAppService CreateBlogPostDto, UpdateBlogPostDto> { + Task RemoveCoverImageAsync(Guid id); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs index 83899199f0..d463f8dcb1 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs @@ -6,6 +6,7 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Data; using Volo.Abp.GlobalFeatures; using Volo.Abp.Users; +using Volo.CmsKit.Admin.MediaDescriptors; using Volo.CmsKit.Blogs; using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Permissions; @@ -22,16 +23,20 @@ public class BlogPostAdminAppService : CmsKitAppServiceBase, IBlogPostAdminAppSe protected IBlogRepository BlogRepository { get; } protected ICmsUserLookupService UserLookupService { get; } + protected IMediaDescriptorAdminAppService MediaDescriptorAdminAppService { get; } + public BlogPostAdminAppService( BlogPostManager blogPostManager, IBlogPostRepository blogPostRepository, IBlogRepository blogRepository, - ICmsUserLookupService userLookupService) + ICmsUserLookupService userLookupService, + IMediaDescriptorAdminAppService mediaDescriptorAdminAppService) { BlogPostManager = blogPostManager; BlogPostRepository = blogPostRepository; BlogRepository = blogRepository; UserLookupService = userLookupService; + MediaDescriptorAdminAppService = mediaDescriptorAdminAppService; } [Authorize(CmsKitAdminPermissions.BlogPosts.Create)] @@ -109,4 +114,18 @@ public class BlogPostAdminAppService : CmsKitAppServiceBase, IBlogPostAdminAppSe { await BlogPostRepository.DeleteAsync(id); } -} + + [Authorize(CmsKitAdminPermissions.BlogPosts.Update)] + public virtual async Task RemoveCoverImageAsync(Guid id) + { + var blogPost = await BlogPostRepository.GetAsync(id); + if (blogPost?.CoverImageMediaId == null) + { + return; + } + + await MediaDescriptorAdminAppService.DeleteAsync(blogPost.CoverImageMediaId.Value); + + blogPost.CoverImageMediaId = null; + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/BlogPostAdminClientProxy.Generated.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/BlogPostAdminClientProxy.Generated.cs index 560ba4e2de..0f201fb469 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/BlogPostAdminClientProxy.Generated.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/BlogPostAdminClientProxy.Generated.cs @@ -55,4 +55,12 @@ public partial class BlogPostAdminClientProxy : ClientProxyBase
- @if (Model.ViewModel.CoverImageMediaId != null) - { - -
- } - - +
+ @if (Model.ViewModel.CoverImageMediaId != null) + { + +
+ +
+ } +
+ +
diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js index 5902dc111b..65e9c89146 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js @@ -10,6 +10,7 @@ $(function () { var $blogPostIdInput = $('#Id'); var $tagsInput = $('.tag-editor-form input[name=tags]'); var $fileInput = $('#BlogPostCoverImage'); + var $buttonRemoveCoverImage = $('#button-remove-cover-image'); var UPPY_FILE_ID = "uppy-upload-file"; @@ -152,7 +153,6 @@ $(function () { } } - // ----------------------------------- var fileUploadUri = "/api/cms-kit-admin/media/blogpost"; var fileUriPrefix = "/api/cms-kit/media/"; @@ -225,4 +225,20 @@ $(function () { } }); } + + $buttonRemoveCoverImage.on('click', function () { + abp.message.confirm( + l('RemoveCoverImageConfirmationMessage'), + function (isConfirmed) { + if (isConfirmed) { + volo.cmsKit.admin.blogs.blogPostAdmin + .removeCoverImage($blogPostIdInput.val()) + .then(function () { + $coverImage.val(null); + $('#CurrentCoverImageArea').remove(); + }); + } + } + ); + }); }); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js index 0a1424d92a..9bce6416a3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js @@ -391,6 +391,14 @@ }, ajaxParams)); }; + volo.cmsKit.admin.blogs.blogPostAdmin.removeCoverImage = function(id, ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/cms-kit-admin/blogs/blog-posts/removeCoverImage/' + id + '', + type: 'DELETE', + dataType: null + }, ajaxParams)); + }; + })(); })(); diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 0dd826480d..8cbd7ef946 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -164,6 +164,7 @@ "GlobalResources": "Global Resources", "Script": "Script", "Style": "Style", - "SavedSuccessfully": "Saved successfully" + "SavedSuccessfully": "Saved successfully", + "RemoveCoverImageConfirmationMessage": "Are you sure to remove the cover image?" } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json index 95ef414c17..90b10f153c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json @@ -163,6 +163,7 @@ "GlobalResources": "Global Kaynaklar", "Script": "Script", "Style": "Style", - "SavedSuccessfully": "Başarıyla kaydedildi" + "SavedSuccessfully": "Başarıyla kaydedildi", + "RemoveCoverImageConfirmationMessage": "Kapak resmini kaldırmak istediğinize emin misiniz?" } } From f08f00ad279d0fe299f5d377e914f48759213ca5 Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Fri, 25 Mar 2022 17:44:16 +0300 Subject: [PATCH 16/38] change route requested in https://github.com/abpframework/abp/pull/12064#discussion_r835134372 --- .../Volo/CmsKit/Admin/Blogs/BlogPostAdminController.cs | 2 +- .../wwwroot/client-proxies/cms-kit-admin-proxy.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Blogs/BlogPostAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Blogs/BlogPostAdminController.cs index 5492633078..0dbf8ec10d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Blogs/BlogPostAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Blogs/BlogPostAdminController.cs @@ -63,7 +63,7 @@ public class BlogPostAdminController : CmsKitAdminController, IBlogPostAdminAppS } [HttpDelete] - [Route("removeCoverImage/{id}")] + [Route("{id}/cover-image")] [Authorize(CmsKitAdminPermissions.BlogPosts.Update)] public Task RemoveCoverImageAsync(Guid id) { diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js index 9bce6416a3..2cb7d2ab98 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js @@ -393,7 +393,7 @@ volo.cmsKit.admin.blogs.blogPostAdmin.removeCoverImage = function(id, ajaxParams) { return abp.ajax($.extend(true, { - url: abp.appPath + 'api/cms-kit-admin/blogs/blog-posts/removeCoverImage/' + id + '', + url: abp.appPath + 'api/cms-kit-admin/blogs/blog-posts/' + id + '/cover-image', type: 'DELETE', dataType: null }, ajaxParams)); From 484e4952dba54aeba09d62c83fc1c160c749a42d Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Fri, 25 Mar 2022 17:46:47 +0300 Subject: [PATCH 17/38] add localization --- .../Volo/CmsKit/Localization/Resources/en.json | 3 ++- .../Volo/CmsKit/Localization/Resources/tr.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 8cbd7ef946..43f620bfd9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -165,6 +165,7 @@ "Script": "Script", "Style": "Style", "SavedSuccessfully": "Saved successfully", - "RemoveCoverImageConfirmationMessage": "Are you sure to remove the cover image?" + "RemoveCoverImageConfirmationMessage": "Are you sure to remove the cover image?", + "RemoveCoverImage": "Remove the cover image" } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json index 90b10f153c..527e119a2e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json @@ -164,6 +164,7 @@ "Script": "Script", "Style": "Style", "SavedSuccessfully": "Başarıyla kaydedildi", - "RemoveCoverImageConfirmationMessage": "Kapak resmini kaldırmak istediğinize emin misiniz?" + "RemoveCoverImageConfirmationMessage": "Kapak resmini kaldırmak istediğinize emin misiniz?", + "RemoveCoverImage": "Kapak resmini kaldır" } } From a38d0001456975cf10422d5df2399560bc38d763 Mon Sep 17 00:00:00 2001 From: Musa Demir <48536631+demirmusa@users.noreply.github.com> Date: Fri, 25 Mar 2022 18:58:17 +0300 Subject: [PATCH 18/38] use form select for select item --- .../Pages/Public/CmsKit/Blogs/Index.cshtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml index dbc0d699ef..4ae3c007c7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml @@ -25,7 +25,7 @@
- @foreach (var author in Model.Authors) { @@ -76,4 +76,4 @@ - \ No newline at end of file + From a23509a3be61360e3d762bf5bdd6189807af4ed5 Mon Sep 17 00:00:00 2001 From: Roc Date: Mon, 28 Mar 2022 02:32:28 +0800 Subject: [PATCH 19/38] Update CultureHelper.cs --- .../src/Volo.Abp.Core/Volo/Abp/Localization/CultureHelper.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Localization/CultureHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Localization/CultureHelper.cs index d4d4a5bed0..dded0d794e 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Localization/CultureHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Localization/CultureHelper.cs @@ -57,8 +57,6 @@ public static class CultureHelper public static string GetBaseCultureName(string cultureName) { - return cultureName.Contains("-") - ? cultureName.Left(cultureName.IndexOf("-", StringComparison.Ordinal)) - : cultureName; + return new CultureInfo(cultureName).Parent.Name; } } From 5fac9c9d1d06db94212f27c99e7e4c7503e56d6b Mon Sep 17 00:00:00 2001 From: Roc Date: Mon, 28 Mar 2022 02:35:31 +0800 Subject: [PATCH 20/38] Update AbpLocalization_Tests.cs --- .../Abp/Localization/AbpLocalization_Tests.cs | 56 ++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/AbpLocalization_Tests.cs b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/AbpLocalization_Tests.cs index b8375485f7..6c4bdfff08 100644 --- a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/AbpLocalization_Tests.cs +++ b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/AbpLocalization_Tests.cs @@ -1,4 +1,4 @@ -using System.Globalization; +using System.Globalization; using System.Linq; using Microsoft.Extensions.Localization; using Shouldly; @@ -183,6 +183,60 @@ public class AbpLocalization_Tests : AbpIntegratedTest Date: Mon, 28 Mar 2022 09:37:27 +0300 Subject: [PATCH 21/38] CmsKit - Add AutoComplete Select for Author filtering --- .../Volo/CmsKit/Blogs/IBlogPostRepository.cs | 11 +- .../CmsKit/Blogs/EfCoreBlogPostRepository.cs | 27 ++- .../MongoDB/Blogs/MongoBlogPostRepository.cs | 31 ++- ...tFilteredPagedAndSortedResultRequestDto.cs | 8 + .../Public/Blogs/IBlogPostPublicAppService.cs | 7 +- .../Public/Blogs/BlogPostPublicAppService.cs | 19 +- .../BlogPostPublicClientProxy.Generated.cs | 18 +- ...obalResourcePublicClientProxy.Generated.cs | 27 +++ .../GlobalResourcePublicClientProxy.cs | 7 + .../ClientProxies/cms-kit-generate-proxy.json | 190 +++++++++++++++++- .../Public/Blogs/BlogPostPublicController.cs | 11 +- .../Pages/Public/CmsKit/Blogs/Index.cshtml | 26 +-- .../Pages/Public/CmsKit/Blogs/Index.cshtml.cs | 14 +- 13 files changed, 353 insertions(+), 43 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostFilteredPagedAndSortedResultRequestDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.Generated.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs index fed0eed037..16c4f066a3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs @@ -28,5 +28,14 @@ public interface IBlogPostRepository : IBasicRepository Task GetBySlugAsync(Guid blogId, string slug, CancellationToken cancellationToken = default); - Task> GetAuthorsHasBlogPosts(CancellationToken cancellationToken = default); + Task> GetAuthorsHasBlogPostsAsync( + int skipCount, + int maxResultCount, + string sorting, + string filter, + CancellationToken cancellationToken = default); + + Task GetAuthorsHasBlogPostsCountAsync(string filter, CancellationToken cancellationToken = default); + + Task GetAuthorHasBlogPostAsync(Guid id, CancellationToken cancellationToken = default); } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs index cfc39a62c7..b7fce01be6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs @@ -7,6 +7,7 @@ using System.Linq.Dynamic.Core; using System.Threading; using System.Threading.Tasks; using Volo.Abp; +using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.CmsKit.EntityFrameworkCore; @@ -100,9 +101,31 @@ public class EfCoreBlogPostRepository : EfCoreRepository> GetAuthorsHasBlogPosts(CancellationToken cancellationToken = default) + public async Task> GetAuthorsHasBlogPostsAsync(int skipCount, int maxResultCount, string sorting, string filter, CancellationToken cancellationToken = default) { - return await (await GetDbContextAsync()).BlogPosts.Select(x => x.Author).Distinct() + return await (await CreateAuthorsQueryableAsync()) + .Skip(skipCount) + .Take(maxResultCount) + .WhereIf(!filter.IsNullOrEmpty(), x => x.UserName.Contains(filter.ToLower())) + .OrderBy(sorting.IsNullOrEmpty() ? nameof(CmsUser.UserName) : sorting) .ToListAsync(GetCancellationToken(cancellationToken)); } + + public async Task GetAuthorsHasBlogPostsCountAsync(string filter, CancellationToken cancellationToken = default) + { + return await (await CreateAuthorsQueryableAsync()) + .WhereIf(!filter.IsNullOrEmpty(), x => x.UserName.Contains(filter.ToLower())) + .CountAsync(GetCancellationToken(cancellationToken)); + } + + public async Task GetAuthorHasBlogPostAsync(Guid id, CancellationToken cancellationToken = default) + { + return await (await CreateAuthorsQueryableAsync()).FirstOrDefaultAsync(x => x.Id == id, GetCancellationToken(cancellationToken)) + ?? throw new EntityNotFoundException(typeof(CmsUser), id); + } + + private async Task> CreateAuthorsQueryableAsync() + { + return (await GetDbContextAsync()).BlogPosts.Select(x => x.Author).Distinct(); + } } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs index 1db7fee75e..84570810cd 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs @@ -8,6 +8,7 @@ using System.Linq.Dynamic.Core; using System.Threading; using System.Threading.Tasks; using Volo.Abp; +using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; using Volo.CmsKit.Blogs; @@ -105,13 +106,37 @@ public class MongoBlogPostRepository : MongoDbRepository x.BlogId == blogId && x.Slug.ToLower() == slug, cancellationToken); } - public async Task> GetAuthorsHasBlogPosts(CancellationToken cancellationToken = default) + public async Task> GetAuthorsHasBlogPostsAsync(int skipCount, int maxResultCount, string sorting, string filter, CancellationToken cancellationToken = default) + { + var queryable = (await CreateAuthorsQueryableAsync()) + .Skip(skipCount) + .Take(maxResultCount) + .OrderBy(sorting.IsNullOrEmpty() ? nameof(CmsUser.UserName) : sorting) + .WhereIf(!filter.IsNullOrEmpty(), x => x.UserName.Contains(filter.ToLower())); + + return await AsyncExecuter.ToListAsync(queryable, GetCancellationToken(cancellationToken)); + } + + public async Task GetAuthorsHasBlogPostsCountAsync(string filter, CancellationToken cancellationToken = default) + { + return await AsyncExecuter.CountAsync( + (await CreateAuthorsQueryableAsync()) + .WhereIf(!filter.IsNullOrEmpty(), x => x.UserName.Contains(filter.ToLower()))); + } + + public async Task GetAuthorHasBlogPostAsync(Guid id, CancellationToken cancellationToken = default) + { + return await AsyncExecuter.FirstOrDefaultAsync(await CreateAuthorsQueryableAsync(), x => x.Id == id) + ?? throw new EntityNotFoundException(typeof(CmsUser), id); + } + + private async Task> CreateAuthorsQueryableAsync() { var blogPostQueryable = (await GetQueryableAsync()); var usersQueryable = (await GetDbContextAsync()).Collection().AsQueryable(); - var queryable = blogPostQueryable + return blogPostQueryable .Join( usersQueryable, o => o.AuthorId, @@ -119,7 +144,5 @@ public class MongoBlogPostRepository : MongoDbRepository new { blogPost, user }) .Select(s => s.user) .Distinct(); - - return await AsyncExecuter.ToListAsync(queryable, GetCancellationToken(cancellationToken)); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostFilteredPagedAndSortedResultRequestDto.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostFilteredPagedAndSortedResultRequestDto.cs new file mode 100644 index 0000000000..cb930ea37c --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostFilteredPagedAndSortedResultRequestDto.cs @@ -0,0 +1,8 @@ +using Volo.Abp.Application.Dtos; + +namespace Volo.CmsKit.Public.Blogs; + +public class BlogPostFilteredPagedAndSortedResultRequestDto : PagedAndSortedResultRequestDto +{ + public string Filter { get; set; } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs index 02b6d2a5f4..42161f884c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.CmsKit.Users; +using System; namespace Volo.CmsKit.Public.Blogs; @@ -12,6 +13,8 @@ public interface IBlogPostPublicAppService : IApplicationService Task> GetListAsync([NotNull] string blogSlug, BlogPostGetListInput input); Task GetAsync([NotNull] string blogSlug, [NotNull] string blogPostSlug); - - Task> GetAuthorsHasBlogPostsAsync(); + + Task> GetAuthorsHasBlogPostsAsync(BlogPostFilteredPagedAndSortedResultRequestDto input); + + Task GetAuthorHasBlogPostAsync(Guid id); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs index a9121a5c2b..fc9da1bffb 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs @@ -1,4 +1,5 @@ using JetBrains.Annotations; +using System; using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; @@ -15,7 +16,6 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub protected IBlogRepository BlogRepository { get; } protected IBlogPostRepository BlogPostRepository { get; } - public BlogPostPublicAppService( IBlogRepository blogRepository, @@ -46,9 +46,20 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub ObjectMapper.Map, List>(blogPosts)); } - public virtual async Task> GetAuthorsHasBlogPostsAsync() + public virtual async Task> GetAuthorsHasBlogPostsAsync(BlogPostFilteredPagedAndSortedResultRequestDto input) { - var authors = await BlogPostRepository.GetAuthorsHasBlogPosts(); - return ObjectMapper.Map, List>(authors); + var authors = await BlogPostRepository.GetAuthorsHasBlogPostsAsync(input.SkipCount, input.MaxResultCount, input.Sorting, input.Filter); + var authorDtos = ObjectMapper.Map, List>(authors); + + return new PagedResultDto( + await BlogPostRepository.GetAuthorsHasBlogPostsCountAsync(input.Filter), + authorDtos); + } + + public async Task GetAuthorHasBlogPostAsync(Guid id) + { + var author = await BlogPostRepository.GetAuthorHasBlogPostAsync(id); + + return ObjectMapper.Map(author); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs index 9cc926515d..b1bbf6be07 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs @@ -1,6 +1,5 @@ // This file is automatically generated by ABP framework to use MVC Controllers from CSharp using System; -using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Http.Client; @@ -25,7 +24,7 @@ public partial class BlogPostPublicClientProxy : ClientProxyBase> GetListAsync(string blogSlug, BlogPostGetListInput input) { return await RequestAsync>(nameof(GetListAsync), new ClientProxyRequestTypeValue @@ -35,8 +34,19 @@ public partial class BlogPostPublicClientProxy : ClientProxyBase> GetAuthorsHasBlogPostsAsync() + public virtual async Task> GetAuthorsHasBlogPostsAsync(BlogPostFilteredPagedAndSortedResultRequestDto input) + { + return await RequestAsync>(nameof(GetAuthorsHasBlogPostsAsync), new ClientProxyRequestTypeValue + { + { typeof(BlogPostFilteredPagedAndSortedResultRequestDto), input } + }); + } + + public virtual async Task GetAuthorHasBlogPostAsync(Guid id) { - return await RequestAsync>(nameof(GetAuthorsHasBlogPostsAsync)); + return await RequestAsync(nameof(GetAuthorHasBlogPostAsync), new ClientProxyRequestTypeValue + { + { typeof(Guid), id } + }); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.Generated.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.Generated.cs new file mode 100644 index 0000000000..d7354b9e87 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.Generated.cs @@ -0,0 +1,27 @@ +// This file is automatically generated by ABP framework to use MVC Controllers from CSharp +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Http.Client; +using Volo.Abp.Http.Modeling; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Http.Client.ClientProxying; +using Volo.CmsKit.Public.GlobalResources; + +// ReSharper disable once CheckNamespace +namespace Volo.CmsKit.Public.GlobalResources.ClientProxies; + +[Dependency(ReplaceServices = true)] +[ExposeServices(typeof(IGlobalResourcePublicAppService), typeof(GlobalResourcePublicClientProxy))] +public partial class GlobalResourcePublicClientProxy : ClientProxyBase, IGlobalResourcePublicAppService +{ + public virtual async Task GetGlobalScriptAsync() + { + return await RequestAsync(nameof(GetGlobalScriptAsync)); + } + + public virtual async Task GetGlobalStyleAsync() + { + return await RequestAsync(nameof(GetGlobalStyleAsync)); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.cs new file mode 100644 index 0000000000..76549aec1e --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.cs @@ -0,0 +1,7 @@ +// This file is part of GlobalResourcePublicClientProxy, you can customize it here +// ReSharper disable once CheckNamespace +namespace Volo.CmsKit.Public.GlobalResources.ClientProxies; + +public partial class GlobalResourcePublicClientProxy +{ +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json index 0387176b02..d39e795845 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json @@ -7,6 +7,8 @@ "Volo.CmsKit.Public.Tags.TagPublicController": { "controllerName": "TagPublic", "controllerGroupName": "TagPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Tags.TagPublicController", "interfaces": [ { @@ -76,6 +78,8 @@ "Volo.CmsKit.Public.Reactions.ReactionPublicController": { "controllerName": "ReactionPublic", "controllerGroupName": "ReactionPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Reactions.ReactionPublicController", "interfaces": [ { @@ -299,6 +303,8 @@ "Volo.CmsKit.Public.Ratings.RatingPublicController": { "controllerName": "RatingPublic", "controllerGroupName": "RatingPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Ratings.RatingPublicController", "interfaces": [ { @@ -502,6 +508,8 @@ "Volo.CmsKit.Public.Pages.PagesPublicController": { "controllerName": "PagesPublic", "controllerGroupName": "PagesPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Pages.PagesPublicController", "interfaces": [ { @@ -551,6 +559,8 @@ "Volo.CmsKit.Public.Menus.MenuItemPublicController": { "controllerName": "MenuItemPublic", "controllerGroupName": "MenuItemPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Menus.MenuItemPublicController", "interfaces": [ { @@ -575,9 +585,55 @@ } } }, + "Volo.CmsKit.Public.GlobalResources.GlobalResourcePublicController": { + "controllerName": "GlobalResourcePublic", + "controllerGroupName": "GlobalResourcePublic", + "isRemoteService": true, + "apiVersion": null, + "type": "Volo.CmsKit.Public.GlobalResources.GlobalResourcePublicController", + "interfaces": [ + { + "type": "Volo.CmsKit.Public.GlobalResources.IGlobalResourcePublicAppService" + } + ], + "actions": { + "GetGlobalScriptAsync": { + "uniqueName": "GetGlobalScriptAsync", + "name": "GetGlobalScriptAsync", + "httpMethod": "GET", + "url": "api/cms-kit-public/global-resources/script", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "Volo.CmsKit.Public.GlobalResources.GlobalResourceDto", + "typeSimple": "Volo.CmsKit.Public.GlobalResources.GlobalResourceDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.CmsKit.Public.GlobalResources.IGlobalResourcePublicAppService" + }, + "GetGlobalStyleAsync": { + "uniqueName": "GetGlobalStyleAsync", + "name": "GetGlobalStyleAsync", + "httpMethod": "GET", + "url": "api/cms-kit-public/global-resources/style", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "Volo.CmsKit.Public.GlobalResources.GlobalResourceDto", + "typeSimple": "Volo.CmsKit.Public.GlobalResources.GlobalResourceDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.CmsKit.Public.GlobalResources.IGlobalResourcePublicAppService" + } + } + }, "Volo.CmsKit.Public.Comments.CommentPublicController": { "controllerName": "CommentPublic", "controllerGroupName": "CommentPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Comments.CommentPublicController", "interfaces": [ { @@ -818,6 +874,8 @@ "Volo.CmsKit.Public.Blogs.BlogPostPublicController": { "controllerName": "BlogPostPublic", "controllerGroupName": "BlogPostPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Blogs.BlogPostPublicController", "interfaces": [ { @@ -899,9 +957,9 @@ }, { "name": "input", - "typeAsString": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto, Volo.Abp.Ddd.Application.Contracts", - "type": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto", - "typeSimple": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto", + "typeAsString": "Volo.CmsKit.Public.Blogs.BlogPostGetListInput, Volo.CmsKit.Public.Application.Contracts", + "type": "Volo.CmsKit.Public.Blogs.BlogPostGetListInput", + "typeSimple": "Volo.CmsKit.Public.Blogs.BlogPostGetListInput", "isOptional": false, "defaultValue": null } @@ -919,6 +977,30 @@ "bindingSourceId": "Path", "descriptorName": "" }, + { + "nameOnMethod": "input", + "name": "AuthorId", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "Sorting", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, { "nameOnMethod": "input", "name": "SkipCount", @@ -942,6 +1024,43 @@ "constraintTypes": null, "bindingSourceId": "ModelBinding", "descriptorName": "input" + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.PagedResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.CmsKit.Public.Blogs.IBlogPostPublicAppService" + }, + "GetAuthorsHasBlogPostsAsyncByInput": { + "uniqueName": "GetAuthorsHasBlogPostsAsyncByInput", + "name": "GetAuthorsHasBlogPostsAsync", + "httpMethod": "GET", + "url": "api/cms-kit-public/blog-posts/authors", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.CmsKit.Public.Blogs.BlogPostFilteredPagedAndSortedResultRequestDto, Volo.CmsKit.Public.Application.Contracts", + "type": "Volo.CmsKit.Public.Blogs.BlogPostFilteredPagedAndSortedResultRequestDto", + "typeSimple": "Volo.CmsKit.Public.Blogs.BlogPostFilteredPagedAndSortedResultRequestDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "input", + "name": "Filter", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" }, { "nameOnMethod": "input", @@ -954,11 +1073,72 @@ "constraintTypes": null, "bindingSourceId": "ModelBinding", "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "SkipCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "MaxResultCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" } ], "returnValue": { - "type": "Volo.Abp.Application.Dtos.PagedResultDto", - "typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto" + "type": "Volo.Abp.Application.Dtos.PagedResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.CmsKit.Public.Blogs.IBlogPostPublicAppService" + }, + "GetAuthorHasBlogPostAsyncById": { + "uniqueName": "GetAuthorHasBlogPostAsyncById", + "name": "GetAuthorHasBlogPostAsync", + "httpMethod": "GET", + "url": "api/cms-kit-public/blog-posts/authors/{id}", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "id", + "name": "id", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": [], + "bindingSourceId": "Path", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.CmsKit.Users.CmsUserDto", + "typeSimple": "Volo.CmsKit.Users.CmsUserDto" }, "allowAnonymous": null, "implementFrom": "Volo.CmsKit.Public.Blogs.IBlogPostPublicAppService" diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs index 8a788f7a34..9f43d65766 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs @@ -40,8 +40,15 @@ public class BlogPostPublicController : CmsKitPublicControllerBase, IBlogPostPub [HttpGet] [Route("authors")] - public virtual Task> GetAuthorsHasBlogPostsAsync() + public Task> GetAuthorsHasBlogPostsAsync(BlogPostFilteredPagedAndSortedResultRequestDto input) { - return BlogPostPublicAppService.GetAuthorsHasBlogPostsAsync(); + return BlogPostPublicAppService.GetAuthorsHasBlogPostsAsync(input); + } + + [HttpGet] + [Route("authors/{id}")] + public Task GetAuthorHasBlogPostAsync(Guid id) + { + return BlogPostPublicAppService.GetAuthorHasBlogPostAsync(id); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml index 4ae3c007c7..32df5fb2fd 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml @@ -24,19 +24,19 @@
- - + + @if(Model.SelectedAuthor != null) + { + }
diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs index c9dc49931d..c7f667382b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs @@ -20,16 +20,15 @@ public class IndexModel : CmsKitPublicPageModelBase [BindProperty(SupportsGet = true)] public int CurrentPage { get; set; } = 1; - + [BindProperty(SupportsGet = true)] public Guid? AuthorId { get; set; } public PagedResultDto Blogs { get; private set; } public PagerModel PagerModel => new PagerModel(Blogs.TotalCount, Blogs.Items.Count, CurrentPage, PageSize, Request.Path.ToString()); - - [BindProperty(SupportsGet = true)] - public List Authors { get; set; } + + public CmsUserDto SelectedAuthor { get; set; } protected IBlogPostPublicAppService BlogPostPublicAppService { get; } @@ -48,7 +47,10 @@ public class IndexModel : CmsKitPublicPageModelBase MaxResultCount = PageSize, AuthorId = AuthorId }); - - Authors = await BlogPostPublicAppService.GetAuthorsHasBlogPostsAsync(); + + if (AuthorId != null) + { + SelectedAuthor = await BlogPostPublicAppService.GetAuthorHasBlogPostAsync(AuthorId.Value); + } } } From 511540a2642e355b1a8bf7c3e78062abfc226563 Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Mon, 28 Mar 2022 09:50:07 +0300 Subject: [PATCH 22/38] Update resources --- .../Volo/CmsKit/Localization/Resources/en.json | 1 + .../Volo/CmsKit/Localization/Resources/tr.json | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 0dd826480d..0e201329ef 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -130,6 +130,7 @@ "SelectAll": "Select All", "Send": "Send", "SendMessage": "Send Message", + "SelectedAuthor": "Author", "ShortDescription": "Short description", "Slug": "Slug", "Source": "Source", diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json index 95ef414c17..3f855f13a9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json @@ -129,6 +129,7 @@ "SelectAll": "Hepsini seç", "Send": "Gönder", "SendMessage": "Mesajı Gönder", + "SelectedAuthor": "Yazar", "ShortDescription": "Kısa açıklama", "Slug": "Etiket", "Source": "Kaynak", From 5723fd0a924a65f0acb3c8024845fa73bc6c19c7 Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Mon, 28 Mar 2022 09:53:45 +0300 Subject: [PATCH 23/38] Update tests --- .../test/Volo.CmsKit.TestBase/Blogs/BlogPostRepository_Test.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/Blogs/BlogPostRepository_Test.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/Blogs/BlogPostRepository_Test.cs index 4d696e916d..c9cc6472fe 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/Blogs/BlogPostRepository_Test.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/Blogs/BlogPostRepository_Test.cs @@ -149,7 +149,7 @@ public abstract class BlogPostRepository_Test : CmsKitTestBase Date: Mon, 28 Mar 2022 13:19:20 +0300 Subject: [PATCH 24/38] Update AspNet-Boilerplate-Migration-Guide.md --- docs/en/AspNet-Boilerplate-Migration-Guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/AspNet-Boilerplate-Migration-Guide.md b/docs/en/AspNet-Boilerplate-Migration-Guide.md index 52a2fced6a..e337b78a6d 100644 --- a/docs/en/AspNet-Boilerplate-Migration-Guide.md +++ b/docs/en/AspNet-Boilerplate-Migration-Guide.md @@ -1,4 +1,4 @@ -# ASP.NET Boilerplate v5+ to ABP Framework Migration +# Migrating from ASP.NET Boilerplate to the ABP Framework ABP Framework is **the successor** of the open source [ASP.NET Boilerplate](https://aspnetboilerplate.com/) framework. This guide aims to help you to **migrate your existing solutions** (you developed with the ASP.NET Boilerplate framework) to the ABP Framework. From 06a463a5415e149d9293c35b68831681e311910b Mon Sep 17 00:00:00 2001 From: albert <9526587+ebicoglu@users.noreply.github.com> Date: Mon, 28 Mar 2022 13:19:32 +0300 Subject: [PATCH 25/38] Update AspNet-Boilerplate-Migration-Guide.md --- docs/en/AspNet-Boilerplate-Migration-Guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/AspNet-Boilerplate-Migration-Guide.md b/docs/en/AspNet-Boilerplate-Migration-Guide.md index 52a2fced6a..e337b78a6d 100644 --- a/docs/en/AspNet-Boilerplate-Migration-Guide.md +++ b/docs/en/AspNet-Boilerplate-Migration-Guide.md @@ -1,4 +1,4 @@ -# ASP.NET Boilerplate v5+ to ABP Framework Migration +# Migrating from ASP.NET Boilerplate to the ABP Framework ABP Framework is **the successor** of the open source [ASP.NET Boilerplate](https://aspnetboilerplate.com/) framework. This guide aims to help you to **migrate your existing solutions** (you developed with the ASP.NET Boilerplate framework) to the ABP Framework. From 9e55de04d0b1351b548273df320bf22a856bbd80 Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Mon, 28 Mar 2022 13:41:47 +0300 Subject: [PATCH 26/38] CMS Kit - Update Client Proxies --- .../cms-kit-admin-generate-proxy.json | 20 +++++++ ...obalResourcePublicClientProxy.Generated.cs | 27 +++++++++ .../GlobalResourcePublicClientProxy.cs | 7 +++ .../ClientProxies/cms-kit-generate-proxy.json | 58 +++++++++++++++++++ .../wwwroot/client-proxies/cms-kit-proxy.js | 22 +++++++ 5 files changed, 134 insertions(+) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.Generated.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/cms-kit-admin-generate-proxy.json b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/cms-kit-admin-generate-proxy.json index 6608a2e1b9..1a2814324d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/cms-kit-admin-generate-proxy.json +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/cms-kit-admin-generate-proxy.json @@ -7,6 +7,8 @@ "Volo.CmsKit.Admin.Tags.EntityTagAdminController": { "controllerName": "EntityTagAdmin", "controllerGroupName": "EntityTagAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Tags.EntityTagAdminController", "interfaces": [ { @@ -154,6 +156,8 @@ "Volo.CmsKit.Admin.Tags.TagAdminController": { "controllerName": "TagAdmin", "controllerGroupName": "TagAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Tags.TagAdminController", "interfaces": [ { @@ -422,6 +426,8 @@ "Volo.CmsKit.Admin.Pages.PageAdminController": { "controllerName": "PageAdmin", "controllerGroupName": "PageAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Pages.PageAdminController", "interfaces": [ { @@ -675,6 +681,8 @@ "Volo.CmsKit.Admin.Menus.MenuItemAdminController": { "controllerName": "MenuItemAdmin", "controllerGroupName": "MenuItemAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Menus.MenuItemAdminController", "interfaces": [ { @@ -1000,6 +1008,8 @@ "Volo.CmsKit.Admin.MediaDescriptors.MediaDescriptorAdminController": { "controllerName": "MediaDescriptorAdmin", "controllerGroupName": "MediaDescriptorAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.MediaDescriptors.MediaDescriptorAdminController", "interfaces": [ { @@ -1118,6 +1128,8 @@ "Volo.CmsKit.Admin.GlobalResources.GlobalResourceAdminController": { "controllerName": "GlobalResourceAdmin", "controllerGroupName": "GlobalResourceAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceAdminController", "interfaces": [ { @@ -1182,6 +1194,8 @@ "Volo.CmsKit.Admin.Comments.CommentAdminController": { "controllerName": "CommentAdmin", "controllerGroupName": "CommentAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Comments.CommentAdminController", "interfaces": [ { @@ -1401,6 +1415,8 @@ "Volo.CmsKit.Admin.Blogs.BlogAdminController": { "controllerName": "BlogAdmin", "controllerGroupName": "BlogAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Blogs.BlogAdminController", "interfaces": [ { @@ -1654,6 +1670,8 @@ "Volo.CmsKit.Admin.Blogs.BlogFeatureAdminController": { "controllerName": "BlogFeatureAdmin", "controllerGroupName": "BlogFeatureAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Blogs.BlogFeatureAdminController", "interfaces": [ { @@ -1760,6 +1778,8 @@ "Volo.CmsKit.Admin.Blogs.BlogPostAdminController": { "controllerName": "BlogPostAdmin", "controllerGroupName": "BlogPostAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Blogs.BlogPostAdminController", "interfaces": [ { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.Generated.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.Generated.cs new file mode 100644 index 0000000000..d7354b9e87 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.Generated.cs @@ -0,0 +1,27 @@ +// This file is automatically generated by ABP framework to use MVC Controllers from CSharp +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Http.Client; +using Volo.Abp.Http.Modeling; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Http.Client.ClientProxying; +using Volo.CmsKit.Public.GlobalResources; + +// ReSharper disable once CheckNamespace +namespace Volo.CmsKit.Public.GlobalResources.ClientProxies; + +[Dependency(ReplaceServices = true)] +[ExposeServices(typeof(IGlobalResourcePublicAppService), typeof(GlobalResourcePublicClientProxy))] +public partial class GlobalResourcePublicClientProxy : ClientProxyBase, IGlobalResourcePublicAppService +{ + public virtual async Task GetGlobalScriptAsync() + { + return await RequestAsync(nameof(GetGlobalScriptAsync)); + } + + public virtual async Task GetGlobalStyleAsync() + { + return await RequestAsync(nameof(GetGlobalStyleAsync)); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.cs new file mode 100644 index 0000000000..76549aec1e --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.cs @@ -0,0 +1,7 @@ +// This file is part of GlobalResourcePublicClientProxy, you can customize it here +// ReSharper disable once CheckNamespace +namespace Volo.CmsKit.Public.GlobalResources.ClientProxies; + +public partial class GlobalResourcePublicClientProxy +{ +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json index 0387176b02..f2ff050759 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json @@ -7,6 +7,8 @@ "Volo.CmsKit.Public.Tags.TagPublicController": { "controllerName": "TagPublic", "controllerGroupName": "TagPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Tags.TagPublicController", "interfaces": [ { @@ -76,6 +78,8 @@ "Volo.CmsKit.Public.Reactions.ReactionPublicController": { "controllerName": "ReactionPublic", "controllerGroupName": "ReactionPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Reactions.ReactionPublicController", "interfaces": [ { @@ -299,6 +303,8 @@ "Volo.CmsKit.Public.Ratings.RatingPublicController": { "controllerName": "RatingPublic", "controllerGroupName": "RatingPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Ratings.RatingPublicController", "interfaces": [ { @@ -502,6 +508,8 @@ "Volo.CmsKit.Public.Pages.PagesPublicController": { "controllerName": "PagesPublic", "controllerGroupName": "PagesPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Pages.PagesPublicController", "interfaces": [ { @@ -551,6 +559,8 @@ "Volo.CmsKit.Public.Menus.MenuItemPublicController": { "controllerName": "MenuItemPublic", "controllerGroupName": "MenuItemPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Menus.MenuItemPublicController", "interfaces": [ { @@ -575,9 +585,55 @@ } } }, + "Volo.CmsKit.Public.GlobalResources.GlobalResourcePublicController": { + "controllerName": "GlobalResourcePublic", + "controllerGroupName": "GlobalResourcePublic", + "isRemoteService": true, + "apiVersion": null, + "type": "Volo.CmsKit.Public.GlobalResources.GlobalResourcePublicController", + "interfaces": [ + { + "type": "Volo.CmsKit.Public.GlobalResources.IGlobalResourcePublicAppService" + } + ], + "actions": { + "GetGlobalScriptAsync": { + "uniqueName": "GetGlobalScriptAsync", + "name": "GetGlobalScriptAsync", + "httpMethod": "GET", + "url": "api/cms-kit-public/global-resources/script", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "Volo.CmsKit.Public.GlobalResources.GlobalResourceDto", + "typeSimple": "Volo.CmsKit.Public.GlobalResources.GlobalResourceDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.CmsKit.Public.GlobalResources.IGlobalResourcePublicAppService" + }, + "GetGlobalStyleAsync": { + "uniqueName": "GetGlobalStyleAsync", + "name": "GetGlobalStyleAsync", + "httpMethod": "GET", + "url": "api/cms-kit-public/global-resources/style", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "Volo.CmsKit.Public.GlobalResources.GlobalResourceDto", + "typeSimple": "Volo.CmsKit.Public.GlobalResources.GlobalResourceDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.CmsKit.Public.GlobalResources.IGlobalResourcePublicAppService" + } + } + }, "Volo.CmsKit.Public.Comments.CommentPublicController": { "controllerName": "CommentPublic", "controllerGroupName": "CommentPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Comments.CommentPublicController", "interfaces": [ { @@ -818,6 +874,8 @@ "Volo.CmsKit.Public.Blogs.BlogPostPublicController": { "controllerName": "BlogPostPublic", "controllerGroupName": "BlogPostPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Blogs.BlogPostPublicController", "interfaces": [ { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/wwwroot/client-proxies/cms-kit-proxy.js b/modules/cms-kit/src/Volo.CmsKit.Public.Web/wwwroot/client-proxies/cms-kit-proxy.js index a135611cac..6b2e3f1b04 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/wwwroot/client-proxies/cms-kit-proxy.js +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/wwwroot/client-proxies/cms-kit-proxy.js @@ -112,6 +112,28 @@ })(); + // controller volo.cmsKit.public.globalResources.globalResourcePublic + + (function(){ + + abp.utils.createNamespace(window, 'volo.cmsKit.public.globalResources.globalResourcePublic'); + + volo.cmsKit.public.globalResources.globalResourcePublic.getGlobalScript = function(ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/cms-kit-public/global-resources/script', + type: 'GET' + }, ajaxParams)); + }; + + volo.cmsKit.public.globalResources.globalResourcePublic.getGlobalStyle = function(ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/cms-kit-public/global-resources/style', + type: 'GET' + }, ajaxParams)); + }; + + })(); + // controller volo.cmsKit.public.comments.commentPublic (function(){ From b27854d09de42abd1cab740379415f48b0b678e5 Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Mon, 28 Mar 2022 13:45:52 +0300 Subject: [PATCH 27/38] Revert "Update AspNet-Boilerplate-Migration-Guide.md" This reverts commit 06a463a5415e149d9293c35b68831681e311910b. --- docs/en/AspNet-Boilerplate-Migration-Guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/AspNet-Boilerplate-Migration-Guide.md b/docs/en/AspNet-Boilerplate-Migration-Guide.md index e337b78a6d..52a2fced6a 100644 --- a/docs/en/AspNet-Boilerplate-Migration-Guide.md +++ b/docs/en/AspNet-Boilerplate-Migration-Guide.md @@ -1,4 +1,4 @@ -# Migrating from ASP.NET Boilerplate to the ABP Framework +# ASP.NET Boilerplate v5+ to ABP Framework Migration ABP Framework is **the successor** of the open source [ASP.NET Boilerplate](https://aspnetboilerplate.com/) framework. This guide aims to help you to **migrate your existing solutions** (you developed with the ASP.NET Boilerplate framework) to the ABP Framework. From 50a0d485d53918655bcf0101463fbf37137650ab Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Mon, 28 Mar 2022 13:46:58 +0300 Subject: [PATCH 28/38] Revert "Revert "Update AspNet-Boilerplate-Migration-Guide.md"" This reverts commit b27854d09de42abd1cab740379415f48b0b678e5. --- docs/en/AspNet-Boilerplate-Migration-Guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/AspNet-Boilerplate-Migration-Guide.md b/docs/en/AspNet-Boilerplate-Migration-Guide.md index 52a2fced6a..e337b78a6d 100644 --- a/docs/en/AspNet-Boilerplate-Migration-Guide.md +++ b/docs/en/AspNet-Boilerplate-Migration-Guide.md @@ -1,4 +1,4 @@ -# ASP.NET Boilerplate v5+ to ABP Framework Migration +# Migrating from ASP.NET Boilerplate to the ABP Framework ABP Framework is **the successor** of the open source [ASP.NET Boilerplate](https://aspnetboilerplate.com/) framework. This guide aims to help you to **migrate your existing solutions** (you developed with the ASP.NET Boilerplate framework) to the ABP Framework. From acd72686b40d091d319e50b217b5bf7dc7930261 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 28 Mar 2022 14:40:52 +0300 Subject: [PATCH 29/38] Exception handling: Specify json as Content-Type in response header --- .../ExceptionHandling/AbpExceptionHandlingMiddleware.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs index 48ec6121b4..b9d3b83068 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs @@ -82,6 +82,7 @@ public class AbpExceptionHandlingMiddleware : IMiddleware, ITransientDependency httpContext.Response.StatusCode = (int)statusCodeFinder.GetStatusCode(httpContext, exception); httpContext.Response.OnStarting(_clearCacheHeadersDelegate, httpContext.Response); httpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true"); + httpContext.Response.Headers.Add("Content-Type", "application/json"); await httpContext.Response.WriteAsync( jsonSerializer.Serialize( From 5be98cc87d1a5f1e5c41efc435fb036aadb9ef02 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Mon, 28 Mar 2022 15:28:42 +0300 Subject: [PATCH 30/38] fix(angular/theming): scriban render problem --- docs/en/UI/Angular/Theming.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/UI/Angular/Theming.md b/docs/en/UI/Angular/Theming.md index 3b7e3d1afd..c7f303763d 100644 --- a/docs/en/UI/Angular/Theming.md +++ b/docs/en/UI/Angular/Theming.md @@ -227,7 +227,7 @@ import { Router } from '@angular/router'; template: ` - {{ data.textTemplate.text | abpLocalization }} + {%{{{ data.textTemplate.text | abpLocalization }}}%} `, }) From 25a40a960664dca044e9bc2050567f20f1e2c4e9 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Mon, 28 Mar 2022 18:15:07 +0300 Subject: [PATCH 31/38] Update en.json --- .../Commercial/Localization/Resources/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json index 8fa96b5ee2..446d165f21 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json @@ -503,6 +503,7 @@ "AdditionalNote": "Additional Note", "OnboardingTrainingFaqTitle": "Do you have ABP onboarding training?", "OnboardingTrainingFaqExplanation": "Yes, we have ABP Training Services to help you get your ABP project started fast. You will learn about ABP from an ABP core team member and you will get the skills to begin your ABP project. In the onboarding training, we will explain how to set up your development environment, install the required tools, create a fully functional CRUD page. The training will be live and the Zoom application will be used, and we are open to using other online meeting platforms. The language of the training will be English. You can also ask your questions about ABP during the sessions. A convenient time and date will be planned for both parties. To get more information, contact us at info@abp.io.", - "AddBasket": "Add to Basket" + "AddBasket": "Add to Basket", + "SendTrainingRequest": "Send Training Request" } } From e8a810ba4bd94bd1d4ca447ec4d8645354c75d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 29 Mar 2022 15:04:20 +0300 Subject: [PATCH 32/38] Check for null for receivedContext.TokenEndpointRequest --- .../DependencyInjection/AbpOpenIdConnectExtensions.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs index 02b292a984..894ba470a8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs @@ -57,8 +57,7 @@ public static class AbpOpenIdConnectExtensions if (receivedContext.Request.Cookies.ContainsKey(tenantKey)) { - receivedContext.TokenEndpointRequest.SetParameter(tenantKey, - receivedContext.Request.Cookies[tenantKey]); + receivedContext.TokenEndpointRequest?.SetParameter(tenantKey, receivedContext.Request.Cookies[tenantKey]); } } } From 45685fb58a92212266a6f286a11f47d811e304a9 Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Tue, 29 Mar 2022 16:26:39 +0300 Subject: [PATCH 33/38] add scroll index to blog post page --- .../BlogPostScrollIndexFeature.cs | 17 ++ .../GlobalFeatures/GlobalCmsKitFeatures.cs | 3 + .../CmsKit/Localization/Resources/en.json | 4 +- .../CmsKit/Localization/Resources/tr.json | 4 +- .../Pages/Public/CmsKit/Blogs/BlogPost.cshtml | 167 +++++++++-------- .../Pages/Public/CmsKit/Blogs/blogPost.css | 17 ++ .../Pages/Public/CmsKit/Blogs/blogpost.js | 46 +++++ .../Public/CmsKit/Blogs/bootstrap-toc.css | 60 +++++++ .../Public/CmsKit/Blogs/bootstrap-toc.js | 168 ++++++++++++++++++ 9 files changed, 414 insertions(+), 72 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/BlogPostScrollIndexFeature.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/blogpost.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/bootstrap-toc.css create mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/bootstrap-toc.js diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/BlogPostScrollIndexFeature.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/BlogPostScrollIndexFeature.cs new file mode 100644 index 0000000000..9f03f973e1 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/BlogPostScrollIndexFeature.cs @@ -0,0 +1,17 @@ +using JetBrains.Annotations; +using Volo.Abp.GlobalFeatures; + +namespace Volo.CmsKit.GlobalFeatures; + + +[GlobalFeatureName(Name)] +public class BlogPostScrollIndexFeature : GlobalFeature +{ + public const string Name = "CmsKit.BlogPost.ScrollIndex"; + + internal BlogPostScrollIndexFeature( + [NotNull] GlobalCmsKitFeatures cmsKit + ) : base(cmsKit) + { + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs index 9c07101616..6a7ca3245a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs @@ -26,6 +26,8 @@ public class GlobalCmsKitFeatures : GlobalModuleFeatures public MenuFeature Menu => GetFeature(); public GlobalResourcesFeature GlobalResources => GetFeature(); + + public BlogPostScrollIndexFeature BlogPostScrollIndex => GetFeature(); public GlobalCmsKitFeatures([NotNull] GlobalFeatureManager featureManager) : base(featureManager) @@ -40,5 +42,6 @@ public class GlobalCmsKitFeatures : GlobalModuleFeatures AddFeature(new CmsUserFeature(this)); AddFeature(new MenuFeature(this)); AddFeature(new GlobalResourcesFeature(this)); + AddFeature(new BlogPostScrollIndexFeature(this)); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 0dd826480d..2634099fd1 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -164,6 +164,8 @@ "GlobalResources": "Global Resources", "Script": "Script", "Style": "Style", - "SavedSuccessfully": "Saved successfully" + "SavedSuccessfully": "Saved successfully", + "GoToTop": "Go to top", + "InThisDocument": "In this document" } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json index 95ef414c17..00cc5303d4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json @@ -163,6 +163,8 @@ "GlobalResources": "Global Kaynaklar", "Script": "Script", "Style": "Style", - "SavedSuccessfully": "Başarıyla kaydedildi" + "SavedSuccessfully": "Başarıyla kaydedildi", + "GoToTop": "Yukarı Git", + "InThisDocument": "Bu belgede" } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml index d8c1f428da..90f16c18fd 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml @@ -17,91 +17,118 @@ @inject IMarkdownToHtmlRenderer MarkdownRenderer @section styles{ - - - - + + + + + } @section scripts{ - - - - + + + + + + } @{ string dummyImageSource = "https://dummyimage.com/1280x720/a3a3a3/fff.png?text=" + Model.BlogPost.Title; + var isScrollIndexEnabled = GlobalFeatureManager.Instance.IsEnabled(); } - - - - -
-

@Model.BlogPost.Title

-

- @@@Model.BlogPost.Author?.UserName - @Model.BlogPost.CreationTime -

+
+
+ + + + +
+

@Model.BlogPost.Title

+

+ @@@Model.BlogPost.Author?.UserName + @Model.BlogPost.CreationTime +

- @if(!Model.BlogPost.Content.IsNullOrEmpty()) - { - @Html.Raw(await MarkdownRenderer.RenderAsync(Model.BlogPost.Content)) - } + @if (!Model.BlogPost.Content.IsNullOrEmpty()) + { + @Html.Raw(await MarkdownRenderer.RenderAsync(Model.BlogPost.Content)) + } -

- @if (Model.BlogPost.LastModificationTime != null) - { - @L["LastModification"].Value : @Model.BlogPost.LastModificationTime - } -

-
+

+ @if (Model.BlogPost.LastModificationTime != null) + { + @L["LastModification"].Value : @Model.BlogPost.LastModificationTime + } +

+
- @if (GlobalFeatureManager.Instance.IsEnabled()) - { - if (Model.TagsFeature?.IsEnabled == true) - { - @await Component.InvokeAsync(typeof(TagViewComponent), new - { - entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, - entityId = Model.BlogPost.Id.ToString() - }) - } - } -
-
+ @if (GlobalFeatureManager.Instance.IsEnabled()) + { + if (Model.TagsFeature?.IsEnabled == true) + { + @await Component.InvokeAsync(typeof(TagViewComponent), new + { + entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, + entityId = Model.BlogPost.Id.ToString() + }) + } + } +
+ - - - @if (GlobalFeatureManager.Instance.IsEnabled()) - { - if (Model.ReactionsFeature?.IsEnabled == true) - { - @await Component.InvokeAsync(typeof(ReactionSelectionViewComponent), new + + + @if (GlobalFeatureManager.Instance.IsEnabled()) { - entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, - entityId = Model.BlogPost.Id.ToString() - }) - } - } - - - @if (GlobalFeatureManager.Instance.IsEnabled()) - { - if (Model.RatingsFeature?.IsEnabled == true) - { - @await Component.InvokeAsync(typeof(RatingViewComponent), new + if (Model.ReactionsFeature?.IsEnabled == true) + { + @await Component.InvokeAsync(typeof(ReactionSelectionViewComponent), new + { + entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, + entityId = Model.BlogPost.Id.ToString() + }) + } + } + + + @if (GlobalFeatureManager.Instance.IsEnabled()) { - entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, - entityId = Model.BlogPost.Id.ToString() - }) - } - } - - - - + if (Model.RatingsFeature?.IsEnabled == true) + { + @await Component.InvokeAsync(typeof(RatingViewComponent), new + { + entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, + entityId = Model.BlogPost.Id.ToString() + }) + } + } + + + + +
+ @if (isScrollIndexEnabled) + { +
+
+
@L["InThisDocument"]
+ + + +
+
+ } + +
@if (GlobalFeatureManager.Instance.IsEnabled()) { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/blogPost.css b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/blogPost.css index 98c4a3100d..d09be3150d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/blogPost.css +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/blogPost.css @@ -20,4 +20,21 @@ span.area-title { } .popover { min-width: 276px; +} + +#scroll-index { + position: sticky; + top: 20px; +} + +#scroll-index .scroll-top-btn.showup{ + display: block; +} + +#scroll-index .scroll-top-btn{ + display: none; + font-size: .85em; + color: #aaa; + text-decoration: none; + padding-left: 18px; } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/blogpost.js b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/blogpost.js new file mode 100644 index 0000000000..603649e2c9 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/blogpost.js @@ -0,0 +1,46 @@ +$(function () { + var $myNav = $('#blog-post-sticky-index'); + var $scrollToTopBtn = $('.scroll-top-btn'); + + window.Toc.helpers.createNavList = function () { + return $(''); + }; + + window.Toc.helpers.createChildNavList = function ($parent) { + var $childList = this.createNavList(); + $parent.append($childList); + return $childList; + }; + + window.Toc.helpers.generateNavEl = function (anchor, text) { + var $a = $(''); + $a.attr('href', '#' + anchor); + $a.text(text); + var $li = $(''); + $li.append($a); + return $li; + }; + + Toc.init($myNav); + + $('body').scrollspy({ + target: $myNav, + }); + + $scrollToTopBtn.click(function () { + $('html, body').animate({scrollTop: 0}, 'fast'); + }); + + // When the user scrolls down 20px from the top of the document, show the button + window.onscroll = function () { + scrollFunction() + }; + + function scrollFunction() { + if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { + $scrollToTopBtn.addClass('showup'); + } else { + $scrollToTopBtn.removeClass('showup'); + } + } +}); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/bootstrap-toc.css b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/bootstrap-toc.css new file mode 100644 index 0000000000..b15e18ee85 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/bootstrap-toc.css @@ -0,0 +1,60 @@ +/*! + * Bootstrap Table of Contents v<%= version %> (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ + +/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ + +/* All levels of nav */ +nav[data-toggle='toc'] .nav > li > a { + display: block; + padding: 4px 20px; + font-size: 13px; + font-weight: 500; + color: #767676; +} +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 19px; + color: #563d7c; + text-decoration: none; + background-color: transparent; + border-left: 1px solid #563d7c; +} +nav[data-toggle='toc'] .nav-link.active, +nav[data-toggle='toc'] .nav-link.active:hover, +nav[data-toggle='toc'] .nav-link.active:focus { + padding-left: 18px; + font-weight: bold; + color: #563d7c; + background-color: transparent; + border-left: 2px solid #563d7c; +} + +/* Nav: second level (shown on .active) */ +nav[data-toggle='toc'] .nav-link + ul { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} + +nav[data-toggle='toc'] .nav .nav > li > a { + padding-top: 1px; + padding-bottom: 1px; + padding-left: 30px; + font-size: 12px; + font-weight: normal; +} +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 29px; +} +nav[data-toggle='toc'] .nav .nav > li > .active, +nav[data-toggle='toc'] .nav .nav > li > .active:hover, +nav[data-toggle='toc'] .nav .nav > li > .active:focus { + padding-left: 28px; + font-weight: 500; +} + +nav[data-toggle='toc'] .nav-link.active + ul { + display: block; +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/bootstrap-toc.js b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/bootstrap-toc.js new file mode 100644 index 0000000000..13a4d1f6a5 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/bootstrap-toc.js @@ -0,0 +1,168 @@ +/*! + * Bootstrap Table of Contents v1.0.0 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ +(function ($) { + 'use strict'; + + window.Toc = { + helpers: { + // return all matching elements in the set, or their descendants + findOrFilter: function ($el, selector) { + // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ + // http://stackoverflow.com/a/12731439/358804 + var $descendants = $el.find(selector); + return $el + .filter(selector) + .add($descendants) + .filter(':not([data-toc-skip])'); + }, + + generateUniqueIdBase: function (el) { + var text = $(el).text(); + var anchor = text + .trim() + .toLowerCase() + .replace(/[^A-Za-z0-9]+/g, '-'); + return anchor || el.tagName.toLowerCase(); + }, + + generateUniqueId: function (el) { + var anchorBase = this.generateUniqueIdBase(el); + for (var i = 0; ; i++) { + var anchor = anchorBase; + if (i > 0) { + // add suffix + anchor += '-' + i; + } + // check if ID already exists + if (!document.getElementById(anchor)) { + return anchor; + } + } + }, + + generateAnchor: function (el) { + if (el.id) { + return el.id; + } else { + var anchor = this.generateUniqueId(el); + el.id = anchor; + return anchor; + } + }, + + createNavList: function () { + return $(''); + }, + + createChildNavList: function ($parent) { + var $childList = this.createNavList(); + $parent.append($childList); + return $childList; + }, + + generateNavEl: function (anchor, text) { + var $a = $(''); + $a.attr('href', '#' + anchor); + $a.text(text); + var $li = $('
  • '); + $li.append($a); + return $li; + }, + + generateNavItem: function (headingEl) { + var anchor = this.generateAnchor(headingEl); + var $heading = $(headingEl); + var text = $heading.data('toc-text') || $heading.text(); + return this.generateNavEl(anchor, text); + }, + + // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). + getTopLevel: function ($scope) { + for (var i = 1; i <= 6; i++) { + var $headings = this.findOrFilter($scope, 'h' + i); + if ($headings.length > 1) { + return i; + } + } + + return 1; + }, + + // returns the elements for the top level, and the next below it + getHeadings: function ($scope, topLevel) { + var topSelector = 'h' + topLevel; + + var secondaryLevel = topLevel + 1; + var secondarySelector = 'h' + secondaryLevel; + + return this.findOrFilter( + $scope, + topSelector + ',' + secondarySelector + ); + }, + + getNavLevel: function (el) { + return parseInt(el.tagName.charAt(1), 10); + }, + + populateNav: function ($topContext, topLevel, $headings) { + var $context = $topContext; + var $prevNav; + + var helpers = this; + $headings.each(function (i, el) { + var $newNav = helpers.generateNavItem(el); + var navLevel = helpers.getNavLevel(el); + + // determine the proper $context + if (navLevel === topLevel) { + // use top level + $context = $topContext; + } else if ($prevNav && $context === $topContext) { + // create a new level of the tree and switch to it + $context = helpers.createChildNavList($prevNav); + } // else use the current $context + + $context.append($newNav); + + $prevNav = $newNav; + }); + }, + + parseOps: function (arg) { + var opts; + if (arg.jquery) { + opts = { + $nav: arg, + }; + } else { + opts = arg; + } + opts.$scope = opts.$scope || $(document.body); + return opts; + }, + }, + + // accepts a jQuery object, or an options object + init: function (opts) { + opts = this.helpers.parseOps(opts); + + // ensure that the data attribute is in place for styling + opts.$nav.attr('data-toggle', 'toc'); + + var $topContext = this.helpers.createChildNavList(opts.$nav); + var topLevel = this.helpers.getTopLevel(opts.$scope); + var $headings = this.helpers.getHeadings(opts.$scope, topLevel); + this.helpers.populateNav($topContext, topLevel, $headings); + }, + }; + + $(function () { + $('nav[data-toggle="toc"]').each(function (i, el) { + var $nav = $(el); + Toc.init($nav); + }); + }); +})(jQuery); From db9a022d1aad8c48156d5a01a14a1f5906323e2d Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Tue, 29 Mar 2022 23:55:11 +0300 Subject: [PATCH 34/38] import scroll index style and js file if feature enabled --- .../Pages/Public/CmsKit/Blogs/BlogPost.cshtml | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml index 2c29649dd3..d28a57889e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml @@ -16,28 +16,40 @@ @inject IMarkdownToHtmlRenderer MarkdownRenderer + +@{ + string dummyImageSource = "https://dummyimage.com/1280x720/a3a3a3/fff.png?text=" + Model.BlogPost.Title; + var isScrollIndexEnabled = GlobalFeatureManager.Instance.IsEnabled(); +} + @section styles{ + @if (isScrollIndexEnabled) + { + + + + } - } @section scripts{ + @if (isScrollIndexEnabled) + { + + + + } + - } -@{ - string dummyImageSource = "https://dummyimage.com/1280x720/a3a3a3/fff.png?text=" + Model.BlogPost.Title; - var isScrollIndexEnabled = GlobalFeatureManager.Instance.IsEnabled(); -} -
    From 7e0b99201881ba6ddf85ac27199b035e0391fdb6 Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Wed, 30 Mar 2022 00:12:57 +0300 Subject: [PATCH 35/38] use setting CoverImageMediaId to null and remove cover image in the update request --- .../Admin/Blogs/IBlogPostAdminAppService.cs | 1 - .../Admin/Blogs/BlogPostAdminAppService.cs | 21 ++++++------------- .../BlogPostAdminClientProxy.Generated.cs | 8 ------- .../Admin/Blogs/BlogPostAdminController.cs | 8 ------- .../Pages/CmsKit/BlogPosts/update.js | 8 ++----- 5 files changed, 8 insertions(+), 38 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs index 23562020d4..14704a26ad 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs @@ -13,5 +13,4 @@ public interface IBlogPostAdminAppService CreateBlogPostDto, UpdateBlogPostDto> { - Task RemoveCoverImageAsync(Guid id); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs index ba346b752e..3c79e6220b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs @@ -69,8 +69,13 @@ public class BlogPostAdminAppService : CmsKitAppServiceBase, IBlogPostAdminAppSe blogPost.SetShortDescription(input.ShortDescription); blogPost.SetContent(input.Content); blogPost.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp); + + if (blogPost.CoverImageMediaId != null && input.CoverImageMediaId == null) + { + await MediaDescriptorAdminAppService.DeleteAsync(blogPost.CoverImageMediaId.Value); + } blogPost.CoverImageMediaId = input.CoverImageMediaId; - + if (blogPost.Slug != input.Slug) { await BlogPostManager.SetSlugUrlAsync(blogPost, input.Slug); @@ -115,18 +120,4 @@ public class BlogPostAdminAppService : CmsKitAppServiceBase, IBlogPostAdminAppSe { await BlogPostRepository.DeleteAsync(id); } - - [Authorize(CmsKitAdminPermissions.BlogPosts.Update)] - public virtual async Task RemoveCoverImageAsync(Guid id) - { - var blogPost = await BlogPostRepository.GetAsync(id); - if (blogPost?.CoverImageMediaId == null) - { - return; - } - - await MediaDescriptorAdminAppService.DeleteAsync(blogPost.CoverImageMediaId.Value); - - blogPost.CoverImageMediaId = null; - } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/BlogPostAdminClientProxy.Generated.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/BlogPostAdminClientProxy.Generated.cs index 0f201fb469..560ba4e2de 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/BlogPostAdminClientProxy.Generated.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/BlogPostAdminClientProxy.Generated.cs @@ -55,12 +55,4 @@ public partial class BlogPostAdminClientProxy : ClientProxyBase Date: Wed, 30 Mar 2022 00:18:34 +0300 Subject: [PATCH 36/38] code clean --- .../Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs | 1 - .../Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs | 2 +- .../wwwroot/client-proxies/cms-kit-admin-proxy.js | 8 -------- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs index 14704a26ad..314b7a1def 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs @@ -1,5 +1,4 @@ using System; -using System.Threading.Tasks; using Volo.Abp.Application.Services; namespace Volo.CmsKit.Admin.Blogs; diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs index 3c79e6220b..d78571ba21 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs @@ -64,7 +64,7 @@ public class BlogPostAdminAppService : CmsKitAppServiceBase, IBlogPostAdminAppSe public virtual async Task UpdateAsync(Guid id, UpdateBlogPostDto input) { var blogPost = await BlogPostRepository.GetAsync(id); - + blogPost.SetTitle(input.Title); blogPost.SetShortDescription(input.ShortDescription); blogPost.SetContent(input.Content); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js index 2cb7d2ab98..0a1424d92a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js @@ -391,14 +391,6 @@ }, ajaxParams)); }; - volo.cmsKit.admin.blogs.blogPostAdmin.removeCoverImage = function(id, ajaxParams) { - return abp.ajax($.extend(true, { - url: abp.appPath + 'api/cms-kit-admin/blogs/blog-posts/' + id + '/cover-image', - type: 'DELETE', - dataType: null - }, ajaxParams)); - }; - })(); })(); From b12d8f71c993e34444bcffe8ae6d82be46de489d Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Wed, 30 Mar 2022 09:37:16 +0300 Subject: [PATCH 37/38] load blogpost-scroll-index when it's feature is enabled --- .../Pages/Public/CmsKit/Blogs/BlogPost.cshtml | 2 +- .../CmsKit/Blogs/{blogpost.js => blogpost-scroll-index.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/{blogpost.js => blogpost-scroll-index.js} (100%) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml index d28a57889e..709d96182f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml @@ -40,13 +40,13 @@ { + } - } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/blogpost.js b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/blogpost-scroll-index.js similarity index 100% rename from modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/blogpost.js rename to modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/blogpost-scroll-index.js From 7aad8e5a25940f06e227de90edd22cd13fe18a9f Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 30 Mar 2022 10:38:04 +0300 Subject: [PATCH 38/38] Make select clearable --- .../Pages/Public/CmsKit/Blogs/Index.cshtml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml index 32df5fb2fd..060f0c5c95 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml @@ -28,6 +28,8 @@