Add reusable template for label selection
authorMatthias Schmidt <gravatronics@live.com>
Mon, 11 May 2020 16:26:51 +0000 (18:26 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 11 May 2020 16:26:51 +0000 (18:26 +0200)
Close #3301

com.woltlab.wcf/templates/__labelSelection.tpl [new file with mode: 0644]
com.woltlab.wcf/templates/articleList.tpl
com.woltlab.wcf/templates/categoryArticleList.tpl
com.woltlab.wcf/templates/unreadArticleList.tpl
com.woltlab.wcf/templates/watchedArticleList.tpl

diff --git a/com.woltlab.wcf/templates/__labelSelection.tpl b/com.woltlab.wcf/templates/__labelSelection.tpl
new file mode 100644 (file)
index 0000000..e8ff3d2
--- /dev/null
@@ -0,0 +1,32 @@
+{foreach from=$labelGroups item=labelGroup}
+       {if $labelGroup|count}
+               <dt>##<label>{$labelGroup->getTitle()}</label></dt>
+               <dd>
+                       <ul class="labelList jsOnly">
+                               <li class="dropdown labelChooser" id="labelGroup{@$labelGroup->groupID}" data-group-id="{@$labelGroup->groupID}">
+                                       <div class="dropdownToggle" data-toggle="labelGroup{@$labelGroup->groupID}"><span class="badge label">{lang}wcf.label.none{/lang}</span></div>
+                                       <div class="dropdownMenu">
+                                               <ul class="scrollableDropdownMenu">
+                                                       {foreach from=$labelGroup item=label}
+                                                               <li data-label-id="{@$label->labelID}"><span><span class="badge label{if $label->getClassNames()} {@$label->getClassNames()}{/if}">{$label->getTitle()}</span></span></li>
+                                                       {/foreach}
+                                               </ul>
+                                       </div>
+                               </li>
+                       </ul>
+                       {if $noLabelSelectionNoScript|empty}
+                               <noscript>
+                                       {foreach from=$labelGroups item=labelGroup}
+                                               <select name="labelIDs[{@$labelGroup->groupID}]">
+                                                       <option value="0">{lang}wcf.label.none{/lang}</option>
+                                                       <option value="-1">{lang}wcf.label.withoutSelection{/lang}</option>
+                                                       {foreach from=$labelGroup item=label}
+                                                               <option value="{@$label->labelID}"{if $labelIDs[$labelGroup->groupID]|isset && $labelIDs[$labelGroup->groupID] == $label->labelID} selected{/if}>{$label->getTitle()}</option>
+                                                       {/foreach}
+                                               </select>
+                                       {/foreach}
+                               </noscript>
+                       {/if}
+               </dd>
+       {/if}
+{/foreach}
index ecccf4db062804000a6db9a34a12a11661df8ceb..1e7c297af51f1f7a9bd4732b882754b255dec6fa 100644 (file)
                                
                                <div class="boxContent">
                                        <dl>
-                                               {foreach from=$labelGroups item=labelGroup}
-                                                       {if $labelGroup|count}
-                                                               <dt><label>{$labelGroup->getTitle()}</label></dt>
-                                                               <dd>
-                                                                       <ul class="labelList jsOnly">
-                                                                               <li class="dropdown labelChooser" id="labelGroup{@$labelGroup->groupID}" data-group-id="{@$labelGroup->groupID}">
-                                                                                       <div class="dropdownToggle" data-toggle="labelGroup{@$labelGroup->groupID}"><span class="badge label">{lang}wcf.label.none{/lang}</span></div>
-                                                                                       <div class="dropdownMenu">
-                                                                                               <ul class="scrollableDropdownMenu">
-                                                                                                       {foreach from=$labelGroup item=label}
-                                                                                                               <li data-label-id="{@$label->labelID}"><span><span class="badge label{if $label->getClassNames()} {@$label->getClassNames()}{/if}">{$label->getTitle()}</span></span></li>
-                                                                                                       {/foreach}
-                                                                                               </ul>
-                                                                                       </div>
-                                                                               </li>
-                                                                       </ul>
-                                                                       <noscript>
-                                                                               {foreach from=$labelGroups item=labelGroup}
-                                                                                       <select name="labelIDs[{@$labelGroup->groupID}]">
-                                                                                               <option value="0">{lang}wcf.label.none{/lang}</option>
-                                                                                               <option value="-1">{lang}wcf.label.withoutSelection{/lang}</option>
-                                                                                               {foreach from=$labelGroup item=label}
-                                                                                                       <option value="{@$label->labelID}"{if $labelIDs[$labelGroup->groupID]|isset && $labelIDs[$labelGroup->groupID] == $label->labelID} selected{/if}>{$label->getTitle()}</option>
-                                                                                               {/foreach}
-                                                                                       </select>
-                                                                               {/foreach}
-                                                                       </noscript>
-                                                               </dd>
-                                                       {/if}
-                                               {/foreach}
+                                               {include file='__labelSelection'}
                                        </dl>
                                        <div class="formSubmit">
                                                <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
index dedc0181d4d6daafa79d3ee901038635f2184524..527b13f3f8241e29ad9d2aeab4f113fedcd12ee8 100644 (file)
                                
                                <div class="boxContent">
                                        <dl>
-                                               {foreach from=$labelGroups item=labelGroup}
-                                                       {if $labelGroup|count}
-                                                               <dt><label>{$labelGroup->getTitle()}</label></dt>
-                                                               <dd>
-                                                                       <ul class="labelList jsOnly">
-                                                                               <li class="dropdown labelChooser" id="labelGroup{@$labelGroup->groupID}" data-group-id="{@$labelGroup->groupID}">
-                                                                                       <div class="dropdownToggle" data-toggle="labelGroup{@$labelGroup->groupID}"><span class="badge label">{lang}wcf.label.none{/lang}</span></div>
-                                                                                       <div class="dropdownMenu">
-                                                                                               <ul class="scrollableDropdownMenu">
-                                                                                                       {foreach from=$labelGroup item=label}
-                                                                                                               <li data-label-id="{@$label->labelID}"><span><span class="badge label{if $label->getClassNames()} {@$label->getClassNames()}{/if}">{$label->getTitle()}</span></span></li>
-                                                                                                       {/foreach}
-                                                                                               </ul>
-                                                                                       </div>
-                                                                               </li>
-                                                                       </ul>
-                                                                       <noscript>
-                                                                               {foreach from=$labelGroups item=labelGroup}
-                                                                                       <select name="labelIDs[{@$labelGroup->groupID}]">
-                                                                                               <option value="0">{lang}wcf.label.none{/lang}</option>
-                                                                                               <option value="-1">{lang}wcf.label.withoutSelection{/lang}</option>
-                                                                                               {foreach from=$labelGroup item=label}
-                                                                                                       <option value="{@$label->labelID}"{if $labelIDs[$labelGroup->groupID]|isset && $labelIDs[$labelGroup->groupID] == $label->labelID} selected{/if}>{$label->getTitle()}</option>
-                                                                                               {/foreach}
-                                                                                       </select>
-                                                                               {/foreach}
-                                                                       </noscript>
-                                                               </dd>
-                                                       {/if}
-                                               {/foreach}
+                                               {include file='__labelSelection'}
                                        </dl>
                                        <div class="formSubmit">
                                                <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
index e0851c72b129faf3d2898f2ab09a7cb6e18b3b5c..db54d216f884b7450b3ecc030426718a869afa6d 100644 (file)
                                
                                <div class="boxContent">
                                        <dl>
-                                               {foreach from=$labelGroups item=labelGroup}
-                                                       {if $labelGroup|count}
-                                                               <dt><label>{$labelGroup->getTitle()}</label></dt>
-                                                               <dd>
-                                                                       <ul class="labelList jsOnly">
-                                                                               <li class="dropdown labelChooser" id="labelGroup{@$labelGroup->groupID}" data-group-id="{@$labelGroup->groupID}">
-                                                                                       <div class="dropdownToggle" data-toggle="labelGroup{@$labelGroup->groupID}"><span class="badge label">{lang}wcf.label.none{/lang}</span></div>
-                                                                                       <div class="dropdownMenu">
-                                                                                               <ul class="scrollableDropdownMenu">
-                                                                                                       {foreach from=$labelGroup item=label}
-                                                                                                               <li data-label-id="{@$label->labelID}"><span><span class="badge label{if $label->getClassNames()} {@$label->getClassNames()}{/if}">{$label->getTitle()}</span></span></li>
-                                                                                                       {/foreach}
-                                                                                               </ul>
-                                                                                       </div>
-                                                                               </li>
-                                                                       </ul>
-                                                                       <noscript>
-                                                                               {foreach from=$labelGroups item=labelGroup}
-                                                                                       <select name="labelIDs[{@$labelGroup->groupID}]">
-                                                                                               <option value="0">{lang}wcf.label.none{/lang}</option>
-                                                                                               <option value="-1">{lang}wcf.label.withoutSelection{/lang}</option>
-                                                                                               {foreach from=$labelGroup item=label}
-                                                                                                       <option value="{@$label->labelID}"{if $labelIDs[$labelGroup->groupID]|isset && $labelIDs[$labelGroup->groupID] == $label->labelID} selected{/if}>{$label->getTitle()}</option>
-                                                                                               {/foreach}
-                                                                                       </select>
-                                                                               {/foreach}
-                                                                       </noscript>
-                                                               </dd>
-                                                       {/if}
-                                               {/foreach}
+                                               {include file='__labelSelection'}
                                        </dl>
                                        <div class="formSubmit">
                                                <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
index b3c83701f107d80b0c3c119fa457c5ecea9fa758..6d6ca7a7595483435e0931a26a9826de92a5119d 100644 (file)
                                
                                <div class="boxContent">
                                        <dl>
-                                               {foreach from=$labelGroups item=labelGroup}
-                                                       {if $labelGroup|count}
-                                                               <dt><label>{$labelGroup->getTitle()}</label></dt>
-                                                               <dd>
-                                                                       <ul class="labelList jsOnly">
-                                                                               <li class="dropdown labelChooser" id="labelGroup{@$labelGroup->groupID}" data-group-id="{@$labelGroup->groupID}">
-                                                                                       <div class="dropdownToggle" data-toggle="labelGroup{@$labelGroup->groupID}"><span class="badge label">{lang}wcf.label.none{/lang}</span></div>
-                                                                                       <div class="dropdownMenu">
-                                                                                               <ul class="scrollableDropdownMenu">
-                                                                                                       {foreach from=$labelGroup item=label}
-                                                                                                               <li data-label-id="{@$label->labelID}"><span><span class="badge label{if $label->getClassNames()} {@$label->getClassNames()}{/if}">{$label->getTitle()}</span></span></li>
-                                                                                                       {/foreach}
-                                                                                               </ul>
-                                                                                       </div>
-                                                                               </li>
-                                                                       </ul>
-                                                                       <noscript>
-                                                                               {foreach from=$labelGroups item=labelGroup}
-                                                                                       <select name="labelIDs[{@$labelGroup->groupID}]">
-                                                                                               <option value="0">{lang}wcf.label.none{/lang}</option>
-                                                                                               <option value="-1">{lang}wcf.label.withoutSelection{/lang}</option>
-                                                                                               {foreach from=$labelGroup item=label}
-                                                                                                       <option value="{@$label->labelID}"{if $labelIDs[$labelGroup->groupID]|isset && $labelIDs[$labelGroup->groupID] == $label->labelID} selected{/if}>{$label->getTitle()}</option>
-                                                                                               {/foreach}
-                                                                                       </select>
-                                                                               {/foreach}
-                                                                       </noscript>
-                                                               </dd>
-                                                       {/if}
-                                               {/foreach}
+                                               {include file='__labelSelection'}
                                        </dl>
                                        <div class="formSubmit">
                                                <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">