} );
this.$element.on( { click: this.onClick.bind( this ) } );
this.$label.on( { click: this.onClick.bind( this ) } );
+ this.$icon.on( { click: this.onDefaultIconClick.bind( this ) } );
// Prevent propagation on mousedown for the save button
// so the menu doesn't close
this.saveButton.$element.on( { mousedown: function () { return false; } } );
this.emit( 'click' );
}
};
+
+ /**
+ * Respond to click on the 'default' icon. Open the submenu where the
+ * default state can be changed.
+ *
+ * @return {boolean} false
+ */
+ mw.rcfilters.ui.SavedLinksListItemWidget.prototype.onDefaultIconClick = function () {
+ this.menu.toggle();
+ return false;
+ };
+
/**
* Respond to popup button click event
*/
* Respond to input keyup event, this is the way to intercept 'escape' key
*
* @param {jQuery.Event} e Event data
- * @returns {boolean} false
+ * @return {boolean} false
*/
mw.rcfilters.ui.SavedLinksListItemWidget.prototype.onInputKeyup = function ( e ) {
if ( e.which === OO.ui.Keys.ESCAPE ) {
if ( this.default !== isDefault ) {
this.default = isDefault;
this.setIcon( this.default ? 'pushPin' : '' );
- this.menu.getItemFromData( 'default' ).setLabel(
+ this.menu.findItemFromData( 'default' ).setLabel(
this.default ?
mw.msg( 'rcfilters-savedqueries-unsetdefault' ) :
mw.msg( 'rcfilters-savedqueries-setdefault' )
/**
* Get item ID
*
- * @returns {string} Query identifier
+ * @return {string} Query identifier
*/
mw.rcfilters.ui.SavedLinksListItemWidget.prototype.getID = function () {
return this.model.getID();