Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

Commit

Permalink
Omit dropdown menus if not login
Browse files Browse the repository at this point in the history
  • Loading branch information
wakuflair committed Jun 30, 2020
1 parent c4cee32 commit efa4234
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@model EasyAbp.EasyComment.Web.Pages.Shared.Components.CommentEditorWidget.CommentEditorViewModel
@inject IHtmlLocalizer<EasyCommentResource> L

<form method="post">
<form>
@if (Model.ShowLabel)
{
<label class="ec-leave-comment" asp-for="Content">@L["LeaveComment"]</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class CommentViewerWidgetController : EasyCommentController
{
[HttpGet]
[Route("showCommentViewer")]
public IActionResult ShowCommentViewer(Guid id, string content, bool refreshData)
public IActionResult ShowCommentViewer(Guid id, string content, bool fromServer)
{
return ViewComponent("CommentViewerWidget", new {id, content, refreshData});
return ViewComponent("CommentViewerWidget", new {id, content, fromServer});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public CommentViewerWidgetViewComponent(ICommentAppService service)
_service = service;
}

public async Task<IViewComponentResult> InvokeAsync(Guid id, string content, bool refreshData)
public async Task<IViewComponentResult> InvokeAsync(Guid id, string content, bool fromServer)
{
if (refreshData)
if (fromServer)
{
var comment = await _service.GetAsync(id);
content = comment.Content;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,29 @@
</abp-row>
</abp-column>
<abp-column size="_6" class="text-right">
<abp-dropdown>
<abp-dropdown-button button-type="Light" text="..." size="Medium"/>
<abp-dropdown-menu>
@if (comment.CreatorId == CurrentUser.GetId())
{
<abp-dropdown-item class="ec-edit-comment">@L["Edit"]</abp-dropdown-item>
}
<abp-dropdown-item class="ec-reply-comment">@L["Reply"]</abp-dropdown-item>
<abp-dropdown-item class="ec-reference-comment">@L["Reference"]</abp-dropdown-item>
@if (comment.CreatorId == CurrentUser.GetId())
{
<abp-dropdown-divider/>
<abp-dropdown-item class="ec-remove-comment">@L["Remove"]</abp-dropdown-item>
}
</abp-dropdown-menu>
</abp-dropdown>
@if (CurrentUser.IsAuthenticated)
{
<abp-dropdown>
<abp-dropdown-button button-type="Light" text="..." size="Medium"/>
<abp-dropdown-menu>
@if (comment.CreatorId == CurrentUser.GetId())
{
<abp-dropdown-item class="ec-edit-comment">@L["Edit"]</abp-dropdown-item>
}
<abp-dropdown-item class="ec-reply-comment">@L["Reply"]</abp-dropdown-item>
<abp-dropdown-item class="ec-reference-comment">@L["Reference"]</abp-dropdown-item>
@if (comment.CreatorId == CurrentUser.GetId())
{
<abp-dropdown-divider/>
<abp-dropdown-item class="ec-remove-comment">@L["Remove"]</abp-dropdown-item>
}
</abp-dropdown-menu>
</abp-dropdown>
}
</abp-column>
</abp-row>
<div class="ec-comment-holder">
@await Component.InvokeAsync("CommentViewerWidget", new {Id = comment.Id, Content = comment.Content,})
@await Component.InvokeAsync("CommentViewerWidget", new {Id = comment.Id, Content = comment.Content, FromServer = false})
</div>
<hr/>
</abp-container>
Expand Down

0 comments on commit efa4234

Please sign in to comment.