From 268c8677ee774a7edda5f817608217b1b311a7b4 Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Wed, 6 Aug 2014 13:29:41 +0100 Subject: [PATCH] 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 --- .../ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js index a799a59fd7..403cfe36e8 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js @@ -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.$