[MediaWiki-commits] [Gerrit] [BREAKING CHANGE] Use config object for Target constructors - change (VisualEditor/VisualEditor)

2015-07-30 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: [BREAKING CHANGE] Use config object for Target constructors
..


[BREAKING CHANGE] Use config object for Target constructors

Bonus:
* Use 'super' calls

Change-Id: I09b00668380d11feca73061803431fa6c3b8dffd
---
M src/init/sa/ve.init.sa.Target.js
M src/init/ve.init.Target.js
2 files changed, 15 insertions(+), 10 deletions(-)

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



diff --git a/src/init/sa/ve.init.sa.Target.js b/src/init/sa/ve.init.sa.Target.js
index a351702..a6c68c0 100644
--- a/src/init/sa/ve.init.sa.Target.js
+++ b/src/init/sa/ve.init.sa.Target.js
@@ -24,17 +24,19 @@
  * @extends ve.init.Target
  *
  * @constructor
- * @param {string} [surfaceType] Type of surface to use, 'desktop' or 'mobile'
- * @param {Object} [toolbarConfig] Configuration options for the toolbar
+ * @param {Object} [config] Configuration options
+ * @cfg {string} [surfaceType] Type of surface to use, 'desktop' or 'mobile'
+ * @cfg {Object} [toolbarConfig] Configuration options for the toolbar
  * @throws {Error} Unknown surfaceType
  */
-ve.init.sa.Target = function VeInitSaTarget( surfaceType, toolbarConfig ) {
-   toolbarConfig = $.extend( { shadow: true, actions: true, floatable: 
true }, toolbarConfig );
+ve.init.sa.Target = function VeInitSaTarget( config ) {
+   config = config || {};
+   config.toolbarConfig = $.extend( { shadow: true, actions: true, 
floatable: true }, config.toolbarConfig );
 
// Parent constructor
-   ve.init.Target.call( this, toolbarConfig );
+   ve.init.sa.Target.super.call( this, config );
 
-   this.surfaceType = surfaceType || 
this.constructor.static.defaultSurfaceType;
+   this.surfaceType = config.surfaceType || 
this.constructor.static.defaultSurfaceType;
this.actions = null;
 
switch ( this.surfaceType ) {
diff --git a/src/init/ve.init.Target.js b/src/init/ve.init.Target.js
index 76e26c6..a147d39 100644
--- a/src/init/ve.init.Target.js
+++ b/src/init/ve.init.Target.js
@@ -13,11 +13,14 @@
  * @mixins OO.EventEmitter
  *
  * @constructor
- * @param {Object} toolbarConfig Configuration options for the toolbar
+ * @param {Object} [config] Configuration options
+ * @cfg {Object} [toolbarConfig] Configuration options for the toolbar
  */
-ve.init.Target = function VeInitTarget( toolbarConfig ) {
+ve.init.Target = function VeInitTarget( config ) {
+   config = config || {};
+
// Parent constructor
-   OO.ui.Element.call( this );
+   ve.init.Target.super.call( this, config );
 
// Mixin constructors
OO.EventEmitter.call( this );
@@ -26,7 +29,7 @@
this.surfaces = [];
this.surface = null;
this.toolbar = null;
-   this.toolbarConfig = toolbarConfig;
+   this.toolbarConfig = config.toolbarConfig;
this.documentTriggerListener = new ve.TriggerListener( 
this.constructor.static.documentCommands );
this.targetTriggerListener = new ve.TriggerListener( 
this.constructor.static.targetCommands );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I09b00668380d11feca73061803431fa6c3b8dffd
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders esand...@wikimedia.org
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] [BREAKING CHANGE] Use config object for Target constructors - change (VisualEditor/VisualEditor)

2015-07-30 Thread Esanders (Code Review)
Esanders has uploaded a new change for review.

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

Change subject: [BREAKING CHANGE] Use config object for Target constructors
..

[BREAKING CHANGE] Use config object for Target constructors

Bonus:
* Use 'super' calls

Change-Id: I09b00668380d11feca73061803431fa6c3b8dffd
---
M src/init/sa/ve.init.sa.Target.js
M src/init/ve.init.Target.js
2 files changed, 15 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/57/227957/1

diff --git a/src/init/sa/ve.init.sa.Target.js b/src/init/sa/ve.init.sa.Target.js
index a351702..a6c68c0 100644
--- a/src/init/sa/ve.init.sa.Target.js
+++ b/src/init/sa/ve.init.sa.Target.js
@@ -24,17 +24,19 @@
  * @extends ve.init.Target
  *
  * @constructor
- * @param {string} [surfaceType] Type of surface to use, 'desktop' or 'mobile'
- * @param {Object} [toolbarConfig] Configuration options for the toolbar
+ * @param {Object} [config] Configuration options
+ * @cfg {string} [surfaceType] Type of surface to use, 'desktop' or 'mobile'
+ * @cfg {Object} [toolbarConfig] Configuration options for the toolbar
  * @throws {Error} Unknown surfaceType
  */
-ve.init.sa.Target = function VeInitSaTarget( surfaceType, toolbarConfig ) {
-   toolbarConfig = $.extend( { shadow: true, actions: true, floatable: 
true }, toolbarConfig );
+ve.init.sa.Target = function VeInitSaTarget( config ) {
+   config = config || {};
+   config.toolbarConfig = $.extend( { shadow: true, actions: true, 
floatable: true }, config.toolbarConfig );
 
// Parent constructor
-   ve.init.Target.call( this, toolbarConfig );
+   ve.init.sa.Target.super.call( this, config );
 
-   this.surfaceType = surfaceType || 
this.constructor.static.defaultSurfaceType;
+   this.surfaceType = config.surfaceType || 
this.constructor.static.defaultSurfaceType;
this.actions = null;
 
switch ( this.surfaceType ) {
diff --git a/src/init/ve.init.Target.js b/src/init/ve.init.Target.js
index 76e26c6..a147d39 100644
--- a/src/init/ve.init.Target.js
+++ b/src/init/ve.init.Target.js
@@ -13,11 +13,14 @@
  * @mixins OO.EventEmitter
  *
  * @constructor
- * @param {Object} toolbarConfig Configuration options for the toolbar
+ * @param {Object} [config] Configuration options
+ * @cfg {Object} [toolbarConfig] Configuration options for the toolbar
  */
-ve.init.Target = function VeInitTarget( toolbarConfig ) {
+ve.init.Target = function VeInitTarget( config ) {
+   config = config || {};
+
// Parent constructor
-   OO.ui.Element.call( this );
+   ve.init.Target.super.call( this, config );
 
// Mixin constructors
OO.EventEmitter.call( this );
@@ -26,7 +29,7 @@
this.surfaces = [];
this.surface = null;
this.toolbar = null;
-   this.toolbarConfig = toolbarConfig;
+   this.toolbarConfig = config.toolbarConfig;
this.documentTriggerListener = new ve.TriggerListener( 
this.constructor.static.documentCommands );
this.targetTriggerListener = new ve.TriggerListener( 
this.constructor.static.targetCommands );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I09b00668380d11feca73061803431fa6c3b8dffd
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
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