Fixed display of empty settings tab
authorAlexander Ebert <ebert@woltlab.com>
Fri, 11 Jul 2014 16:04:37 +0000 (18:04 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 11 Jul 2014 16:04:37 +0000 (18:04 +0200)
com.woltlab.wcf/templates/messageFormSettingsInline.tpl
com.woltlab.wcf/templates/messageFormTabsInline.tpl

index 8cb52cda61a5247998b54bef1907c6458fb15d44..60874c59993c83d85074185cdfc0084eb811f810 100644 (file)
@@ -1,55 +1,42 @@
-<fieldset id="settings_{if $wysiwygSelector|isset}{$wysiwygSelector}{else}text{/if}" class="container containerPadding">
-       {event name='beforeSettings'}
-       
-       <dl class="wide">
-               {if $__wcf->getSession()->getPermission('user.message.canUseBBCodes')}
-                       <dt></dt>
-                       <dd>
-                               <label><input id="preParse_{if $wysiwygSelector|isset}{$wysiwygSelector}{else}text{/if}" name="preParse" type="checkbox" value="1"{if !$enableBBCodes|isset || $enableBBCodes} checked="checked"{/if} data-submit-empty="0" /> {lang}wcf.message.settings.preParse{/lang}</label>
-                               <small>{lang}wcf.message.settings.preParse.description{/lang}</small>
-                       </dd>
-               {/if}
-               {if MODULE_SMILEY && $__wcf->getSession()->getPermission('user.message.canUseSmilies')}
-                       <dt></dt>
-                       <dd>
-                               <label><input id="enableSmilies_{if $wysiwygSelector|isset}{$wysiwygSelector}{else}text{/if}" name="enableSmilies" type="checkbox" value="1"{if !$enableSmilies|isset || $enableSmilies} checked="checked"{/if} data-submit-empty="0" /> {lang}wcf.message.settings.enableSmilies{/lang}</label>
-                               <small>{lang}wcf.message.settings.enableSmilies.description{/lang}</small>
-                       </dd>
-               {/if}
-               {if $__wcf->getSession()->getPermission('user.message.canUseBBCodes')}
-                       <dt></dt>
-                       <dd>
-                               <label><input id="enableBBCodes_{if $wysiwygSelector|isset}{$wysiwygSelector}{else}text{/if}" name="enableBBCodes" type="checkbox" value="1"{if !$enableBBCodes|isset || $enableBBCodes} checked="checked"{/if} data-submit-empty="0" /> {lang}wcf.message.settings.enableBBCodes{/lang}</label>
-                               <small>{lang}wcf.message.settings.enableBBCodes.description{/lang}</small>
-                       </dd>
-               {/if}
-               
-               {event name='settings'}
-       </dl>
-       
-       {event name='afterSettings'}
-</fieldset>
-<script data-relocate="true">
-       $(function() {
-               WCF.System.Event.addListener('com.woltlab.wcf.messageOptionsInline', 'submit_{if $wysiwygSelector|isset}{$wysiwygSelector}{else}text{/if}', function(parameters) {
-                       var $settings = $('#settings_{if $wysiwygSelector|isset}{$wysiwygSelector}{else}text{/if}');
-                       $settings.find('input, select, textarea').each(function(index, element) {
-                               var $element = $(element);
-                               var $value = $element.val();
-                               
-                               if ($element.getTagName() == 'input') {
-                                       if (!$element.is(':checked')) {
-                                               if ($element.prop('type') == 'checkbox' && $element.data('submitEmpty') !== undefined) {
-                                                       $value = $element.data('submitEmpty');
-                                               }
-                                               else {
-                                                       return true;
+{hascontent}
+       <fieldset id="settings_{if $wysiwygSelector|isset}{$wysiwygSelector}{else}text{/if}" class="container containerPadding">
+               {content}
+                       {event name='beforeSettings'}
+                       
+                       {capture assign='__messageFormSettingsInlineSettings'}{event name='settings'}{/capture}
+                       {assign var='__messageFormSettingsInlineSettings' value=$__messageFormSettingsInlineSettings|trim}
+                       
+                       {if $__messageFormSettingsInlineSettings}
+                               <dl class="wide">
+                                       {@$__messageFormSettingsInlineSettings}
+                               </dl>
+                       {/if}
+                       
+                       {event name='afterSettings'}
+               {/content}
+       </fieldset>
+       <script data-relocate="true">
+               $(function() {
+                       WCF.System.Event.addListener('com.woltlab.wcf.messageOptionsInline', 'submit_{if $wysiwygSelector|isset}{$wysiwygSelector}{else}text{/if}', function(parameters) {
+                               var $settings = $('#settings_{if $wysiwygSelector|isset}{$wysiwygSelector}{else}text{/if}');
+                               $settings.find('input, select, textarea').each(function(index, element) {
+                                       var $element = $(element);
+                                       var $value = $element.val();
+                                       
+                                       if ($element.getTagName() == 'input') {
+                                               if (!$element.is(':checked')) {
+                                                       if ($element.prop('type') == 'checkbox' && $element.data('submitEmpty') !== undefined) {
+                                                               $value = $element.data('submitEmpty');
+                                                       }
+                                                       else {
+                                                               return true;
+                                                       }
                                                }
                                        }
-                               }
-                               
-                               parameters[$element.prop('name')] = $value;
+                                       
+                                       parameters[$element.prop('name')] = $value;
+                               });
                        });
                });
-       });
-</script>
+       </script>
+{/hascontent}
index b426f8e971c8b34a63eb47759b5b573a766f0ed0..0b25d9ef30a9f9e498f15629a3775cb135876e3b 100644 (file)
@@ -1,12 +1,16 @@
 {assign var=smileyCategories value=$__wcf->getSmileyCache()->getCategories()}
 {if !$permissionCanUseSmilies|isset}{assign var=permissionCanUseSmilies value='user.message.canUseSmilies'}{/if}
 {if !$wysiwygContainerID|isset}{assign var=wysiwygContainerID value='text'}{/if}
+
+{capture assign='__messageFormSettingsInlineContent'}{include file='messageFormSettingsInline'}{/capture}
+{assign var='__messageFormSettingsInlineContent' value=$__messageFormSettingsInlineContent|trim}
+
 <div class="messageTabMenu"{if $preselectTabMenu|isset} data-preselect="{$preselectTabMenu}"{/if}>
        <nav class="messageTabMenuNavigation jsOnly">
                <ul>
                        {if MODULE_SMILEY && $__wcf->getSession()->getPermission($permissionCanUseSmilies) && $smileyCategories|count}<li data-name="smilies"><a>{lang}wcf.message.smilies{/lang}</a></li>{/if}
                        {if MODULE_ATTACHMENT && !$attachmentHandler|empty && $attachmentHandler->canUpload()}<li data-name="attachments"><a>{lang}wcf.attachment.attachments{/lang}</a></li>{/if}
-                       <li data-name="settings"><a>{lang}wcf.message.settings{/lang}</a></li>
+                       {if $__messageFormSettingsInlineContent}<li data-name="settings"><a>{lang}wcf.message.settings{/lang}</a></li>{/if}
                        {event name='tabMenuTabs'}
                </ul>
        </nav>
@@ -14,7 +18,7 @@
        {if MODULE_SMILEY && $__wcf->getSession()->getPermission($permissionCanUseSmilies) && $smileyCategories|count}{include file='messageFormSmilies'}{/if}
        {if MODULE_ATTACHMENT && !$attachmentHandler|empty && $attachmentHandler->canUpload()}{include file='messageFormAttachments'}{/if}
        
-       {include file='messageFormSettingsInline'}
+       {if $__messageFormSettingsInlineContent}{@$__messageFormSettingsInlineContent}{/if}
        
        {event name='tabMenuContents'}
 </div>