From c8f7b2a145c2f942b731d26dc478f1e324bb6394 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Tue, 31 May 2016 23:11:13 +0200 Subject: [PATCH] Overhauled acp search --- wcfsetup/install/files/acp/js/WCF.ACP.js | 38 ++++++++++++++++ wcfsetup/install/files/acp/style/layout.scss | 43 +++++++++++++++++-- .../files/acp/templates/pageHeaderSearch.tpl | 12 ++++++ .../ACPSearchProviderAction.class.php | 2 +- .../install/files/lib/system/WCFACP.class.php | 4 +- .../search/acp/ACPSearchHandler.class.php | 8 +++- .../files/style/layout/pageHeader.scss | 10 +++-- 7 files changed, 106 insertions(+), 11 deletions(-) diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index baf9f33743..00dc7a2167 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -1875,6 +1875,12 @@ WCF.ACP.Category.Collapsible = WCF.Collapsible.SimpleRemote.extend({ * @see WCF.Search.Base */ WCF.ACP.Search = WCF.Search.Base.extend({ + /** + * name of the selected search provider + * @var string + */ + _providerName: '', + /** * @see WCF.Search.Base.init() */ @@ -1886,6 +1892,29 @@ WCF.ACP.Search = WCF.Search.Base.extend({ $('#pageHeaderSearch > form').on('submit', function(event) { event.preventDefault(); }); + + var $dropdown = WCF.Dropdown.getDropdownMenu('pageHeaderSearchType'); + $dropdown.find('a[data-provider-name]').on('click', $.proxy(function(event) { + event.preventDefault(); + var $button = $(event.target); + $('.pageHeaderSearchType > .button').text($button.text()); + + var $oldProviderName = this._providerName; + this._providerName = ($button.data('providerName') != 'everywhere' ? $button.data('providerName') : ''); + + if ($oldProviderName != this._providerName) { + var $searchString = $.trim(this._searchInput.val()); + if ($searchString) { + var $parameters = { + data: { + excludedSearchValues: this._excludedSearchValues, + searchString: $searchString + } + }; + this._queryServer($parameters); + } + } + }, this)); }, /** @@ -1942,6 +1971,15 @@ WCF.ACP.Search = WCF.Search.Base.extend({ this._super(data); this._list.addClass('acpSearchDropdown'); + }, + + /** + * @see WCF.Search.Base._getParameters() + */ + _getParameters: function(parameters) { + parameters.data.providerName = this._providerName; + + return parameters; } }); diff --git a/wcfsetup/install/files/acp/style/layout.scss b/wcfsetup/install/files/acp/style/layout.scss index 7e77ca6027..4820f22d59 100644 --- a/wcfsetup/install/files/acp/style/layout.scss +++ b/wcfsetup/install/files/acp/style/layout.scss @@ -57,13 +57,50 @@ $wcfAcpMenuWidth: 150px; order: 3; // force to take up the full available height - position: relative; - top: -10px; + /*position: relative; + top: -10px;*/ + + .pageHeaderSearchType > .button { + background-color: rgba(0, 0, 0, .2); + color: $wcfHeaderSearchBoxPlaceholderActive; + align-items: center; + border-radius: 0; + display: flex; + height: 50px; + padding: 6px 28px 6px 10px; + + &::after { + right: 10px; + } + + &:hover { + background-color: rgba(0, 0, 0, .4); + } + } + + .pageHeaderSearchInputContainer { + background-color: $wcfHeaderMenuBackgroundActive; + border-radius: 0; + box-shadow: none; + padding: 0; + } .pageHeaderSearchInput { - border-width: 0 !important; height: 50px; width: 300px !important; + + background-color: transparent; + color: $wcfHeaderMenuLinkActive; + padding: 6px 8px; + + &:hover, + &:focus { + background-color: rgba(0, 0, 0, .1); + } + } + + .pageHeaderSearchInputButton { + display: none; } } diff --git a/wcfsetup/install/files/acp/templates/pageHeaderSearch.tpl b/wcfsetup/install/files/acp/templates/pageHeaderSearch.tpl index 57b4ae66c8..7268bec2af 100644 --- a/wcfsetup/install/files/acp/templates/pageHeaderSearch.tpl +++ b/wcfsetup/install/files/acp/templates/pageHeaderSearch.tpl @@ -1,5 +1,17 @@
+ +