Browse Source

Add TODO and change List to IReadOnlyList for CommentingViewComponent

pull/5067/head
Halil İbrahim Kalkan 6 years ago
parent
commit
6cd3e1f472
  1. 12
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs
  2. 1
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml

12
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs

@ -24,16 +24,20 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting
CommentPublicAppService = commentPublicAppService;
}
public virtual async Task<IViewComponentResult> InvokeAsync(string entityType, string entityId, string loginUrl = null)
public virtual async Task<IViewComponentResult> InvokeAsync(
string entityType,
string entityId,
string loginUrl = null) //TODO: This can be a configuration (default: /Account/Login) rather than passing it to the component
{
var result = await CommentPublicAppService.GetListAsync(entityType, entityId);
var result = await CommentPublicAppService
.GetListAsync(entityType, entityId);
var viewModel = new CommentingViewModel
{
EntityId = entityId,
EntityType = entityType,
LoginUrl = loginUrl,
Comments = result.Items.ToList()
Comments = result.Items
};
return View("~/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml", viewModel);
@ -47,7 +51,7 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting
public string LoginUrl { get; set; }
public List<CommentWithDetailsDto> Comments { get; set; }
public IReadOnlyList<CommentWithDetailsDto> Comments { get; set; }
}
}
}

1
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml

@ -1,7 +1,6 @@
@using Microsoft.AspNetCore.Html
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.Users
@using Volo.CmsKit.Comments
@using Volo.CmsKit.Localization
@using Volo.CmsKit.Public.Comments
@inject ICurrentUser CurrentUser

Loading…
Cancel
Save