Esanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/379232 )
Change subject: Use OOUI for 'Start translation' button ...................................................................... Use OOUI for 'Start translation' button Change-Id: I8cc92ddcc7207af18bf2fe4194297e26361668ba --- M modules/source/ext.cx.source.selector.js 1 file changed, 22 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/32/379232/1 diff --git a/modules/source/ext.cx.source.selector.js b/modules/source/ext.cx.source.selector.js index c4be0b0..d7afdac 100644 --- a/modules/source/ext.cx.source.selector.js +++ b/modules/source/ext.cx.source.selector.js @@ -54,7 +54,7 @@ this.$messageBar = null; this.$targetTitleInput = null; this.overlay = null; - this.$translateFromButton = null; + this.translateFromButton = null; this.narrowLimit = 700; this.isNarrowScreenSize = false; this.validator = new mw.cx.ContentTranslationValidator( this.siteMapper ); @@ -392,7 +392,7 @@ this.$trigger.click( this.show.bind( this ) ); this.sourcePageSelector.on( 'change', function () { - self.$translateFromButton.prop( 'disabled', false ); + self.translateFromButton.setDisabled( false ); // Hide any previous errors. self.$messageBar.hide(); } ); @@ -504,7 +504,7 @@ // We do not want to show "title does not exist" for empty input if ( sourceTitle === '' ) { - this.$translateFromButton.prop( 'disabled', true ); + this.translateFromButton.setDisabled( true ); return; } @@ -513,7 +513,7 @@ this.validator.isTitleExistInLanguage( sourceLanguage, sourceTitle ).then( function ( sourceTitle ) { var titleCheck, translationCheck; - selector.$translateFromButton.prop( 'disabled', !sourceTitle ); + selector.translateFromButton.setDisabled( !sourceTitle ); if ( sourceTitle === false ) { selector.showSourceTitleError( sourceLanguage ); @@ -741,7 +741,7 @@ this.sourcePageSelector.setValue( '' ); this.$targetTitleInput.val( '' ); - this.$translateFromButton.prop( 'disabled', true ); + this.translateFromButton.setDisabled( true ); this.$messageBar.hide(); // Only dialog version of CXSourceSelector has cancel button @@ -1052,6 +1052,7 @@ $targetTitleInputContainer, $targetInputs, $messageText, + cancelButton, translateButtonLabel, $actions, $license, cxSourceSelector = this; @@ -1152,17 +1153,17 @@ .append( $messageText ) .hide(); - this.$cancelButton = $( '<button>' ) - .addClass( 'mw-ui-button mw-ui-quiet cx-sourceselector-dialog__button-cancel' ) - .text( mw.msg( 'cx-sourceselector-dialog-button-cancel' ) ) - .click( this.cancel.bind( this ) ); + cancelButton = new OO.ui.ButtonWidget( { + flags: [ 'destructive' ], + label: mw.msg( 'cx-sourceselector-dialog-button-cancel' ) + } ).on( 'click', this.cancel.bind( this ) ); translateButtonLabel = mw.msg( 'cx-sourceselector-dialog-button-start-translation' ); - this.$translateFromButton = $( '<button>' ) - .addClass( 'mw-ui-button mw-ui-progressive cx-sourceselector-dialog__button-translate' ) - .text( translateButtonLabel ) - .prop( 'disabled', true ) - .click( this.startPageInCX.bind( this ) ); + this.translateFromButton = new OO.ui.ButtonWidget( { + flags: [ 'primary', 'progressive' ], + label: translateButtonLabel, + disabled: true + } ).on( 'click', this.startPageInCX.bind( this ) ); $license = $( '<div>' ) .addClass( 'cx-sourceselector__license' ) @@ -1171,7 +1172,7 @@ $actions = $( '<div>' ) .addClass( 'cx-sourceselector-dialog__actions' ); - $actions.append( this.$cancelButton, this.$translateFromButton ); + $actions.append( cancelButton.$element, this.translateFromButton.$element ); this.$container.append( $heading, this.$sourceInputs, @@ -1287,11 +1288,11 @@ .hide(); translateButtonLabel = mw.msg( 'cx-sourceselector-dialog-button-start-translation' ); - this.$translateFromButton = $( '<button>' ) - .addClass( 'mw-ui-button mw-ui-progressive cx-sourceselector-dialog__button-translate' ) - .text( translateButtonLabel ) - .prop( 'disabled', true ) - .click( this.startPageInCX.bind( this ) ); + this.translateFromButton = new OO.ui.ButtonWidget( { + flags: [ 'primary', 'progressive' ], + label: translateButtonLabel, + disabled: true + } ).on( 'click', this.startPageInCX.bind( this ) ); $license = $( '<div>' ) .addClass( 'cx-sourceselector__license' ) @@ -1299,7 +1300,7 @@ $actions = $( '<div>' ) .addClass( 'cx-sourceselector-embedded__actions' ) - .append( this.$translateFromButton ); + .append( this.translateFromButton.$element ); this.$container.append( this.$sourceInputs, this.$selectedItem, -- To view, visit https://gerrit.wikimedia.org/r/379232 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8cc92ddcc7207af18bf2fe4194297e26361668ba Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits