diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json index 1b4c9a69f8..7987b9ab32 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json @@ -6,6 +6,7 @@ "Volo.AbpIo.Commercial:010003": "You are not owner of this organization!", "OrganizationNotFoundMessage": "No organization found!", "DeveloperCount": "Developer count", + "QuestionCount": "Question count", "Owners": "Owners", "AddMember": "Add member", "AddOwner": "Add owner", diff --git a/docs/en/Modules/Docs.md b/docs/en/Modules/Docs.md index c42a3c2bcc..afcc1a9dd7 100644 --- a/docs/en/Modules/Docs.md +++ b/docs/en/Modules/Docs.md @@ -328,7 +328,7 @@ You can use [ABP Framework](https://github.com/abpframework/abp/) GitHub documen For `SQL` databases, you can use the below `T-SQL` command to insert the specified sample into your `DocsProjects` table: ```mssql -INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939658', N'ABP framework (GitHub)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'GitHub', N'{"GitHubRootUrl":"https://github.com/abpframework/abp/tree/{version}/docs","GitHubAccessToken":"***"}', N'/', N'master') +INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName], [ParametersDocumentName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939658', N'ABP framework (GitHub)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'GitHub', N'{"GitHubRootUrl":"https://github.com/abpframework/abp/tree/{version}/docs","GitHubAccessToken":"***"}', N'/', N'master', N'') ``` Be aware that `GitHubAccessToken` is masked. It's a private token and you must get your own token and replace the `***` string. @@ -366,7 +366,7 @@ You can use [ABP Framework](https://github.com/abpframework/abp/) GitHub documen For `SQL` databases, you can use the below `T-SQL` command to insert the specified sample into your `DocsProjects` table: ```mssql -INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939659', N'ABP framework (FileSystem)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'FileSystem', N'{"Path":"C:\\Github\\abp\\docs"}', N'/', NULL) +INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName], [ParametersDocumentName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939659', N'ABP framework (FileSystem)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'FileSystem', N'{"Path":"C:\\Github\\abp\\docs"}', N'/', NULL, N'') ``` Add one of the sample projects above and run the application. In the menu you will see `Documents` link, click the menu link to open the documents page. diff --git a/docs/zh-Hans/Modules/Docs.md b/docs/zh-Hans/Modules/Docs.md index 3bd71d554f..f2a92334fb 100644 --- a/docs/zh-Hans/Modules/Docs.md +++ b/docs/zh-Hans/Modules/Docs.md @@ -321,7 +321,7 @@ There are no projects yet! 对于 `SQL` 数据库,你可以使用下面的 `T-SQL` 命令将指定的示例插入到 `DocsProjects` 表中: ```mssql -INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939658', N'ABP framework (GitHub)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'GitHub', N'{"GitHubRootUrl":"https://github.com/abpframework/abp/tree/{version}/docs/zh-Hans/","GitHubAccessToken":"***"}', N'/', N'master') +INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName], [ParametersDocumentName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939658', N'ABP framework (GitHub)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'GitHub', N'{"GitHubRootUrl":"https://github.com/abpframework/abp/tree/{version}/docs","GitHubAccessToken":"***"}', N'/', N'master', N'') ``` 请注意,`GitHubAccessToken` 被屏蔽了.它是一个私人令牌,你必须获得自己的令牌并替换 `***` 字符串. @@ -359,7 +359,7 @@ INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocume 对于 `SQL` 数据库,你可以使用下面的 `T-SQL` 命令将指定的示例插入到 `DocsProjects` 表中: ```mssql -INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939659', N'ABP framework (FileSystem)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'FileSystem', N'{"Path":"C:\\Github\\abp\\docs"}', N'/', NULL) +INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName], [ParametersDocumentName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939659', N'ABP framework (FileSystem)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'FileSystem', N'{"Path":"C:\\Github\\abp\\docs"}', N'/', NULL, N'') ``` 添加上面的一个示例项目后运行该应用程序. 在菜单中你会看到`文档` 链接,点击菜单链接打开文档页面. diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AbpAuditingOptions.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AbpAuditingOptions.cs index db13bdaf74..58a0713014 100644 --- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AbpAuditingOptions.cs +++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AbpAuditingOptions.cs @@ -30,10 +30,10 @@ namespace Volo.Abp.Auditing /// Default: true. /// public bool IsEnabledForAnonymousUsers { get; set; } - - /// - /// Audit log on exceptions. - /// Default: true. + + /// + /// Audit log on exceptions. + /// Default: true. /// public bool AlwaysLogOnException { get; set; } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController.cs index b6bfe203db..3c8d5dc4db 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController.cs @@ -1,35 +1,35 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; -using Volo.Abp.Auditing; - -namespace Volo.Abp.AspNetCore.Mvc.Auditing -{ - [Route("api/audit-test")] - [Audited] - public class AuditTestController : AbpController - { - private readonly AbpAuditingOptions _options; - - public AuditTestController(IOptions options) - { - _options = options.Value; - } - - [Route("audit-success")] - public IActionResult AuditSuccessForGetRequests() - { - return Ok(); - } - - [Route("audit-fail")] - public IActionResult AuditFailForGetRequests() - { - throw new UserFriendlyException("Exception occurred!"); - } - [Route("audit-fail-object")] - public object AuditFailForGetRequestsReturningObject() - { - throw new UserFriendlyException("Exception occurred!"); - } - } -} +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Options; +using Volo.Abp.Auditing; + +namespace Volo.Abp.AspNetCore.Mvc.Auditing +{ + [Route("api/audit-test")] + [Audited] + public class AuditTestController : AbpController + { + private readonly AbpAuditingOptions _options; + + public AuditTestController(IOptions options) + { + _options = options.Value; + } + + [Route("audit-success")] + public IActionResult AuditSuccessForGetRequests() + { + return Ok(); + } + + [Route("audit-fail")] + public IActionResult AuditFailForGetRequests() + { + throw new UserFriendlyException("Exception occurred!"); + } + [Route("audit-fail-object")] + public object AuditFailForGetRequestsReturningObject() + { + throw new UserFriendlyException("Exception occurred!"); + } + } +} diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController_Tests.cs index f0371ef51a..49bc689e14 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController_Tests.cs @@ -1,65 +1,65 @@ -using System; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Options; -using NSubstitute; -using System.Threading.Tasks; -using Volo.Abp.Auditing; -using Xunit; - -namespace Volo.Abp.AspNetCore.Mvc.Auditing -{ - public class AuditTestController_Tests : AspNetCoreMvcTestBase - { - private readonly AbpAuditingOptions _options; - private IAuditingStore _auditingStore; - - public AuditTestController_Tests() - { - _options = ServiceProvider.GetRequiredService>().Value; - _auditingStore = ServiceProvider.GetRequiredService(); - } - - protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services) - { - _auditingStore = Substitute.For(); - services.Replace(ServiceDescriptor.Singleton(_auditingStore)); - base.ConfigureServices(context, services); - } - - [Fact] - public async Task Should_Trigger_Middleware_And_AuditLog_Success_For_GetRequests() - { - _options.IsEnabledForGetRequests = true; - _options.AlwaysLogOnException = false; - await GetResponseAsync("api/audit-test/audit-success"); - await _auditingStore.Received().SaveAsync(Arg.Any()); - } - - [Fact] - public async Task Should_Trigger_Middleware_And_AuditLog_Exception_Always() - { - _options.IsEnabled = true; - _options.AlwaysLogOnException = true; - - try - { - await GetResponseAsync("api/audit-test/audit-fail", System.Net.HttpStatusCode.Forbidden); - } - catch { } - - await _auditingStore.Received().SaveAsync(Arg.Any()); - } - [Fact] - public async Task Should_Trigger_Middleware_And_AuditLog_Exception_When_Returns_Object() - { - _options.IsEnabled = true; - _options.AlwaysLogOnException = true; - - await GetResponseAsync("api/audit-test/audit-fail-object", System.Net.HttpStatusCode.Forbidden); - - await _auditingStore.Received().SaveAsync(Arg.Any()); - } - } -} +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Options; +using NSubstitute; +using System.Threading.Tasks; +using Volo.Abp.Auditing; +using Xunit; + +namespace Volo.Abp.AspNetCore.Mvc.Auditing +{ + public class AuditTestController_Tests : AspNetCoreMvcTestBase + { + private readonly AbpAuditingOptions _options; + private IAuditingStore _auditingStore; + + public AuditTestController_Tests() + { + _options = ServiceProvider.GetRequiredService>().Value; + _auditingStore = ServiceProvider.GetRequiredService(); + } + + protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services) + { + _auditingStore = Substitute.For(); + services.Replace(ServiceDescriptor.Singleton(_auditingStore)); + base.ConfigureServices(context, services); + } + + [Fact] + public async Task Should_Trigger_Middleware_And_AuditLog_Success_For_GetRequests() + { + _options.IsEnabledForGetRequests = true; + _options.AlwaysLogOnException = false; + await GetResponseAsync("api/audit-test/audit-success"); + await _auditingStore.Received().SaveAsync(Arg.Any()); + } + + [Fact] + public async Task Should_Trigger_Middleware_And_AuditLog_Exception_Always() + { + _options.IsEnabled = true; + _options.AlwaysLogOnException = true; + + try + { + await GetResponseAsync("api/audit-test/audit-fail", System.Net.HttpStatusCode.Forbidden); + } + catch { } + + await _auditingStore.Received().SaveAsync(Arg.Any()); + } + [Fact] + public async Task Should_Trigger_Middleware_And_AuditLog_Exception_When_Returns_Object() + { + _options.IsEnabled = true; + _options.AlwaysLogOnException = true; + + await GetResponseAsync("api/audit-test/audit-fail-object", System.Net.HttpStatusCode.Forbidden); + + await _auditingStore.Received().SaveAsync(Arg.Any()); + } + } +} diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/BloggingPage.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/BloggingPage.cs index ed3bb0971c..0808432521 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/BloggingPage.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/BloggingPage.cs @@ -1,5 +1,7 @@ using System; +using System.Linq; using System.Text; +using System.Text.RegularExpressions; using CommonMark; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.Localization; @@ -30,30 +32,27 @@ namespace Volo.Blogging.Pages.Blog public string GetShortContent(string content) //TODO: This should be moved to its own place! { - var openingTag = "

"; - var closingTag = "

"; - var html = RenderMarkdownToString(content); - if (string.IsNullOrWhiteSpace(html)) + var plainText = Regex.Replace(html, "/<[^>]*>/g", ""); + + if (string.IsNullOrWhiteSpace(plainText)) { return ""; } - var splittedHtml = html.Split(closingTag); - if (splittedHtml.Length < 1) + var firsParag = plainText.Split(Environment.NewLine).FirstOrDefault(s => !string.IsNullOrWhiteSpace(s)); + + if (firsParag == null) { - return ""; + return plainText; } - var firstHtmlPart = splittedHtml[0]; - var paragraphStartIndex = firstHtmlPart.IndexOf(openingTag, StringComparison.Ordinal) + openingTag.Length; - - if (firstHtmlPart.Length - paragraphStartIndex <= MaxShortContentLength) + if (firsParag.Length <= MaxShortContentLength) { - return firstHtmlPart.Substring(paragraphStartIndex); + return firsParag; } - return firstHtmlPart.Substring(paragraphStartIndex, MaxShortContentLength) + "..."; + return firsParag.Substring(0, MaxShortContentLength) + "..."; } public IHtmlContent RenderMarkdownToHtml(string content) diff --git a/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs b/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs index 13f29184a9..5b7309a310 100644 --- a/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs +++ b/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs @@ -5,7 +5,9 @@ using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.UI.Bundling; +using Volo.Abp.AspNetCore.Mvc.UI.Packages; using Volo.Abp.AspNetCore.Mvc.UI.Packages.Prismjs; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; using Volo.Abp.VirtualFileSystem; @@ -18,7 +20,11 @@ namespace Volo.Docs { [DependsOn( typeof(DocsHttpApiModule), - typeof(AbpAspNetCoreMvcUiBootstrapModule) + typeof(AbpAutoMapperModule), + typeof(AbpAspNetCoreMvcUiBootstrapModule), + typeof(AbpAspNetCoreMvcUiThemeSharedModule), + typeof(AbpAspNetCoreMvcUiPackagesModule), + typeof(AbpAspNetCoreMvcUiBundlingModule) )] public class DocsWebModule : AbpModule { diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml index 3430503f7d..7029cc410a 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml @@ -5,6 +5,7 @@ @using Volo.Abp.AspNetCore.Mvc.UI.Packages.Clipboard @using Volo.Abp.AspNetCore.Mvc.UI.Packages.MalihuCustomScrollbar @using Volo.Abp.AspNetCore.Mvc.UI.Packages.Popper +@using Volo.Docs.Pages.Documents.Shared.DocumentNotFoundComponent @using Volo.Abp.AspNetCore.Mvc.UI.Packages.Prismjs @using Volo.Abp.AspNetCore.Mvc.UI.Theming @using Volo.Docs @@ -39,269 +40,284 @@ } -
-
-
-
- -
- +
-
+
- @if (Model.ShowProjectsCombobox && Model.ProjectSelectItems.Count > 1) - { -
-
-
-
- -
+ @if (Model.ShowProjectsCombobox && Model.ProjectSelectItems.Count > 1) + { +
+
+
+
+ +
- + +
-
- } + } -
- @if (Model.VersionSelectItems.Any()) - { -
-
-
-
-
- -
+
+ @if (Model.VersionSelectItems.Any()) + { +
+
+
+
+
+ +
- + +
-
- } + } - @if (Model.LanguageSelectListItems.Count > 1) - { -
-
-
-
-
- + @if (Model.LanguageSelectListItems.Count > 1) + { +
+
+
+
+
+ +
+
-
-
- } -
+ } +
-
-
-
-
- -
+
+
+
+
+ +
- + +
-
- @if (Model.Navigation == null || !Model.Navigation.HasChildItems) - { -
- @L["NavigationDocumentNotFound"] -
- } - else - { - - } -
- -
-
- - @if (Model.Document != null) - { -
- +
+ + @if (Model.Document != null) + { +
+