Ability to assign custom search dropdown label
authorAlexander Ebert <ebert@woltlab.com>
Thu, 2 Jun 2016 09:48:50 +0000 (11:48 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 2 Jun 2016 09:48:56 +0000 (11:48 +0200)
This label is verified through JavaScript, but can be used to set a
custom label that is actually valid but represents a parameter-based
subtype of an existing type.

For instance Burning Board has the type 'forum' but also special
subtypes to search a thread/board, but this causes the label to read
'forum' until the JS kicks in and changes it if necessary. Statically
setting the correct label ahead of time prevents flickering.

com.woltlab.wcf/templates/pageHeaderSearch.tpl

index 1dfe96def0e3bf29547b6bf299fa7b4b29fd96f3..57db8fc972c40668619e30841c18d8e8187424a5 100644 (file)
@@ -1,4 +1,7 @@
 {capture assign='__searchLink'}{link controller='Search'}{/link}{/capture}
+{if $__searchTypeLabel|empty}
+       {capture assign='__searchTypeLabel'}{lang}wcf.search.type.{if !$__searchObjectTypeName|empty}{@$__searchObjectTypeName}{else}everywhere{/if}{/lang}{/capture}
+{/if}
 
 {event name='settings'}
 
@@ -6,7 +9,7 @@
        <form method="post" action="{@$__searchLink}">
                <div id="pageHeaderSearchInputContainer" class="pageHeaderSearchInputContainer">
                        <div class="pageHeaderSearchType dropdown">
-                               <a href="#" class="button dropdownToggle">{lang}wcf.search.type.{if !$__searchObjectTypeName|empty}{@$__searchObjectTypeName}{else}everywhere{/if}{/lang}</a>
+                               <a href="#" class="button dropdownToggle">{@$__searchTypeLabel}</a>
                                <ul class="dropdownMenu">
                                        <li><a href="#" data-object-type="everywhere">{lang}wcf.search.type.everywhere{/lang}</a></li>
                                        <li class="dropdownDivider"></li>