Flip direction buttons in media dialog in RTL

Flip the order of the buttons in the alignment widget
so that they display the directions correctly in both
ltr and rtl.

Bug: 69165
Change-Id: I7bd1d6c89aaef09492ae07eadababd68305b245e
This commit is contained in:
Amir E. Aharoni 2014-08-06 13:29:41 +01:00
parent 48fd057775
commit 268c8677ee

View file

@ -187,7 +187,8 @@ ve.ui.MWMediaDialog.prototype.getBodyHeight = function () {
* @inheritdoc
*/
ve.ui.MWMediaDialog.prototype.initialize = function () {
var altTextFieldset, positionFieldset, borderField, positionField;
var altTextFieldset, positionFieldset, borderField, positionField,
alignLeftButton, alignCenterButton, alignRightButton, alignButons;
// Parent method
ve.ui.MWMediaDialog.super.prototype.initialize.call( this );
@ -254,23 +255,28 @@ ve.ui.MWMediaDialog.prototype.initialize = function () {
this.positionInput = new OO.ui.ButtonSelectWidget( {
'$': this.$
} );
this.positionInput.addItems( [
new OO.ui.ButtonOptionWidget( 'left', {
'$': this.$,
'icon': 'align-float-left',
'label': ve.msg( 'visualeditor-dialog-media-position-left' )
} ),
new OO.ui.ButtonOptionWidget( 'center', {
'$': this.$,
'icon': 'align-center',
'label': ve.msg( 'visualeditor-dialog-media-position-center' )
} ),
new OO.ui.ButtonOptionWidget( 'right', {
'$': this.$,
'icon': 'align-float-right',
'label': ve.msg( 'visualeditor-dialog-media-position-right' )
} )
], 0 );
alignLeftButton = new OO.ui.ButtonOptionWidget( 'left', {
'$': this.$,
'icon': 'align-float-left',
'label': ve.msg( 'visualeditor-dialog-media-position-left' )
} );
alignCenterButton = new OO.ui.ButtonOptionWidget( 'center', {
'$': this.$,
'icon': 'align-center',
'label': ve.msg( 'visualeditor-dialog-media-position-center' )
} );
alignRightButton = new OO.ui.ButtonOptionWidget( 'right', {
'$': this.$,
'icon': 'align-float-right',
'label': ve.msg( 'visualeditor-dialog-media-position-right' )
} );
alignButons = ( this.frame.getDir() === 'ltr' ) ?
[ alignLeftButton, alignCenterButton, alignRightButton ] :
[ alignRightButton, alignCenterButton, alignLeftButton ];
this.positionInput.addItems( alignButons, 0 );
this.positionCheckbox = new OO.ui.CheckboxInputWidget( {
'$': this.$