Santhosh has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/390189 )

Change subject: Bring back the overlay support for a specific screen region
......................................................................

Bring back the overlay support for a specific screen region

Templates and template editor was using this and got
accidentally removed in I0198e67dc2bcf

This commit brings back that feature with the help of an option
fullscreen. The value for this option is by default true, since
that is the general usecase screnario.

Change-Id: Iee396e8517245ec6de2093949c8352015dadb970
Follow-up: I0198e67dc2bcf98e90293d8809aa68b18a220ffb
Bug: T179997
---
M modules/tools/ext.cx.tools.template.editor.js
M modules/tools/ext.cx.tools.template.js
M modules/widgets/overlay/ext.cx.overlay.js
M modules/widgets/overlay/ext.cx.overlay.less
4 files changed, 21 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/89/390189/1

diff --git a/modules/tools/ext.cx.tools.template.editor.js 
b/modules/tools/ext.cx.tools.template.editor.js
index bd98932..1876958 100644
--- a/modules/tools/ext.cx.tools.template.editor.js
+++ b/modules/tools/ext.cx.tools.template.editor.js
@@ -154,6 +154,7 @@
                        }
 
                        $value.cxoverlay( {
+                               fullscreen: false,
                                showLoading: true
                        } );
                        mw.cx.wikitextToHTML( self.siteMapper, language, 
value.wt ).then( function ( response ) {
@@ -291,6 +292,7 @@
 
                // The html value is not available. We need to parse wikitext 
here.
                $value.cxoverlay( {
+                       fullscreen: false,
                        showLoading: true
                } );
 
@@ -447,6 +449,7 @@
                        queue = $.Deferred().resolve();
 
                self.targetTemplate.$template.first().cxoverlay( {
+                       fullscreen: false,
                        showLoading: true
                } );
 
diff --git a/modules/tools/ext.cx.tools.template.js 
b/modules/tools/ext.cx.tools.template.js
index 5c16214..403bd87 100644
--- a/modules/tools/ext.cx.tools.template.js
+++ b/modules/tools/ext.cx.tools.template.js
@@ -962,6 +962,7 @@
                var self = this;
 
                this.targetTemplate.$template.first().cxoverlay( {
+                       fullscreen: false,
                        showLoading: true
                } );
                return this.targetTemplate.getUpdatedTemplate().then( function 
( $newTemplate ) {
@@ -1146,6 +1147,7 @@
 
                // Not a processed template. Proceed with attempt to adapt.
                $targetTemplate.first().cxoverlay( {
+                       fullscreen: false,
                        showLoading: true
                } );
 
diff --git a/modules/widgets/overlay/ext.cx.overlay.js 
b/modules/widgets/overlay/ext.cx.overlay.js
index ee852d4..f15a1e0 100644
--- a/modules/widgets/overlay/ext.cx.overlay.js
+++ b/modules/widgets/overlay/ext.cx.overlay.js
@@ -14,7 +14,7 @@
         */
        function CXOverlay( element, options ) {
                this.$container = $( element || 'body' );
-               this.options = options || {};
+               this.options = $.extend( {}, $.fn.cxoverlay.defaults, options );
                this.$overlay = null;
                this.init();
        }
@@ -31,6 +31,11 @@
 
                if ( this.options.showLoading ) {
                        this.$overlay.append( mw.cx.widgets.spinner() );
+               }
+
+               if ( this.options.fullscreen ) {
+                       this.$overlay
+                               .addClass( 'cx-overlay-fullscreen' );
                }
 
                if ( this.options.closeOnClick ) {
@@ -74,4 +79,9 @@
                } );
        };
 
+       $.fn.cxoverlay.defaults = {
+               fullscreen: true,
+               closeOnClick: false,
+               showLoading: false
+       };
 }( jQuery, mediaWiki ) );
diff --git a/modules/widgets/overlay/ext.cx.overlay.less 
b/modules/widgets/overlay/ext.cx.overlay.less
index 34317d0..3eff7e6 100644
--- a/modules/widgets/overlay/ext.cx.overlay.less
+++ b/modules/widgets/overlay/ext.cx.overlay.less
@@ -2,7 +2,7 @@
 
 .cx-overlay {
        background-color: #fff;
-       position: fixed;
+       position: absolute;
        top: 0;
        left: 0;
        z-index: 300; // 200 is the z-index of sticky header
@@ -13,6 +13,10 @@
        &--clickable {
                background-color: transparent;
        }
+
+       &-fullscreen {
+               position: fixed;
+       }
 }
 
 body.cx-noscroll {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee396e8517245ec6de2093949c8352015dadb970
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

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

Reply via email to