Merge "SearchInputWidget: Actually connect to change event"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 9 Oct 2017 16:55:42 +0000 (16:55 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 9 Oct 2017 16:55:42 +0000 (16:55 +0000)
1  2 
resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js

@@@ -33,7 -33,8 +33,7 @@@
                        icon: 'search',
                        maxLength: undefined,
                        performSearchOnClick: true,
 -                      dataLocation: 'header',
 -                      namespace: 0
 +                      dataLocation: 'header'
                }, config );
  
                // Parent constructor
                        } );
                }.bind( this ) );
  
+               this.connect( this, {
+                       change: 'onChange'
+               } );
                this.$element.addClass( 'oo-ui-textInputWidget-type-search' );
                this.updateSearchIndicator();
                this.connect( this, {
         * @see OO.ui.SearchInputWidget#onChange
         */
        mw.widgets.SearchInputWidget.prototype.onChange = function () {
-               mw.widgets.SearchInputWidget.parent.prototype.onChange.call( this );
                this.updateSearchIndicator();
        };
  
         */
        mw.widgets.SearchInputWidget.prototype.getOptionsFromData = function ( data ) {
                var items = [],
 +                      titles = data.data[ 1 ],
 +                      descriptions = data.data[ 2 ],
 +                      urls = data.data[ 3 ],
                        self = this;
  
 -              $.each( data.data[ 1 ], function ( i, result ) {
 +              $.each( titles, function ( i, result ) {
                        items.push( new mw.widgets.TitleOptionWidget(
                                self.getOptionWidgetData(
                                        result,
                                        // the parent's API query.
                                        {
                                                data: result,
 -                                              // data[ 3 ][ i ] is the link for this result
 -                                              url: data.data[ 3 ][ i ],
 -                                              imageUrl: null,
 -                                              description: null,
 +                                              url: urls[ i ],
 +                                              imageUrl: null, // The JSON 'opensearch' API doesn't have images
 +                                              description: descriptions[ i ],
                                                missing: false,
                                                redirect: false,
                                                disambiguation: false