Dont show button for the comment menu if the menu has no entries
authorMarcel Werk <burntime@woltlab.com>
Wed, 28 Jun 2023 10:26:39 +0000 (12:26 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 28 Jun 2023 10:26:39 +0000 (12:26 +0200)
com.woltlab.wcf/templates/commentList.tpl
com.woltlab.wcf/templates/commentResponseList.tpl

index 4414b5bc0af90bfa42018aec7c9fe36b22c5792a..2b457b5835c83e2d03fa467d1eeecb5a4dee0dcb 100644 (file)
 
                                                {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>
index bbf7be61cd284eae056d85311509f3cfea08cd7b..f28cd6e8fc81dcd444bf55c152917f0cec673f0f 100644 (file)
                                                {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>