Replace use of `WCF.Search.User` with `Ui/User/Search/Input` (#4096)
authorMatthias Schmidt <gravatronics@live.com>
Wed, 24 Mar 2021 08:02:24 +0000 (09:02 +0100)
committerGitHub <noreply@github.com>
Wed, 24 Mar 2021 08:02:24 +0000 (09:02 +0100)
* Replace use of `WCF.Search.User` with `Ui/User/Search/Input`

See #3876

* Remove obsolete TODO

See 9d7cfda776e5c3809babfeb003d1212c29413619

Co-authored-by: Alexander Ebert <ebert@woltlab.com>
Co-authored-by: Alexander Ebert <ebert@woltlab.com>
com.woltlab.wcf/templates/membersList.tpl
com.woltlab.wcf/templates/moderationQueueAssignUser.tpl
com.woltlab.wcf/templates/search.tpl
com.woltlab.wcf/templates/userSearch.tpl
wcfsetup/install/files/acp/templates/attachmentList.tpl
wcfsetup/install/files/acp/templates/paidSubscriptionTransactionLogList.tpl
wcfsetup/install/files/acp/templates/paidSubscriptionUserAdd.tpl
wcfsetup/install/files/acp/templates/paidSubscriptionUserList.tpl
wcfsetup/install/files/acp/templates/userTrophyList.tpl

index 3aafb91aa88d8eb2d68d11f1397e765bd4c0c55c..2ef674f4b5a750841eddfcb6e420021b44c6feef 100644 (file)
                
                new WCF.User.Action.Follow($('.userList > li'));
                new WCF.User.Action.Ignore($('.userList > li'));
-               
-               new WCF.Search.User('#searchUsername', function(data) {
-                       var $link = '{link controller='User' id=2147483646 title='wcfTitlePlaceholder' encode=false}{/link}';
-                       window.location = $link.replace('2147483646', data.objectID).replace('wcfTitlePlaceholder', data.label);
-               }, false, [ ], false);
+       });
+       
+       require(['WoltLabSuite/Core/Ui/User/Search/Input'], (UiUserSearchInput) => {
+               new UiUserSearchInput(document.getElementById('searchUsername'), {
+                       callbackSelect(item) {
+                               const link = '{link controller='User' id=2147483646 title='wcftitleplaceholder' encode=false}{/link}';
+                               window.location = link.replace('2147483646', item.dataset.objectId).replace('wcftitleplaceholder', item.dataset.label);
+                       }
+               });
        });
 </script>
 
index 739019f3849a2a1a98dda94b90293434613b0233..7005546cfc28c27b468a900929ee3e3d87c044a2 100644 (file)
                <button data-type="submit">{lang}wcf.global.button.submit{/lang}</button>
        </div>
 </div>
