[MediaWiki-commits] [Gerrit] Hygiene: Panels should not automatically be appended to DOM - change (mediawiki...MobileFrontend)

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

Change subject: Hygiene: Panels should not automatically be appended to DOM
..


Hygiene: Panels should not automatically be appended to DOM

The panel is exhibiting the behaviour of a drawer which creates problems
when you try to insert a Panel inside another view e.g. an overlay

A Drawer is something that gets added to the bottom of the page
A Panel can be used anywhere.

Note this *might* require a change to WikiGrokDialog but I don't understand
that code well enough to know how to do this.

Bug: T96176
Change-Id: Id171118c104a872f7e2e00de57cc125645cb4207
---
M javascripts/Drawer.js
M javascripts/Panel.js
2 files changed, 12 insertions(+), 13 deletions(-)

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



diff --git a/javascripts/Drawer.js b/javascripts/Drawer.js
index c7f039a..d826c49 100644
--- a/javascripts/Drawer.js
+++ b/javascripts/Drawer.js
@@ -10,6 +10,10 @@
 */
Drawer = Panel.extend( {
className: 'drawer position-fixed',
+   /**
+* Defines an element that the Drawer should automatically be 
appended to.
+* @property {String}
+*/
appendToElement: '#mw-mf-viewport',
closeOnScroll: true,
events: $.extend( {}, Panel.prototype.events, {
@@ -18,7 +22,12 @@
 
/** @inheritdoc */
postRender: function () {
-   Panel.prototype.postRender.apply( this, arguments );
+   var self = this;
+   // This module might be loaded at the top of the page 
e.g. Special:Uploads
+   // Thus ensure we wait for the DOM to be loaded
+   $( function () {
+   self.appendTo( self.appendToElement );
+   } );
this.on( 'show', $.proxy( this, 'onShowDrawer' ) );
this.on( 'hide', $.proxy( this, 'onHideDrawer' ) );
},
diff --git a/javascripts/Panel.js b/javascripts/Panel.js
index 919a885..0dd8e13 100644
--- a/javascripts/Panel.js
+++ b/javascripts/Panel.js
@@ -1,4 +1,4 @@
-( function ( M, $ ) {
+( function ( M ) {
 
var View = M.require( 'View' ),
Panel;
@@ -12,18 +12,8 @@
className: 'panel',
// in milliseconds
minHideDelay: 10,
-   appendToElement: '#content',
events: {
'click .cancel': 'onCancel'
-   },
-   /** @inheritdoc */
-   postRender: function () {
-   var self = this;
-   // This module might be loaded at the top of the page 
e.g. Special:Uploads
-   // Thus ensure we wait for the DOM to be loaded
-   $( function () {
-   self.appendTo( self.appendToElement );
-   } );
},
 
/**
@@ -90,4 +80,4 @@
 
M.define( 'Panel', Panel );
 
-}( mw.mobileFrontend, jQuery ) );
+}( mw.mobileFrontend ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id171118c104a872f7e2e00de57cc125645cb4207
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson 
Gerrit-Reviewer: Bmansurov 
Gerrit-Reviewer: Jdlrobson 
Gerrit-Reviewer: Phuedx 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] Hygiene: Panels should not automatically be appended to DOM - change (mediawiki...MobileFrontend)

2015-04-15 Thread Jdlrobson (Code Review)
Jdlrobson has uploaded a new change for review.

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

Change subject: Hygiene: Panels should not automatically be appended to DOM
..

Hygiene: Panels should not automatically be appended to DOM

The panel is exhibiting the behaviour of a drawer which creates problems
when you try to insert a Panel inside another view e.g. an overlay

Note this will require a change to WikiGrokDialog but I don't understand
that code well enough to know how to do this (WikiGrokDialog confusingly has
an isDrawer option - a WikiGrokDialog is either a Panel or a Drawer - it 
shouldn't
be both! :)

Bug: T96176
Change-Id: Id171118c104a872f7e2e00de57cc125645cb4207
---
M javascripts/Drawer.js
M javascripts/Panel.js
2 files changed, 10 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/01/204301/1

diff --git a/javascripts/Drawer.js b/javascripts/Drawer.js
index c7f039a..f85fd93 100644
--- a/javascripts/Drawer.js
+++ b/javascripts/Drawer.js
@@ -10,6 +10,10 @@
 */
Drawer = Panel.extend( {
className: 'drawer position-fixed',
+   /**
+* Defines an element that the Panel should automatically be 
appended to.
+* @property {String}
+*/
appendToElement: '#mw-mf-viewport',
closeOnScroll: true,
events: $.extend( {}, Panel.prototype.events, {
@@ -18,7 +22,12 @@
 
/** @inheritdoc */
postRender: function () {
-   Panel.prototype.postRender.apply( this, arguments );
+   var self = this;
+   // This module might be loaded at the top of the page 
e.g. Special:Uploads
+   // Thus ensure we wait for the DOM to be loaded
+   $( function () {
+   self.appendTo( self.appendToElement );
+   } );
this.on( 'show', $.proxy( this, 'onShowDrawer' ) );
this.on( 'hide', $.proxy( this, 'onHideDrawer' ) );
},
diff --git a/javascripts/Panel.js b/javascripts/Panel.js
index 919a885..d62c22c 100644
--- a/javascripts/Panel.js
+++ b/javascripts/Panel.js
@@ -12,18 +12,8 @@
className: 'panel',
// in milliseconds
minHideDelay: 10,
-   appendToElement: '#content',
events: {
'click .cancel': 'onCancel'
-   },
-   /** @inheritdoc */
-   postRender: function () {
-   var self = this;
-   // This module might be loaded at the top of the page 
e.g. Special:Uploads
-   // Thus ensure we wait for the DOM to be loaded
-   $( function () {
-   self.appendTo( self.appendToElement );
-   } );
},
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id171118c104a872f7e2e00de57cc125645cb4207
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson 

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