Convert ulsPurpose from a data attribute to an languagefilter option

This commit is contained in:
Amire80
2018-03-05 12:58:00 +02:00
parent ddb691a918
commit 00ff49e190
2 changed files with 6 additions and 2 deletions

View File

@@ -54,7 +54,6 @@
this.$element = $( element );
this.options = $.extend( {}, $.fn.uls.defaults, options );
this.$menu = $( template );
this.$menu.data( 'uls-purpose', this.options.ulsPurpose );
this.languages = this.options.languages;
for ( code in this.languages ) {
@@ -231,6 +230,7 @@
this.$languageFilter.languagefilter( {
lcd: lcd,
languages: this.languages,
ulsPurpose: this.options.ulsPurpose,
searchAPI: this.options.searchAPI,
onSelect: $.proxy( this.select, this )
} );

View File

@@ -236,7 +236,7 @@
this.$element.trigger(
'noresults.uls',
query,
this.$element.parents( '.uls-menu' ).data( 'uls-purpose' )
this.options.ulsPurpose
);
return;
}
@@ -342,6 +342,10 @@
lcd: undefined,
// URL to which we append query parameter with the query value
searchAPI: undefined,
// What is this ULS used for.
// Should be set for distinguishing between different instances of ULS
// in the same application.
ulsPurpose: '',
// Object of language tags to language names
languages: [],
// Callback function when language is selected