|
|
@ -1,35 +1,38 @@ |
|
|
|
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
|
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
|
|
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
|
|
using Volo.Abp.Configuration; |
|
|
using Volo.Docs.Projects; |
|
|
using Volo.Docs.Projects; |
|
|
|
|
|
|
|
|
namespace Volo.Docs.Pages.Documents |
|
|
namespace Volo.Docs.Pages.Documents |
|
|
{ |
|
|
{ |
|
|
public class IndexModel : PageModel |
|
|
public class IndexModel : PageModel |
|
|
{ |
|
|
{ |
|
|
|
|
|
public string DocumentsUrlPrefix { get; set; } |
|
|
|
|
|
|
|
|
public IReadOnlyList<ProjectDto> Projects { get; set; } |
|
|
public IReadOnlyList<ProjectDto> Projects { get; set; } |
|
|
|
|
|
|
|
|
private readonly IProjectAppService _projectAppService; |
|
|
private readonly IProjectAppService _projectAppService; |
|
|
|
|
|
private readonly IConfigurationRoot _configuration; |
|
|
|
|
|
|
|
|
public IndexModel(IProjectAppService projectAppService) |
|
|
public IndexModel(IProjectAppService projectAppService, IConfigurationAccessor configurationAccessor) |
|
|
{ |
|
|
{ |
|
|
|
|
|
_configuration = configurationAccessor.Configuration; |
|
|
_projectAppService = projectAppService; |
|
|
_projectAppService = projectAppService; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<IActionResult> OnGetAsync() |
|
|
public async Task<IActionResult> OnGetAsync() |
|
|
{ |
|
|
{ |
|
|
|
|
|
DocumentsUrlPrefix = Convert.ToBoolean(_configuration["IncludeDocumentPrefixInUrl"]) ? "documents/" : ""; |
|
|
|
|
|
|
|
|
var listResult = await _projectAppService.GetListAsync(); |
|
|
var listResult = await _projectAppService.GetListAsync(); |
|
|
|
|
|
|
|
|
if (listResult.Items.Count == 1) |
|
|
if (listResult.Items.Count == 1) |
|
|
{ |
|
|
{ |
|
|
return RedirectToPage("./Project/Index", new |
|
|
return Redirect("./" + DocumentsUrlPrefix + listResult.Items[0].ShortName); |
|
|
{ |
|
|
|
|
|
projectName = listResult.Items[0].ShortName, |
|
|
|
|
|
version = DocsAppConsts.Latest, |
|
|
|
|
|
languageCode = "", |
|
|
|
|
|
documentName = listResult.Items[0].DefaultDocumentName |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Projects = listResult.Items; |
|
|
Projects = listResult.Items; |
|
|
|