Handle Apply button little bit more sanely
Change-Id: I55d48de703662f139549d764bf7c1f235111d5ab
This commit is contained in:
committed by
jenkins-bot
parent
740ff490e0
commit
79a038f166
@@ -537,7 +537,7 @@
|
|||||||
*/
|
*/
|
||||||
markDirty: function () {
|
markDirty: function () {
|
||||||
this.dirty = true;
|
this.dirty = true;
|
||||||
this.$parent.$window.find( 'button.uls-settings-apply' ).prop( 'disabled', false );
|
this.$parent.enableApplyButton();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
*/
|
*/
|
||||||
markDirty: function () {
|
markDirty: function () {
|
||||||
this.dirty = true;
|
this.dirty = true;
|
||||||
this.$parent.$window.find( 'button.uls-settings-apply' ).prop( 'disabled', false );
|
this.$parent.enableApplyButton();
|
||||||
},
|
},
|
||||||
|
|
||||||
prepareInputmethods: function ( language ) {
|
prepareInputmethods: function ( language ) {
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
this.top = this.options.top;
|
this.top = this.options.top;
|
||||||
this.modules = {};
|
this.modules = {};
|
||||||
this.$settingsPanel = this.$window.find( '#languagesettings-settings-panel' );
|
this.$settingsPanel = this.$window.find( '#languagesettings-settings-panel' );
|
||||||
|
this.$applyButton = this.$window.find( '.uls-settings-apply' );
|
||||||
this.init();
|
this.init();
|
||||||
this.listen();
|
this.listen();
|
||||||
}
|
}
|
||||||
@@ -78,7 +79,7 @@
|
|||||||
|
|
||||||
this.$window.find( '#languagesettings-close, button.uls-settings-cancel' )
|
this.$window.find( '#languagesettings-close, button.uls-settings-cancel' )
|
||||||
.on( 'click', mw.hook( 'mw.uls.settings.cancel' ).fire.bind( this ) );
|
.on( 'click', mw.hook( 'mw.uls.settings.cancel' ).fire.bind( this ) );
|
||||||
this.$window.find( 'button.uls-settings-apply' )
|
this.$applyButton
|
||||||
.on( 'click', mw.hook( 'mw.uls.settings.apply' ).fire.bind( this ) );
|
.on( 'click', mw.hook( 'mw.uls.settings.apply' ).fire.bind( this ) );
|
||||||
// Hide the window when clicked outside
|
// Hide the window when clicked outside
|
||||||
$( document.documentElement ).on( 'click', this.hide.bind( this ) );
|
$( document.documentElement ).on( 'click', this.hide.bind( this ) );
|
||||||
@@ -240,16 +241,14 @@
|
|||||||
* false to unset the busy mode.
|
* false to unset the busy mode.
|
||||||
*/
|
*/
|
||||||
setBusy: function ( busy ) {
|
setBusy: function ( busy ) {
|
||||||
var $applyButton = this.$window.find( 'button.uls-settings-apply' );
|
|
||||||
|
|
||||||
if ( busy ) {
|
if ( busy ) {
|
||||||
this.$window.addClass( 'waiting' );
|
this.$window.addClass( 'waiting' );
|
||||||
$applyButton
|
this.$applyButton
|
||||||
.text( $.i18n( 'ext-uls-language-settings-applying' ) )
|
.text( $.i18n( 'ext-uls-language-settings-applying' ) )
|
||||||
.prop( 'disabled', true );
|
.prop( 'disabled', true );
|
||||||
} else {
|
} else {
|
||||||
this.$window.removeClass( 'waiting' );
|
this.$window.removeClass( 'waiting' );
|
||||||
$applyButton.text( $.i18n( 'ext-uls-language-settings-apply' ) );
|
this.$applyButton.text( $.i18n( 'ext-uls-language-settings-apply' ) );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -282,8 +281,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
enableApplyButton: function () {
|
||||||
|
this.$applyButton.prop( 'disabled', false );
|
||||||
|
},
|
||||||
|
|
||||||
disableApplyButton: function () {
|
disableApplyButton: function () {
|
||||||
this.$window.find( 'button.uls-settings-apply' ).prop( 'disabled', true );
|
this.$applyButton.prop( 'disabled', true );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user