Merge "Improve sorting on SpecialWanted*-Pages"
[mediawiki.git] / resources / src / mediawiki.rcfilters / ui / mw.rcfilters.ui.CheckboxInputWidget.js
blob86b3b11f24dbd0327915834744beeb73468b4c7b
1 ( function ( mw ) {
2 /**
3 * A widget representing a single toggle filter
5 * @extends OO.ui.CheckboxInputWidget
7 * @constructor
8 * @param {Object} config Configuration object
9 */
10 mw.rcfilters.ui.CheckboxInputWidget = function MwRcfiltersUiCheckboxInputWidget( config ) {
11 config = config || {};
13 // Parent
14 mw.rcfilters.ui.CheckboxInputWidget.parent.call( this, config );
16 // Event
17 this.$input.on( 'change', this.onUserChange.bind( this ) );
20 /* Initialization */
22 OO.inheritClass( mw.rcfilters.ui.CheckboxInputWidget, OO.ui.CheckboxInputWidget );
24 /* Events */
26 /**
27 * @event userChange
28 * @param {boolean} Current state of the checkbox
30 * The user has checked or unchecked this checkbox
33 /* Methods */
35 /**
36 * Respond to checkbox change by a user and emit 'userChange'.
38 mw.rcfilters.ui.CheckboxInputWidget.prototype.onUserChange = function () {
39 this.emit( 'userChange', this.$input.prop( 'checked' ) );
41 }( mediaWiki ) );