Esanders has uploaded a new change for review.

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

Change subject: Store default button config in a static property
......................................................................

Store default button config in a static property

Change-Id: Ic0146852c1161c6f04692f5be537fe76d40cf160
---
M src/ui/contexts/ve.ui.MobileContext.js
M src/ui/ve.ui.Context.js
M src/ui/ve.ui.ContextItem.js
3 files changed, 20 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/60/230760/1

diff --git a/src/ui/contexts/ve.ui.MobileContext.js 
b/src/ui/contexts/ve.ui.MobileContext.js
index 4cd78b1..b197768 100644
--- a/src/ui/contexts/ve.ui.MobileContext.js
+++ b/src/ui/contexts/ve.ui.MobileContext.js
@@ -41,6 +41,11 @@
 
 ve.ui.MobileContext.static.basicRendering = true;
 
+/**
+ * @inheritdoc
+ */
+ve.ui.MobileContext.static.defaultButtonConfig = { framed: false };
+
 /* Methods */
 
 /**
@@ -51,13 +56,4 @@
                factory: ve.ui.windowFactory,
                overlay: this.surface.getGlobalOverlay()
        } );
-};
-
-/**
- * @inheritdoc
- */
-ve.ui.MobileContext.prototype.getButtonConfig = function () {
-       return {
-               framed: false
-       };
 };
diff --git a/src/ui/ve.ui.Context.js b/src/ui/ve.ui.Context.js
index f91c4eb..644dc95 100644
--- a/src/ui/ve.ui.Context.js
+++ b/src/ui/ve.ui.Context.js
@@ -64,24 +64,33 @@
  */
 ve.ui.Context.static.basicRendering = false;
 
+/**
+ * Default config options for rendering a button in a context item
+ *
+ * @static
+ * @inheritable
+ * @property {Object}
+ */
+ve.ui.Context.static.defaultButtonConfig = {};
+
 /* Methods */
 
 /**
  * Check if items should provide only a basic rendering.
  *
- * @return {boolean} items should provide only a basic rendering
+ * @return {boolean} Items should provide only a basic rendering
  */
 ve.ui.Context.prototype.shouldUseBasicRendering = function () {
        return this.constructor.static.basicRendering;
 };
 
 /**
- * Get the deafult config options for rendering a button in a context tiem
+ * Get the default config options for rendering a button in a context item
  *
- * @return {Object} Default config options
+ * @return {Object} Config options
  */
-ve.ui.Context.prototype.getButtonConfig = function () {
-       return {};
+ve.ui.Context.prototype.getDefaultButtonConfig = function () {
+       return OO.copy( this.constructor.static.defaultButtonConfig );
 };
 
 /**
diff --git a/src/ui/ve.ui.ContextItem.js b/src/ui/ve.ui.ContextItem.js
index cfd5caa..9c5ee5e 100644
--- a/src/ui/ve.ui.ContextItem.js
+++ b/src/ui/ve.ui.ContextItem.js
@@ -38,7 +38,7 @@
        this.$info = $( '<div>' );
        this.$description = $( '<div>' );
        this.editButton = new OO.ui.ButtonWidget( ve.extendObject(
-               this.context.getButtonConfig(),
+               this.context.getDefaultButtonConfig(),
                {
                        label: ve.msg( 
'visualeditor-contextitemwidget-label-secondary' ),
                        flags: [ 'progressive' ],

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic0146852c1161c6f04692f5be537fe76d40cf160
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

Reply via email to