Avoid empty content interaction elements to avoid obsolete margin
authorMarcel Werk <burntime@woltlab.com>
Wed, 27 Apr 2022 13:19:06 +0000 (15:19 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 27 Apr 2022 13:19:06 +0000 (15:19 +0200)
com.woltlab.wcf/templates/contentInteraction.tpl

index 0777c18cae30c57fe01e0c499f2cc3b26c8897cb..17070b97e5c3400da5080daf5c4df1d8237cf212 100644 (file)
@@ -2,36 +2,51 @@
     {@$beforeContentInteraction}
 {/if}
 
-<div class="contentInteraction">
-    {hascontent}
-               <div class="contentInteractionPagination paginationTop">
-                       {content}{if $contentInteractionPagination|isset}{@$contentInteractionPagination}{/if}{/content}
-               </div>
-       {/hascontent}
+{capture assign='__contentInteractionPagination'}
+    {if $contentInteractionPagination|isset}{@$contentInteractionPagination}{/if}
+{/capture}
+{assign var='__contentInteractionPagination' value=$__contentInteractionPagination|trim}
 
-    <div class="contentInteractionButtonContainer">
-        {hascontent}
-            <div class="contentInteractionButtons">
-                {content}
-                    {event name='beforeButtons'}
-                    {if $contentInteractionButtons|isset}{@$contentInteractionButtons}{/if}
-                    {event name='afterButtons'}
-                {/content}
-            </div>
-        {/hascontent}
+{capture assign='__contentInteractionButtons'}
+    {event name='beforeButtons'}
+    {if $contentInteractionButtons|isset}{@$contentInteractionButtons}{/if}
+    {event name='afterButtons'}
+{/capture}
+{assign var='__contentInteractionButtons' value=$__contentInteractionButtons|trim}
+
+{capture assign='__contentInteractionDropdownItems'}
+    {event name='beforeDropdownItems'}
+    {if $contentInteractionDropdownItems|isset}{@$contentInteractionDropdownItems}{/if}
+    {event name='afterDropdownItems'}
+{/capture}
+{assign var='__contentInteractionDropdownItems' value=$__contentInteractionDropdownItems|trim}
+
+{if $__contentInteractionPagination || $__contentInteractionButtons || $__contentInteractionDropdownItems}
+    <div class="contentInteraction">
+        {if $__contentInteractionPagination}
+               <div class="contentInteractionPagination paginationTop">
+                       {@$__contentInteractionPagination}
+               </div>
+       {/if}
 
-        {hascontent}
-            <div class="contentInteractionDropdown dropdown jsOnly">
-                <a href="#" class="button small dropdownToggle" aria-label="{lang}wcf.global.button.more{/lang}"><span class="icon icon16 fa-ellipsis-v"></span></a>
+        {if $__contentInteractionButtons || $__contentInteractionDropdownItems}
+            <div class="contentInteractionButtonContainer">
+                {if $__contentInteractionButtons}
+                    <div class="contentInteractionButtons">
+                        {@$__contentInteractionButtons}
+                    </div>
+                {/if}
 
-                <ul class="contentInteractionDropdownItems dropdownMenu">
-                    {content}
-                        {event name='beforeDropdownItems'}
-                        {if $contentInteractionDropdownItems|isset}{@$contentInteractionDropdownItems}{/if}
-                        {event name='afterDropdownItems'}
-                    {/content}
-                </ul>
+                {if $__contentInteractionDropdownItems}
+                    <div class="contentInteractionDropdown dropdown jsOnly">
+                        <a href="#" class="button small dropdownToggle" aria-label="{lang}wcf.global.button.more{/lang}"><span class="icon icon16 fa-ellipsis-v"></span></a>
+
+                        <ul class="contentInteractionDropdownItems dropdownMenu">
+                            {@$__contentInteractionDropdownItems}
+                        </ul>
+                    </div>
+                {/if}
             </div>
-        {/hascontent}
+        {/if}
     </div>
-</div>
+{/if}