Skip to content

Commit

Permalink
Merge pull request #5559 from WoltLab/comment-menu
Browse files Browse the repository at this point in the history
Dont show button for the comment menu if the menu has no entries
  • Loading branch information
BurntimeX authored Jun 28, 2023
2 parents bab4fcd + f72c3be commit 03f0bfa
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 78 deletions.
82 changes: 43 additions & 39 deletions com.woltlab.wcf/templates/commentList.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,47 +43,51 @@

{event name='commentStatus'}
</div>
<div class="comment__menu dropdown" id="commentOptions{@$comment->commentID}">
<button type="button" class="dropdownToggle" aria-label="{lang}wcf.global.button.more{/lang}">{icon name='ellipsis-vertical'}</button>
{hascontent}
<div class="comment__menu dropdown" id="commentOptions{@$comment->commentID}">
<button type="button" class="dropdownToggle" aria-label="{lang}wcf.global.button.more{/lang}">{icon name='ellipsis-vertical'}</button>

<ul class="dropdownMenu">
{if $comment->isDisabled && $commentCanModerate}
<li>
<a href="#" class="comment__option comment__option--enable">
{lang}wcf.comment.approve{/lang}
</a>
</li>
{/if}
{if $commentManager->supportsReport() && $__wcf->session->getPermission('user.profile.canReportContent')}
<li>
<a
href="#"
data-report-content="com.woltlab.wcf.comment.comment"
data-object-id="{$comment->commentID}"
class="comment__option comment__option--report"
>
{lang}wcf.moderation.report.reportContent{/lang}
</a>
</li>
{/if}
{if $comment->isEditable()}
<li>
<a href="#" class="comment__option comment__option--edit">
{lang}wcf.global.button.edit{/lang}
</a>
</li>
{/if}
{if $comment->isDeletable()}
<li>
<a href="#" class="comment__option comment__option--delete">
{lang}wcf.global.button.delete{/lang}
</a>
</li>
{/if}
<ul class="dropdownMenu">
{content}
{if $comment->isDisabled && $commentCanModerate}
<li>
<a href="#" class="comment__option comment__option--enable">
{lang}wcf.comment.approve{/lang}
</a>
</li>
{/if}
{if $commentManager->supportsReport() && $__wcf->session->getPermission('user.profile.canReportContent')}
<li>
<a
href="#"
data-report-content="com.woltlab.wcf.comment.comment"
data-object-id="{$comment->commentID}"
class="comment__option comment__option--report"
>
{lang}wcf.moderation.report.reportContent{/lang}
</a>
</li>
{/if}
{if $comment->isEditable()}
<li>
<a href="#" class="comment__option comment__option--edit">
{lang}wcf.global.button.edit{/lang}
</a>
</li>
{/if}
{if $comment->isDeletable()}
<li>
<a href="#" class="comment__option comment__option--delete">
{lang}wcf.global.button.delete{/lang}
</a>
</li>
{/if}

{event name='commentMenuOptions'}
</ul>
</div>
{event name='commentMenuOptions'}
{/content}
</ul>
</div>
{/hascontent}

{event name='commentHeader'}
</div>
Expand Down
82 changes: 43 additions & 39 deletions com.woltlab.wcf/templates/commentResponseList.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,47 +41,51 @@
{event name='commentResponseStatus'}
</div>

<div class="commentResponse__menu dropdown" id="commentResponseOptions{@$response->responseID}">
<button type="button" class="dropdownToggle" aria-label="{lang}wcf.global.button.more{/lang}">{icon name='ellipsis-vertical'}</button>
{hascontent}
<div class="commentResponse__menu dropdown" id="commentResponseOptions{@$response->responseID}">
<button type="button" class="dropdownToggle" aria-label="{lang}wcf.global.button.more{/lang}">{icon name='ellipsis-vertical'}</button>

<ul class="dropdownMenu">
{if $response->isDisabled && $commentCanModerate}
<li>
<a href="#" class="commentResponse__option commentResponse__option--enable">
{lang}wcf.comment.approve{/lang}
</a>
</li>
{/if}
{if $commentManager->supportsReport() && $__wcf->session->getPermission('user.profile.canReportContent')}
<li>
<a
href="#"
data-report-content="com.woltlab.wcf.comment.response"
data-object-id="{$response->responseID}"
class="commentResponse__option commentResponse__option--report"
>
{lang}wcf.moderation.report.reportContent{/lang}
</a>
</li>
{/if}
{if $response->isEditable()}
<li>
<a href="#" class="commentResponse__option commentResponse__option--edit">
{lang}wcf.global.button.edit{/lang}
</a>
</li>
{/if}
{if $response->isDeletable()}
<li>
<a href="#" class="commentResponse__option commentResponse__option--delete">
{lang}wcf.global.button.delete{/lang}
</a>
</li>
{/if}
<ul class="dropdownMenu">
{content}
{if $response->isDisabled && $commentCanModerate}
<li>
<a href="#" class="commentResponse__option commentResponse__option--enable">
{lang}wcf.comment.approve{/lang}
</a>
</li>
{/if}
{if $commentManager->supportsReport() && $__wcf->session->getPermission('user.profile.canReportContent')}
<li>
<a
href="#"
data-report-content="com.woltlab.wcf.comment.response"
data-object-id="{$response->responseID}"
class="commentResponse__option commentResponse__option--report"
>
{lang}wcf.moderation.report.reportContent{/lang}
</a>
</li>
{/if}
{if $response->isEditable()}
<li>
<a href="#" class="commentResponse__option commentResponse__option--edit">
{lang}wcf.global.button.edit{/lang}
</a>
</li>
{/if}
{if $response->isDeletable()}
<li>
<a href="#" class="commentResponse__option commentResponse__option--delete">
{lang}wcf.global.button.delete{/lang}
</a>
</li>
{/if}

{event name='commentResponseMenuOptions'}
</ul>
</div>
{event name='commentResponseMenuOptions'}
{/content}
</ul>
</div>
{/hascontent}

{event name='commentResponseHeader'}
</div>
Expand Down

0 comments on commit 03f0bfa

Please sign in to comment.