From: Florian Date: Tue, 19 Apr 2016 17:30:39 +0000 (+0200) Subject: Search: Change dataLocation default value and add docs X-Git-Tag: 1.31.0-rc.0~7053^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=36784f7c35c6434e5083e28bdc7f45db974fec2f;p=lhc%2Fweb%2Fwiklou.git Search: Change dataLocation default value and add docs Implemented Krinkle's comments of the followed up commit. Follow up I2480149 Change-Id: I8e51c0d3a3ca1690ea3ea08469a1cd52d9c151f3 --- diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 15bf39b920..d474ba5222 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -1238,6 +1238,7 @@ class SpecialSearch extends SpecialPage { 'name' => 'search', 'autofocus' => trim( $term ) === '', 'value' => $term, + 'dataLocation' => 'content', ] ); $out = diff --git a/includes/widget/SearchInputWidget.php b/includes/widget/SearchInputWidget.php old mode 100644 new mode 100755 index 5ff411df4e..6baaff05cf --- a/includes/widget/SearchInputWidget.php +++ b/includes/widget/SearchInputWidget.php @@ -16,6 +16,7 @@ class SearchInputWidget extends TitleInputWidget { protected $performSearchOnClick = true; protected $validateTitle = false; protected $highlightFirst = false; + protected $dataLocation = 'header'; /** * @param array $config Configuration options @@ -24,6 +25,8 @@ class SearchInputWidget extends TitleInputWidget { * @param boolean|null $config['performSearchOnClick'] If true, the script will start a search * whenever a user hits a suggestion. If false, the text of the suggestion is inserted into the * text field only (default: true) + * @param string $config['dataLocation'] Where the search input field will be + * used (header or content, default: header) */ public function __construct( array $config = [] ) { $config = array_merge( [ @@ -31,7 +34,6 @@ class SearchInputWidget extends TitleInputWidget { 'maxLength' => null, 'type' => 'search', 'icon' => 'search', - 'dataLocation' => 'content', ], $config ); // Parent constructor diff --git a/resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js b/resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js old mode 100644 new mode 100755 index 8c2b53af26..df03679980 --- a/resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js +++ b/resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js @@ -18,13 +18,16 @@ * @cfg {boolean} [performSearchOnClick=true] If true, the script will start a search when- * ever a user hits a suggestion. If false, the text of the suggestion is inserted into the * text field only. + * @cfg {string} [dataLocation='header'] Where the search input field will be + * used (header or content). */ mw.widgets.SearchInputWidget = function MwWidgetsSearchInputWidget( config ) { config = $.extend( { type: 'search', icon: 'search', maxLength: undefined, - performSearchOnClick: true + performSearchOnClick: true, + dataLocation: 'header' }, config ); // Parent constructor