-<script>
-       $(function() {
-               new WCF.Search.User('#assignedUsername');
-               $('#assignedUsername').click(function() {
-                       $(this).parents('li').find('input[type=radio]').click();
+
+<script data-relocate="true">
+       require(['WoltLabSuite/Core/Ui/User/Search/Input'], (UiUserSearchInput) => {
+               const username = document.getElementById('assignedUsername');
+               new UiUserSearchInput(username);
+               
+               username.addEventListener('click', (event) => {
+                       event.currentTarget.closest('li').querySelector('input[type=radio]').click();
                });
        });
 </script>
index 5b68bbf0f483850f078ed77e173da4dbb8af003c..6d74fb60dc5373ad4e4aa2f50c84081dff59d208 100644 (file)
 </form>
 
 <script data-relocate="true">
-       $(function() {
-               new WCF.Search.User($('#searchAuthor'), function(data) {
-                       $('#searchAuthor').val(data.label);//.focus();
-               });
+       require(['WoltLabSuite/Core/Ui/User/Search/Input'], (UiUserSearchInput) => {
+               new UiUserSearchInput(document.getElementById('searchAuthor'));
        });
 </script>
 
index b015093859f2f75bad26f939e054f3bbcc1cc588..060d7d0490fb4176305c8a2011f6d0eeeb640b6f 100644 (file)
@@ -39,8 +39,8 @@
 </form>
 
 <script data-relocate="true">
-       $(function() {
-               new WCF.Search.User('#searchUsername', null, false, [ ], false);
+       require(['WoltLabSuite/Core/Ui/User/Search/Input'], (UiUserSearchInput) => {
+               new UiUserSearchInput(document.getElementById('searchUsername'));
        });
 </script>
 
index 748f7f4e0a5e65aa1c60c02c67eeec8b04ea0e01..22d59a445701cfa247cb5dd83dc7d239fc265953 100644 (file)
@@ -3,9 +3,12 @@
 <script data-relocate="true" src="{@$__wcf->getPath()}js/WCF.ImageViewer.js?v={@LAST_UPDATE_TIME}"></script>
 {include file='imageViewer'}
 <script data-relocate="true">
+       require(['WoltLabSuite/Core/Ui/User/Search/Input'], (UiUserSearchInput) => {
+               new UiUserSearchInput(document.getElementById('username'));
+       });
+       
        $(function() {
                new WCF.Action.Delete('wcf\\data\\attachment\\AttachmentAction', '.jsAttachmentRow');
-               new WCF.Search.User('#username', null, false, [ ], true);
        });
 </script>
 
index fcecd070e9a9f9078172efac601640655bcaff87..b712ee532bdd65a6c43c47e6ffd032d72d80bdd5 100644 (file)
@@ -1,8 +1,8 @@
 {include file='header' pageTitle='wcf.acp.paidSubscription.transactionLog.list'}
 
 <script data-relocate="true">
-       $(function() {
-               new WCF.Search.User('#username');
+       require(['WoltLabSuite/Core/Ui/User/Search/Input'], (UiUserSearchInput) => {
+               new UiUserSearchInput(document.getElementById('username'));
        });
 </script>
 
index 84c65fd51c7d1b4d4fa749426edb5c8be405baa3..b0d10592d36cefeccbbc4dc05c03e9b29b63cd0c 100644 (file)
@@ -2,8 +2,8 @@
 
 {if $action == 'add'}
        <script data-relocate="true">
-               $(function() {
-                       new WCF.Search.User('#username');
+               require(['WoltLabSuite/Core/Ui/User/Search/Input'], (UiUserSearchInput) => {
+                       new UiUserSearchInput(document.getElementById('username'));
                });
        </script>
 {/if}
index b1e229f09b2cf483b8e75c5a2edf2c73820dfc96..04fefc93e3f1f3bc156cc8712dfe40c16b2bcb73 100644 (file)
@@ -3,7 +3,10 @@
 <script data-relocate="true">
        $(function() {
                new WCF.Action.Delete('wcf\\data\\paid\\subscription\\user\\PaidSubscriptionUserAction', '.jsPaidSubscriptionUserRow');
-               new WCF.Search.User('#username');
+       });
+       
+       require(['WoltLabSuite/Core/Ui/User/Search/Input'], (UiUserSearchInput) => {
+               new UiUserSearchInput(document.getElementById('username'));
        });
 </script>
 
index e591a4b32bb7627e2276b5a20614f8ac16283a69..8dbdea322e49fbef7309fcd5e8b69ac3332c0de7 100644 (file)
@@ -1,12 +1,13 @@
 {include file='header' pageTitle='wcf.acp.menu.link.userTrophy.list'}
 
 <script data-relocate="true">
-       //<![CDATA[
+       require(['WoltLabSuite/Core/Ui/User/Search/Input'], (UiUserSearchInput) => {
+               new UiUserSearchInput(document.getElementById('username'));
+       });
+       
        $(function() {
-               new WCF.Search.User('#username');
                new WCF.Action.Delete('wcf\\data\\user\\trophy\\UserTrophyAction', '.userTrophyRow');
        });
-       //]]>
 </script>
 
 <header class="contentHeader">