Merge "Improve readability of SpecialBlock::checkUnblockSelf"
[lhc/web/wiklou.git] / resources / src / mediawiki.widgets / mw.widgets.ComplexTitleInputWidget.js
index 0c6c15e..2c4044d 100644 (file)
@@ -4,7 +4,7 @@
  * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
  * @license The MIT License (MIT); see LICENSE.txt
  */
-( function ( $, mw ) {
+( function () {
 
        /**
         * Like TitleInputWidget, but the namespace has to be input through a separate dropdown field.
 
        OO.inheritClass( mw.widgets.ComplexTitleInputWidget, OO.ui.Widget );
 
+       /* Static Methods */
+
+       /**
+        * @inheritdoc
+        */
+       mw.widgets.ComplexTitleInputWidget.static.reusePreInfuseDOM = function ( node, config ) {
+               config = mw.widgets.ComplexTitleInputWidget.parent.static.reusePreInfuseDOM( node, config );
+               config.namespace = mw.widgets.NamespaceInputWidget.static.reusePreInfuseDOM(
+                       $( node ).find( '.mw-widget-namespaceInputWidget' ),
+                       config.namespace
+               );
+               config.title = mw.widgets.TitleInputWidget.static.reusePreInfuseDOM(
+                       $( node ).find( '.mw-widget-titleInputWidget' ),
+                       config.title
+               );
+               return config;
+       };
+
+       /**
+        * @inheritdoc
+        */
+       mw.widgets.ComplexTitleInputWidget.static.gatherPreInfuseState = function ( node, config ) {
+               var state = mw.widgets.ComplexTitleInputWidget.parent.static.gatherPreInfuseState( node, config );
+               state.namespace = mw.widgets.NamespaceInputWidget.static.gatherPreInfuseState(
+                       $( node ).find( '.mw-widget-namespaceInputWidget' ),
+                       config.namespace
+               );
+               state.title = mw.widgets.TitleInputWidget.static.gatherPreInfuseState(
+                       $( node ).find( '.mw-widget-titleInputWidget' ),
+                       config.title
+               );
+               return state;
+       };
+
        /* Methods */
 
        /**
                this.title.setNamespace( Number( this.namespace.getValue() ) );
        };
 
-}( jQuery, mediaWiki ) );
+       /**
+        * @inheritdoc
+        */
+       mw.widgets.ComplexTitleInputWidget.prototype.restorePreInfuseState = function ( state ) {
+               mw.widgets.ComplexTitleInputWidget.parent.prototype.restorePreInfuseState.call( this, state );
+               this.namespace.restorePreInfuseState( state.namespace );
+               this.title.restorePreInfuseState( state.title );
+       };
+
+       /**
+        * @inheritdoc
+        */
+       mw.widgets.ComplexTitleInputWidget.prototype.setDisabled = function ( disabled ) {
+               mw.widgets.ComplexTitleInputWidget.parent.prototype.setDisabled.call( this, disabled );
+               if ( this.namespace ) {
+                       this.namespace.setDisabled( disabled );
+               }
+
+               if ( this.title ) {
+                       this.title.setDisabled( disabled );
+               }
+               return this;
+       };
+
+}() );