MarkTraceur has uploaded a new change for review.
https://gerrit.wikimedia.org/r/183620
Change subject: Add Deed UI class, move next-step handling to it
......................................................................
Add Deed UI class, move next-step handling to it
Change-Id: I4593374dedd1a9c166b77e8d06f56337e50c4ea7
---
M UploadWizardHooks.php
M resources/controller/uw.controller.Deed.js
M resources/mw.UploadWizard.js
A resources/ui/uw.ui.Deed.js
M resources/ui/uw.ui.Wizard.js
5 files changed, 81 insertions(+), 29 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard
refs/changes/20/183620/1
diff --git a/UploadWizardHooks.php b/UploadWizardHooks.php
index 157f686..94c30c7 100644
--- a/UploadWizardHooks.php
+++ b/UploadWizardHooks.php
@@ -508,7 +508,7 @@
'oojs',
'uw.controller.Step',
'uw.controller.base',
- 'uw.ui.Step',
+ 'uw.ui.Deed',
),
),
@@ -522,7 +522,6 @@
'uw.controller.base',
'uw.controller.Step',
'uw.ui.Details',
- 'uw.ui.Step',
),
),
@@ -610,6 +609,17 @@
),
),
+ 'uw.ui.Deed' => array(
+ 'scripts' => array(
+ 'resources/ui/uw.ui.Deed.js',
+ ),
+
+ 'dependencies' => array(
+ 'oojs',
+ 'uw.ui.Step',
+ ),
+ ),
+
'uw.ui.Details' => array(
'scripts' => array(
'resources/ui/uw.ui.Details.js',
diff --git a/resources/controller/uw.controller.Deed.js
b/resources/controller/uw.controller.Deed.js
index d488ad9..ac2bbfa 100644
--- a/resources/controller/uw.controller.Deed.js
+++ b/resources/controller/uw.controller.Deed.js
@@ -21,7 +21,10 @@
function Deed() {
uw.controller.Step.call(
this,
- new uw.ui.Step( $( '#mwe-upwiz-stepdiv-deeds' ), $(
'#mwe-upwiz-step-deeds' ) )
+ new uw.ui.Deed()
+ .connect( this, {
+ 'next-step': [ 'emit', 'next-step' ]
+ } )
);
}
diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index b6e0cda..edd6ffd 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -61,7 +61,14 @@
} );
} ),
- deeds: new uw.controller.Deed(),
+ deeds: new uw.controller.Deed()
+ .on( 'next-step', function () {
+ // validate has the side effect of
notifying the user of problems, or removing existing notifications.
+ // if returns false, you can assume
there are notifications in the interface.
+ if ( wizard.deedChooser.valid() ) {
+ wizard.moveToStep( 'details' );
+ }
+ } ),
details: new uw.controller.Details()
.on( 'start-details', function () {
@@ -122,14 +129,6 @@
this.ui = new uw.ui.Wizard( this )
.on( 'reset-wizard', function () {
wizard.reset();
- } )
-
- .on( 'next-from-deeds', function () {
- // validate has the side effect of
notifying the user of problems, or removing existing notifications.
- // if returns false, you can assume
there are notifications in the interface.
- if ( wizard.deedChooser.valid() ) {
- wizard.moveToStep( 'details' );
- }
} );
// check to see if the the skip tutorial preference or
global setting is set
diff --git a/resources/ui/uw.ui.Deed.js b/resources/ui/uw.ui.Deed.js
new file mode 100644
index 0000000..659161d
--- /dev/null
+++ b/resources/ui/uw.ui.Deed.js
@@ -0,0 +1,57 @@
+/*
+ * This file is part of the MediaWiki extension UploadWizard.
+ *
+ * UploadWizard is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * UploadWizard is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with UploadWizard. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+( function ( mw, $, ui, oo ) {
+ var DP;
+
+ /**
+ * Represents the UI for the wizard's Deed step.
+ * @class uw.ui.Deed
+ * @extends uw.ui.Step
+ * @constructor
+ */
+ function Deed() {
+ var deed = this;
+
+ ui.Step.call(
+ this,
+ $( '#mwe-upwiz-stepdiv-deeds' ),
+ $( '#mwe-upwiz-step-deeds' )
+ );
+
+ this.$div.find( '.mwe-upwiz-button-next' ).click( function () {
+ $( '.mwe-upwiz-hint' ).each( function () {
+ // Close tipsy help balloons
+ $( this ).tipsy( 'hide' );
+ } );
+
+ deed.emit( 'next-step' );
+ } );
+ }
+
+ oo.inheritClass( Deed, ui.Step );
+
+ DP = Deed.prototype;
+
+ /**
+ * Empty out all upload information.
+ */
+ DP.empty = function () {
+ };
+
+ ui.Deed = Deed;
+}( mediaWiki, jQuery, mediaWiki.uploadWizard.ui, OO ) );
diff --git a/resources/ui/uw.ui.Wizard.js b/resources/ui/uw.ui.Wizard.js
index cf22f08..3f52f2d 100644
--- a/resources/ui/uw.ui.Wizard.js
+++ b/resources/ui/uw.ui.Wizard.js
@@ -38,7 +38,6 @@
this.initButtons();
this.initTutorial();
- this.initDeeds();
}
oo.mixinClass( UploadWizardInterface, oo.EventEmitter );
@@ -208,22 +207,6 @@
// handler for next button
$( '#mwe-upwiz-stepdiv-tutorial .mwe-upwiz-button-next').click(
function () {
ui.emit( 'next-from-tutorial' );
- } );
- };
-
- /**
- * Initializes the deed step interface.
- */
- UWIP.initDeeds = function () {
- var ui = this;
-
- $( '#mwe-upwiz-stepdiv-deeds .mwe-upwiz-button-next').click(
function () {
- $( '.mwe-upwiz-hint' ).each( function () {
- // Close tipsy help balloons
- $( this ).tipsy( 'hide' );
- } );
-
- ui.emit( 'next-from-deeds' );
} );
};
--
To view, visit https://gerrit.wikimedia.org/r/183620
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4593374dedd1a9c166b77e8d06f56337e50c4ea7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits