Bmansurov has uploaded a new change for review.

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

Change subject: Move the extend function to the utils module
......................................................................

Move the extend function to the utils module

Change-Id: I019efb7f075b9153ff24ecd60296bb4c94a791c1
---
M resources/ext.quicksurveys.views/QuickSurvey.js
M resources/ext.quicksurveys.views/utils.js
2 files changed, 21 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/43/233643/1

diff --git a/resources/ext.quicksurveys.views/QuickSurvey.js 
b/resources/ext.quicksurveys.views/QuickSurvey.js
index 4b36cc1..91a635d 100644
--- a/resources/ext.quicksurveys.views/QuickSurvey.js
+++ b/resources/ext.quicksurveys.views/QuickSurvey.js
@@ -2,32 +2,13 @@
        var utils = mw.extQuickSurveys.views.utils;
 
        /**
-        * Extends a class with new methods and member properties.
-        *
-        * @param {OO.Class} ParentClass to extend.
-        * @param {Object} prototype Prototype that should be incorporated into 
the new Class.
-        * @ignore
-        * FIXME: Talk about upstreaming this to oojs ui as a utility function.
-        * @return {Class}
-        */
-       function extend( ChildClass, ParentClass, prototype ) {
-               var key;
-
-               OO.inheritClass( ChildClass, ParentClass );
-               for ( key in prototype ) {
-                       ChildClass.prototype[key] = prototype[key];
-               }
-               return ChildClass;
-       }
-
-       /**
         * @class QuickSurvey
         * @inherit OO.ui.StackLayout
         */
        function QuickSurvey( config ) {
                this.initialize( config );
        }
-       extend( QuickSurvey, OO.ui.StackLayout, {
+       utils.extend( QuickSurvey, OO.ui.StackLayout, {
                /**
                 * Specifies partials (sub-templates) for use by the widget
                 * @property {Object}
diff --git a/resources/ext.quicksurveys.views/utils.js 
b/resources/ext.quicksurveys.views/utils.js
index fe67f90..42228c3 100644
--- a/resources/ext.quicksurveys.views/utils.js
+++ b/resources/ext.quicksurveys.views/utils.js
@@ -1,5 +1,24 @@
 ( function () {
        /**
+        * Extends a class with new methods and member properties.
+        *
+        * @param {OO.Class} ParentClass to extend.
+        * @param {Object} prototype Prototype that should be incorporated into 
the new Class.
+        * @ignore
+        * FIXME: Talk about upstreaming this to oojs ui as a utility function.
+        * @return {Class}
+        */
+       function extend( ChildClass, ParentClass, prototype ) {
+               var key;
+
+               OO.inheritClass( ChildClass, ParentClass );
+               for ( key in prototype ) {
+                       ChildClass.prototype[key] = prototype[key];
+               }
+               return ChildClass;
+       }
+
+       /**
         * Return edit count bucket based on the number of edits
         * @param {Number} editCount
         * @returns {String}
@@ -39,6 +58,7 @@
        mw.extQuickSurveys = mw.extQuickSurveys || {};
        mw.extQuickSurveys.views = mw.extQuickSurveys.views || {};
        mw.extQuickSurveys.views.utils = {
+               extend: extend,
                getEditCountBucket: getEditCountBucket,
                getCountryCode: getCountryCode
        };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I019efb7f075b9153ff24ecd60296bb4c94a791c1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: dev
Gerrit-Owner: Bmansurov <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to