[MediaWiki-commits] [Gerrit] Make the 'full size' button optional - change (VisualEditor/VisualEditor)

2014-03-05 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Make the 'full size' button optional
..


Make the 'full size' button optional

Transform MediaSizeWidget's 'full size' button to appear only as an
optional configuration option. This is mainly used in the new correction
related to MediaEditoDialog type and default size change at
https://gerrit.wikimedia.org/r/#/c/115939/

Change-Id: Ie18e2e371f18f5e8ab37ad27810ff11e5ee92d32
---
M modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
1 file changed, 23 insertions(+), 12 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js 
b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
index 3a00044..a282f17 100644
--- a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
@@ -27,6 +27,7 @@
// Configuration
config = config || {};
 
+   this.showOriginalDimensionsButton = 
!!config.showOriginalDimensionsButton;
// Parent constructor
OO.ui.Widget.call( this, config );
 
@@ -77,19 +78,26 @@
.append( [
heightLabel.$element,
this.heightInput.$element
-   ] ),
-   this.$( 'div' )
-   .addClass( 've-ui-mediaSizeWidget-button-originalSize' )
-   .append( this.originalDimensionsButton.$element ),
+   ] )
+   ] );
+   // Optionally append the original size button
+   if ( this.showOriginalDimensionsButton ) {
+   this.$element.append(
+   this.$( 'div' )
+   .addClass( 
've-ui-mediaSizeWidget-button-originalSize' )
+   .append( this.originalDimensionsButton.$element 
)
+   );
+   this.originalDimensionsButton.setDisabled( true );
+   // Events
+   this.originalDimensionsButton.connect( this, { 'click': 
'onButtonOriginalDimensionsClick' } );
+   }
+
+   // Append error message
+   this.$element.append(
this.$( 'div' )
.addClass( 've-ui-mediaSizeWidget-label-error' )
-   .append( this.errorLabel.$element ),
-   ] );
-
-   this.originalDimensionsButton.setDisabled( true );
-
-   // Events
-   this.originalDimensionsButton.connect( this, { 'click': 
'onButtonOriginalDimensionsClick' } );
+   .append( this.errorLabel.$element )
+   );
 
this.widthInput.connect( this, { 'change': 'onWidthChange' } );
this.heightInput.connect( this, { 'change': 'onHeightChange' } );
@@ -221,8 +229,11 @@
 ve.ui.MediaSizeWidget.prototype.setOriginalDimensions = function ( dimensions 
) {
// Parent method
ve.Scalable.prototype.setOriginalDimensions.call( this, dimensions );
+
// Enable the 'original dimensions' button
-   this.originalDimensionsButton.setDisabled( false );
+   if ( this.showOriginalDimensionsButton ) {
+   this.originalDimensionsButton.setDisabled( false );
+   }
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/116647
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie18e2e371f18f5e8ab37ad27810ff11e5ee92d32
Gerrit-PatchSet: 2
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com
Gerrit-Reviewer: Catrope roan.katt...@gmail.com
Gerrit-Reviewer: Jforrester jforres...@wikimedia.org
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make the 'full size' button optional - change (VisualEditor/VisualEditor)

2014-03-03 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/116647

Change subject: Make the 'full size' button optional
..

Make the 'full size' button optional

Transform MediaSizeWidget's 'full size' button to appear only as an
optional configuration option. This is mainly used in the new correction
related to MediaEditoDialog type and default size change at
https://gerrit.wikimedia.org/r/#/c/115939/

Change-Id: Ie18e2e371f18f5e8ab37ad27810ff11e5ee92d32
---
M modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
1 file changed, 23 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/47/116647/1

diff --git a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js 
b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
index 3a00044..661350a 100644
--- a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
@@ -27,6 +27,7 @@
// Configuration
config = config || {};
 
+   this.showOriginalDimensionsButton = 
!!config.showOriginalDimensionsButton;
// Parent constructor
OO.ui.Widget.call( this, config );
 
@@ -77,19 +78,26 @@
.append( [
heightLabel.$element,
this.heightInput.$element
-   ] ),
-   this.$( 'div' )
-   .addClass( 've-ui-mediaSizeWidget-button-originalSize' )
-   .append( this.originalDimensionsButton.$element ),
+   ] )
+   ] );
+   // Optionally append the original size button
+   if ( this.showOriginalDimensionsButton ) {
+   this.$element.append(
+   this.$( 'div' )
+   .addClass( 
've-ui-mediaSizeWidget-button-originalSize' )
+   .append( this.originalDimensionsButton.$element 
)
+   );
+   this.originalDimensionsButton.setDisabled( true );
+   // Events
+   this.originalDimensionsButton.connect( this, { 'click': 
'onButtonOriginalDimensionsClick' } );
+   }
+
+   // Append error message
+   this.$element.append(
this.$( 'div' )
.addClass( 've-ui-mediaSizeWidget-label-error' )
-   .append( this.errorLabel.$element ),
-   ] );
-
-   this.originalDimensionsButton.setDisabled( true );
-
-   // Events
-   this.originalDimensionsButton.connect( this, { 'click': 
'onButtonOriginalDimensionsClick' } );
+   .append( this.errorLabel.$element )
+   );
 
this.widthInput.connect( this, { 'change': 'onWidthChange' } );
this.heightInput.connect( this, { 'change': 'onHeightChange' } );
@@ -221,8 +229,11 @@
 ve.ui.MediaSizeWidget.prototype.setOriginalDimensions = function ( dimensions 
) {
// Parent method
ve.Scalable.prototype.setOriginalDimensions.call( this, dimensions );
+   this.emit( 'originaldimensions-available' );
// Enable the 'original dimensions' button
-   this.originalDimensionsButton.setDisabled( false );
+   if ( this.showOriginalDimensionsButton ) {
+   this.originalDimensionsButton.setDisabled( false );
+   }
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/116647
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie18e2e371f18f5e8ab37ad27810ff11e5ee92d32
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits