Commit 29f32bc6 authored by Cormac Parle's avatar Cormac Parle Committed by jdlrobson
Browse files

Allow use of a search page that isn't Special:Search

Bug: T279057
Change-Id: I219a28eed0e199c65bfdb21d601509ab8dc0efe1
parent b2fb909c
Showing with 8 additions and 3 deletions
+8 -3
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -44,6 +44,7 @@ class SearchHeaderView extends View {
return util.template( `<div class="overlay-title search-header-view">
<form method="get" action="{{action}}" class="search-box">
<input class="search mw-ui-background-icon-search" type="search" name="search" autocomplete="off" placeholder="{{placeholderMsg}}" aria-label="{{placeholderMsg}}" value="{{searchTerm}}">
<input type="hidden" name="title" value="{{defaultSearchPage}}">
</form>
</div>` );
}
......
......@@ -19,6 +19,7 @@ var
* @param {Object} params Configuration options
* @param {string} params.placeholderMsg Search input placeholder text.
* @param {string} [params.action] of form defaults to the value of wgScript
* @param {string} [params.defaultSearchPage] The default search page e.g. Special:Search
* @param {SearchGateway} [params.gateway]
* @fires SearchOverlay#search-show
* @fires SearchOverlay#search-start
......@@ -31,7 +32,8 @@ function SearchOverlay( params ) {
params.action || mw.config.get( 'wgScript' ),
function ( query ) {
this.performSearch( query );
}.bind( this )
}.bind( this ),
params.defaultSearchPage || ''
),
options = util.extend( true, {
headerChrome: true,
......
......@@ -8,14 +8,16 @@ const formHeader = require( '../headers' ).formHeader,
* @param {string} placeholderMsg
* @param {string} action
* @param {Function} onInput
* @param {string} defaultSearchPage
* @return {jQuery.Element}
*/
function searchHeader( placeholderMsg, action, onInput ) {
function searchHeader( placeholderMsg, action, onInput, defaultSearchPage ) {
return formHeader(
new SearchHeaderView( {
placeholderMsg,
action,
onInput
onInput,
defaultSearchPage
} ),
[
icons.cancel()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment