SuchABot has uploaded a new change for review. https://gerrit.wikimedia.org/r/64981
Change subject: Adding first edit tour ...................................................................... Adding first edit tour Gerrit makes me cry. Change-Id: I38ecddd5d8afcf59b7918378b94201d59b907c65 GitHub: https://github.com/wikimedia/mediawiki-extensions-GuidedTour/pull/1 --- M GuidedTour.i18n.php A modules/tours/firstedit.js 2 files changed, 127 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GuidedTour refs/changes/81/64981/1 diff --git a/GuidedTour.i18n.php b/GuidedTour.i18n.php index 05fc37f..7ba3924 100644 --- a/GuidedTour.i18n.php +++ b/GuidedTour.i18n.php @@ -47,6 +47,18 @@ 'guidedtour-tour-gettingstarted-click-save-description' => 'Click \'{{int:savearticle}}\' and your changes will be visible.', 'guidedtour-tour-gettingstarted-end-title' => 'Looking for more to do?', 'guidedtour-tour-gettingstarted-end-description' => '[[Special:GettingStarted|Getting Started]] is updated every hour with new pages.', + + // firstedit + 'guidedtour-tour-firstedit-start-title' => 'Ready to get started?', + 'guidedtour-tour-firstedit-start-description' => 'This tour will show you the basic steps of editing any page.', + 'guidedtour-tour-firstedit-click-edit-title' => 'Click \'{{int:vector-view-edit}}\'', + 'guidedtour-tour-firstedit-click-edit-description' => 'This will take you in to editing mode, which shows you the source of the page, and lets you make changes to any part.', + 'guidedtour-tour-firstedit-click-preview-title' => 'Preview (optional)', + 'guidedtour-tour-firstedit-click-preview-description' => 'Clicking \'{{int:showpreview}}\' allows you to check what the page will look like with your changes. Just don\'t forget to save.', + 'guidedtour-tour-firstedit-click-save-title' => 'You\'re almost finished!', + 'guidedtour-tour-firstedit-click-save-description' => 'Click \'{{int:savearticle}}\' and your changes will be visible.', + 'guidedtour-tour-firstedit-end-title' => 'That\'s it!', + 'guidedtour-tour-firstedit-end-description' => 'You just made an edit. Not so scary, right?', ); /** Message documentation (Message documentation) @@ -89,6 +101,17 @@ 'guidedtour-tour-gettingstarted-click-save-description' => 'Click save to save your work', 'guidedtour-tour-gettingstarted-end-title' => 'Title of last step of Getting Started tour!', 'guidedtour-tour-gettingstarted-end-description' => 'You can find other interesting things to work on', + + 'guidedtour-tour-firstedit-start-title' => 'Title of the first step of a tour for making an edit', + 'guidedtour-tour-firstedit-start-description' => 'Description of first step in tour', + 'guidedtour-tour-firstedit-click-edit-title' => 'Title of step showing users where to click edit', + 'guidedtour-tour-firstedit-click-edit-description' => 'Description of step showing users where to click edit', + 'guidedtour-tour-firstedit-click-preview-title' => 'Title of step explaining preview', + 'guidedtour-tour-firstedit-click-preview-description' => 'Description of step explaining preview', + 'guidedtour-tour-firstedit-click-save-title' => 'Title of step explaining saving an edit', + 'guidedtour-tour-firstedit-click-save-description' => 'Description of step explaining how to save', + 'guidedtour-tour-firstedit-end-title' => 'Title of last step of first edit tour', + 'guidedtour-tour-firstedit-end-description' => 'Description of last step of first edit tour', ); /** Arabic (العربية) diff --git a/modules/tours/firstedit.js b/modules/tours/firstedit.js new file mode 100644 index 0000000..30026b2 --- /dev/null +++ b/modules/tours/firstedit.js @@ -0,0 +1,104 @@ +// Guided Tour to help users make their first edit. Designed to work on any Wikipedia article. + +( function ( window, document, $, mw, guiders ) { + +var gt = mw.guidedTour; + +gt.currentTour = 'firstedit'; + +function shouldSkipPageName() { + // Excludes pages outside the main namespace and pages with editing restrictions + if ( mw.config.get( 'wgCanonicalNamespace' ) !== '' || mw.config.get( 'wgRestrictionEdit' ).length !== 0 ) { + return true; + } + +// Just don't initialize the guiders +if ( shouldSkipPageName() ) { + return; +} + +gt.initGuider( { + id: 'gt-firstedit-1', + titlemsg: 'guidedtour-tour-firstedit-start-title', + descriptionmsg: 'guidedtour-tour-firstedit-start-description', + overlay: true, + next: 'gt-firstedit-2', + buttons: [ { + action: 'next' + } ], + // TODO: Factor out into lib. Also, it should probably use wgAction, rather than query. + shouldSkip: function() { + // If they're already editing, skip + return gt.hasQuery( { action: 'edit' } ); + } + +} ); + +gt.initGuider( { + id: 'gt-firstedit-2', + titlemsg: 'guidedtour-tour-firstedit-click-edit-title', + descriptionmsg: 'guidedtour-tour-firstedit-click-edit-description', + attachTo: '#ca-edit', + position: 'bottom', + next: 'gt-firstedit-3', + shouldSkip: function() { + return gt.hasQuery( { action: 'edit' } ); + } +} ); + +gt.initGuider( { + id: 'gt-firstedit-2', + titlemsg: 'guidedtour-tour-firstedit-click-edit-title', + descriptionmsg: 'guidedtour-tour-firstedit-click-edit-description', + attachTo: '#ca-edit', + position: 'bottom', + next: 'gt-firstedit-3', + shouldSkip: function() { + return gt.hasQuery( { action: 'edit' } ); + } +} ); + +gt.initGuider( { + id: 'gt-firstedit-3', + titlemsg: 'guidedtour-tour-firstedit-click-preview-title', + descriptionmsg: 'guidedtour-tour-firstedit-click-preview-description', + attachTo: '#wpPreview', + position: 'top', + next: 'gt-firstedit-4', + closeOnClickOutside: false, + shouldSkip: function() { + return !gt.hasQuery( { action: 'edit' } ); + } +} ); + +gt.initGuider( { + id: 'gt-firstedit-4', + titlemsg: 'guidedtour-tour-firstedit-click-save-title', + descriptionmsg: 'guidedtour-tour-firstedit-click-save-description', + attachTo: '#wpSave', + position: 'top', + next: 'gt-firstedit-5', + closeOnClickOutside: false, + shouldSkip: function() { + // If they're not previewing or doing show changes, skip + return !gt.hasQuery( { action: 'submit' } ); + } +} ); + +gt.initGuider( { + id: 'gt-firstedit-5', + titlemsg: 'guidedtour-tour-firstedit-end-title', + descriptionmsg: 'guidedtour-tour-firstedit-end-description', + overlay: true, + shouldSkip: function() { + // Skip this if the user hasn't just saved. + return !gt.isPostEdit(); + }, + buttons: [ { + action: 'end' + } ] +} ); + + + +} (window, document, jQuery, mediaWiki, mediaWiki.libs.guiders) ); -- To view, visit https://gerrit.wikimedia.org/r/64981 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I38ecddd5d8afcf59b7918378b94201d59b907c65 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GuidedTour Gerrit-Branch: master Gerrit-Owner: SuchABot <yuvipanda+sucha...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits