Browse Source

Refactor docs

pull/625/head
Halil ibrahim Kalkan 8 years ago
parent
commit
e21fe863d1
  1. 4
      modules/docs/src/Volo.Docs.Web/Areas/Documents/TagHelpers/TreeTagHelper.cs
  2. 23
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs

4
modules/docs/src/Volo.Docs.Web/Areas/Documents/Helpers/TagHelpers/TreeTagHelper.cs → modules/docs/src/Volo.Docs.Web/Areas/Documents/TagHelpers/TreeTagHelper.cs

@ -5,8 +5,10 @@ using Microsoft.AspNetCore.Razor.TagHelpers;
using Volo.Docs.Documents; using Volo.Docs.Documents;
using Volo.Docs.Utils; using Volo.Docs.Utils;
namespace Volo.Docs.Areas.Documents.Helpers.TagHelpers namespace Volo.Docs.Areas.Documents.TagHelpers
{ {
//TODO: Better to convert element "document-nav-tree"
//TODO: Or better to convert to a partial view or to a view component instead of a tag helper!
[HtmlTargetElement("ul", Attributes = "root-node")] [HtmlTargetElement("ul", Attributes = "root-node")]
public class TreeTagHelper : TagHelper public class TreeTagHelper : TagHelper
{ {

23
modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs

@ -51,23 +51,15 @@ namespace Volo.Docs.Pages.Documents.Project
public async Task OnGetAsync() public async Task OnGetAsync()
{ {
Project = await _projectAppService.GetByShortNameAsync(ProjectName); await SetProjectAsync();
SetDocumentNames();
await SetVersionAsync(); await SetVersionAsync();
await SetDocumentAsync(); await SetDocumentAsync();
ConvertDocumentContentToHtml();
await SetNavigationAsync(); await SetNavigationAsync();
} }
private void SetDocumentNames() private async Task SetProjectAsync()
{ {
if (DocumentName.IsNullOrWhiteSpace()) Project = await _projectAppService.GetByShortNameAsync(ProjectName);
{
DocumentName = Project.DefaultDocumentName;
}
DocumentNameWithExtension = DocumentName + "." + Project.Format;
} }
private async Task SetVersionAsync() private async Task SetVersionAsync()
@ -164,6 +156,13 @@ namespace Volo.Docs.Pages.Documents.Project
private async Task SetDocumentAsync() private async Task SetDocumentAsync()
{ {
if (DocumentName.IsNullOrWhiteSpace())
{
DocumentName = Project.DefaultDocumentName;
}
DocumentNameWithExtension = DocumentName + "." + Project.Format;
try try
{ {
if (DocumentNameWithExtension.IsNullOrWhiteSpace()) if (DocumentNameWithExtension.IsNullOrWhiteSpace())
@ -193,6 +192,8 @@ namespace Volo.Docs.Pages.Documents.Project
//TODO: Handle it! //TODO: Handle it!
throw; throw;
} }
ConvertDocumentContentToHtml();
} }
private void ConvertDocumentContentToHtml() private void ConvertDocumentContentToHtml()

Loading…
Cancel
Save