Yuvipanda has uploaded a new change for review.

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

Change subject: DO NOT MERGE
......................................................................

DO NOT MERGE

Just a base underlying structure for Popups inheritance

Change-Id: Ifa77d1c3b9a6aab31aa93dd6277e257a10f29c4f
---
A resources/ext.popups.ArticlePopup.js
A resources/ext.popups.Popup.js
A resources/ext.popups.main.js
3 files changed, 66 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups 
refs/changes/47/113947/1

diff --git a/resources/ext.popups.ArticlePopup.js 
b/resources/ext.popups.ArticlePopup.js
new file mode 100644
index 0000000..326e90d
--- /dev/null
+++ b/resources/ext.popups.ArticlePopup.js
@@ -0,0 +1,19 @@
+( function() {
+       function ArticlePopup() {
+       }
+
+       ArticlePopup.prototype = mw.Popup.prototype;
+
+       ArticlePopup.prototype.render = function() {
+               // Takes data and renders, actually
+       };
+
+       ArticlePopup.prototype.init = function( title ) {
+               var $d = new $.Deferred();
+               // Do whatever
+               this.isRedirect = something;
+               return $d;
+       }
+
+       mw.popups.ArticlePopup = ArticlePopup;
+}) ();
\ No newline at end of file
diff --git a/resources/ext.popups.Popup.js b/resources/ext.popups.Popup.js
new file mode 100644
index 0000000..377d7b3
--- /dev/null
+++ b/resources/ext.popups.Popup.js
@@ -0,0 +1,38 @@
+( function() {
+       function Popup() {
+       }
+
+       /**
+        * Renders the information in this popup into an unattached DOM element 
and returns it.
+        */
+       Popup.prototype.render = function() {
+       };
+
+       /**
+        * Returns a deferred with itself as a param when it has finished 
initializing itself
+        *
+        * @param title
+        */
+       Popup.prototype.init = function( title ) {
+       }
+
+       /**
+        * Creates a popup of a particular type for a particular page
+        *
+        * @param type one of the supported popup types. Currently supports 
"article"
+        * @param title Title of the target page to form a popup for
+        * @return A promise object that resolves with a subtype of the Popup 
object
+        */
+       mw.popups.createPopupFor = function( type, title ) {
+               var $ret = new $.Deferred();
+               if ( type === "article" ) {
+                       var popup = new ArticlePopup();
+                       return popup.init( title );
+
+               }
+       };
+
+
+       mw.popups = {};
+       mw.popups.Popup = Popup;
+} )();
diff --git a/resources/ext.popups.main.js b/resources/ext.popups.main.js
new file mode 100644
index 0000000..ea9a6b0
--- /dev/null
+++ b/resources/ext.popups.main.js
@@ -0,0 +1,9 @@
+( function() {
+       function displayPopup( popup ) {
+               var innerDOM = popup.render();
+               $( "<div>" ).addClass("something" ).append(innerDOM );
+               if (g === null) {
+                       dosomething;
+               }
+       }
+})();
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa77d1c3b9a6aab31aa93dd6277e257a10f29c4f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <[email protected]>

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

Reply via email to