Revert "Simplify the cancel logic for input and display settings"

This reverts commit a5d79594a3.

Causes new integration tests to fail.

Change-Id: I7e14d73d0d726a3253e8c6e6bdf5066230d8454c
This commit is contained in:
Nikerabbit
2013-08-27 12:34:50 +00:00
parent a5d79594a3
commit 537e6def5d
3 changed files with 48 additions and 11 deletions

View File

@@ -75,6 +75,7 @@
this.contentLanguage = this.getContentLanguage();
this.$imes = null;
this.$parent = $parent;
this.dirty = false;
this.savedRegistry = $.extend( true, {}, $.ime.preferences.registry );
}
@@ -87,10 +88,11 @@
*/
render: function () {
var $enabledOnly;
this.dirty = false;
this.$parent.$settingsPanel.empty();
this.$imes = $( 'body' ).data( 'ime' );
this.$parent.$settingsPanel.append( this.$template );
$enabledOnly = this.$template.find( '.enabled-only' );
// ime system is lazy loaded, make sure it is initialized
mw.ime.init();
@@ -104,7 +106,6 @@
this.prepareLanguages();
this.prepareToggleButton();
this.$template.i18n();
this.disableApplyButton();
$( 'body' ).data( 'webfonts' ).refresh();
this.listen();
},
@@ -453,6 +454,8 @@
inputSettings.$template.find( 'button.uls-input-settings-cancel' ).on( 'click', function () {
inputSettings.cancel();
// Redraw the panel according to the state
inputSettings.render();
inputSettings.close();
} );
@@ -566,10 +569,12 @@
if ( !this.dirty ) {
return;
}
this.dirty = false;
this.disableApplyButton();
// Reload preferences
$.ime.preferences.registry = $.extend( true, {}, this.savedRegistry );
this.uiLanguage = this.getInterfaceLanguage();
this.contentLanguage = this.getContentLanguage();
// Restore the state of IME
if ( $.ime.preferences.isEnabled() ) {
mw.ime.setup();