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

Loading…
Cancel
Save