jenkins-bot has submitted this change and it was merged.

Change subject: Introduce a simple overlay widget to help code reuse
......................................................................


Introduce a simple overlay widget to help code reuse

Change-Id: Icdcb0861a4479f780c7a5056863578341de070fc
---
M Resources.php
M modules/dashboard/ext.cx.translationlist.js
M modules/dashboard/styles/ext.cx.translationlist.less
M modules/source/ext.cx.source.selector.js
M modules/source/styles/ext.cx.source.selector.less
A modules/widgets/overlay/ext.cx.overlay.js
A modules/widgets/overlay/ext.cx.overlay.less
7 files changed, 51 insertions(+), 25 deletions(-)

Approvals:
  KartikMistry: Looks good to me, but someone else must approve
  Amire80: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Resources.php b/Resources.php
index 9dc6284..09a56db 100644
--- a/Resources.php
+++ b/Resources.php
@@ -192,6 +192,7 @@
                'ext.uls.mediawiki',
                'jquery.uls.compact',
                'mediawiki.ui.button',
+               'ext.cx.widgets.overlay',
        ),
        'messages' => array(
                'cx-sourceselector-dialog-new-translation',
@@ -603,6 +604,7 @@
                'ext.cx.progressbar',
                'ext.cx.util',
                'jquery.uls.data',
+               'ext.cx.widgets.overlay',
        ),
        'messages' => array(
                'cx-translation-filter-all-translations',
@@ -696,6 +698,15 @@
        )
 ) + $resourcePaths;
 
+$wgResourceModules['ext.cx.widgets.overlay'] = array(
+       'scripts' => array(
+               'widgets/overlay/ext.cx.overlay.js',
+       ),
+       'styles' => array(
+               'widgets/overlay/ext.cx.overlay.less',
+       ),
+) + $resourcePaths;
+
 $wgHooks['ResourceLoaderTestModules'][] = function ( array &$modules ) {
        $resourcePaths = array(
                'localBasePath' => __DIR__,
diff --git a/modules/dashboard/ext.cx.translationlist.js 
b/modules/dashboard/ext.cx.translationlist.js
index cf639d2..ad8b75d 100644
--- a/modules/dashboard/ext.cx.translationlist.js
+++ b/modules/dashboard/ext.cx.translationlist.js
@@ -161,7 +161,9 @@
                                .addClass( 'image' );
                        $progressbar = $( '<div>' )
                                .addClass( 'progressbar' )
-                               .cxProgressBar( { weights: progress } );
+                               .cxProgressBar( {
+                                       weights: progress
+                               } );
                        $imageBlock.append( $image, $progressbar );
                        this.showTitleImage( translation );
 
@@ -330,8 +332,7 @@
                deferred = $.Deferred();
 
                if ( !this.$overlay ) {
-                       this.$overlay = $( '<div>' )
-                               .addClass( 'cx-overlay' );
+                       this.$overlay = mw.cx.widgets.overlay();
                        $( 'body' ).append( this.$overlay );
                }
 
diff --git a/modules/dashboard/styles/ext.cx.translationlist.less 
b/modules/dashboard/styles/ext.cx.translationlist.less
index eee6212..5683834 100644
--- a/modules/dashboard/styles/ext.cx.translationlist.less
+++ b/modules/dashboard/styles/ext.cx.translationlist.less
@@ -196,13 +196,3 @@
                }
        }
 }
-
-.cx-overlay {
-       position: fixed;
-       top: 0;
-       left: 0;
-       height: 100%;
-       width: 100%;
-       background-color: #FFF;
-       opacity: 0.5;
-}
diff --git a/modules/source/ext.cx.source.selector.js 
b/modules/source/ext.cx.source.selector.js
index 3fed346..3525068 100644
--- a/modules/source/ext.cx.source.selector.js
+++ b/modules/source/ext.cx.source.selector.js
@@ -626,8 +626,7 @@
                } );
 
                if ( !this.$overlay ) {
-                       this.$overlay = $( '<div>' )
-                               .addClass( 'cx-sourceselector-dialog__overlay' 
);
+                       this.$overlay = mw.cx.widgets.overlay();
                        $( 'body' ).append( this.$overlay );
                }
 
diff --git a/modules/source/styles/ext.cx.source.selector.less 
b/modules/source/styles/ext.cx.source.selector.less
index eb2059c..ff02a0e 100644
--- a/modules/source/styles/ext.cx.source.selector.less
+++ b/modules/source/styles/ext.cx.source.selector.less
@@ -116,16 +116,6 @@
        }
 }
 
-.cx-sourceselector-dialog__overlay {
-       position: fixed;
-       top: 0;
-       left: 0;
-       height: 100%;
-       width: 100%;
-       background-color: #FFF;
-       opacity: 0.5;
-}
-
 .cx-sourceselector-dialog__license {
        .mw-ui-item;
        .mw-ui-one-whole;
diff --git a/modules/widgets/overlay/ext.cx.overlay.js 
b/modules/widgets/overlay/ext.cx.overlay.js
new file mode 100644
index 0000000..b206ab5
--- /dev/null
+++ b/modules/widgets/overlay/ext.cx.overlay.js
@@ -0,0 +1,26 @@
+/**
+ * ContentTranslation Tools
+ * A tool that allows editors to translate pages from one language
+ * to another with the help of machine translation and other translation tools
+ *
+ * @file
+ * @ingroup Extensions
+ * @copyright See AUTHORS.txt
+ * @license GPL-2.0+
+ */
+( function ( $, mw ) {
+       'use strict';
+       mw.cx.widgets = mw.cx.widgets || {};
+       /**
+        * Generate an overlay element.
+        * Usage:
+        *  var $overlay = mw.cx.widgets.overlay()
+        *  $(body).append( $overlay ); // Applies overlay
+        *  $overlay.hide(); // Hide the overlay
+        * @return {jQuery} the overlay element
+        */
+       mw.cx.widgets.overlay = function () {
+               return $( '<div>' )
+                       .addClass( 'cx-overlay' );
+       };
+}( jQuery, mediaWiki ) );
diff --git a/modules/widgets/overlay/ext.cx.overlay.less 
b/modules/widgets/overlay/ext.cx.overlay.less
new file mode 100644
index 0000000..30f5647
--- /dev/null
+++ b/modules/widgets/overlay/ext.cx.overlay.less
@@ -0,0 +1,9 @@
+.cx-overlay {
+       position: fixed;
+       top: 0;
+       left: 0;
+       height: 100%;
+       width: 100%;
+       background-color: #FFF;
+       opacity: 0.5;
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icdcb0861a4479f780c7a5056863578341de070fc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>
Gerrit-Reviewer: Amire80 <amir.ahar...@mail.huji.ac.il>
Gerrit-Reviewer: KartikMistry <kartik.mis...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to