Search: Change dataLocation default value and add docs
authorFlorian <florian.schmidt.stargatewissen@gmail.com>
Tue, 19 Apr 2016 17:30:39 +0000 (19:30 +0200)
committerFlorianschmidtwelzow <florian.schmidt.stargatewissen@gmail.com>
Fri, 6 May 2016 12:18:19 +0000 (12:18 +0000)
Implemented Krinkle's comments of the followed up commit.

Follow up I2480149

Change-Id: I8e51c0d3a3ca1690ea3ea08469a1cd52d9c151f3

includes/specials/SpecialSearch.php
includes/widget/SearchInputWidget.php [changed mode: 0644->0755]
resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js [changed mode: 0644->0755]

index 15bf39b..d474ba5 100644 (file)
@@ -1238,6 +1238,7 @@ class SpecialSearch extends SpecialPage {
                        'name' => 'search',
                        'autofocus' => trim( $term ) === '',
                        'value' => $term,
+                       'dataLocation' => 'content',
                ] );
 
                $out =
old mode 100644 (file)
new mode 100755 (executable)
index 5ff411d..6baaff0
@@ -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
old mode 100644 (file)
new mode 100755 (executable)
index 8c2b53a..df03679
         * @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