From: Marcel Werk Date: Tue, 31 May 2016 21:11:13 +0000 (+0200) Subject: Overhauled acp search X-Git-Tag: 3.0.0_Beta_1~1555 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c8f7b2a145c2f942b731d26dc478f1e324bb6394;p=GitHub%2FWoltLab%2FWCF.git Overhauled acp search --- 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 @@
+ +