jenkins-bot has submitted this change and it was merged.
Change subject: Add tour for VisualEditor
......................................................................
Add tour for VisualEditor
* It automatically chooses the correct tour depending on whether
VisualEditor is detected.
* If they click 'Show help' while already editing with VE, it will
simply show the applicable step (pointing to Save).
* Mark that old tour is specific to wikitext flow, and new one is for
VE flow.
* Don't preload 'Show help' tour on server.
Bug: 50186
Change-Id: I92958ba665b9462ca4ed941efcbe1170e3a0697c
---
M GettingStarted.i18n.php
M GettingStarted.php
M resources/ext.gettingstarted.taskToolbar.js
M resources/tours/gettingstartedtasktoolbar.js
A resources/tours/gettingstartedtasktoolbarve.js
5 files changed, 121 insertions(+), 2 deletions(-)
Approvals:
Swalling: Looks good to me, but someone else must approve
Spage: Looks good to me, approved
jenkins-bot: Verified
diff --git a/GettingStarted.i18n.php b/GettingStarted.i18n.php
index 67449df..f911c14 100644
--- a/GettingStarted.i18n.php
+++ b/GettingStarted.i18n.php
@@ -65,6 +65,9 @@
// TODO (mattflaschen, 2013-04-25): Use <nowiki>[edit]</nowiki> after
bug 45173 is fixed.
'guidedtour-tour-gettingstartedtasktoolbar-edit-section-description' =>
'If you want to edit a specific section, you can click on the blue
\'{{int:editsection}}\' link at the top of each section.',
+ 'guidedtour-tour-gettingstartedtasktoolbarve-click-save-title' => 'You
can edit!',
+ 'guidedtour-tour-gettingstartedtasktoolbarve-click-save-description' =>
'You can now edit the page. When you\'re done, click
\'{{int:visualeditor-toolbar-savedialog}}\' to review and save your changes.',
+
// Notifications
'notification-gettingstarted-link-text-get-started' => 'Get started',
'notification-gettingstarted-start-editing' => '{{SITENAME}} is a free
encyclopedia written by people like you. [[Special:GettingStarted|Get started]]
by making your first edit!',
@@ -163,6 +166,9 @@
'guidedtour-tour-gettingstartedtasktoolbar-edit-section-description' =>
'Description of step showing user how to edit a section.',
'notification-gettingstarted-link-text-get-started' => 'Label for
button that links to the page to get started for editing.
{{Identical|Get started}}',
+ 'guidedtour-tour-gettingstartedtasktoolbarve-click-save-title' =>
'Title of first step of GettingStarted tour that is on the VisualEditor screen.
It points to the {{msg-mw|visualeditor-toolbar-savedialog}} button.',
+ 'guidedtour-tour-gettingstartedtasktoolbarve-click-save-description' =>
'Description of first step of GettingStarted tour that is on the VisualEditor
screen. It points to the {{msg-mw|visualeditor-toolbar-savedialog}} button.',
+
'notification-gettingstarted-start-editing' => 'Text shown on web when
someone confirms their email but has not yet edited the main namespace:
* $1 - username (unused); GENDER is supported',
'notification-gettingstarted-start-editing-email-subject' => 'Subject
of email sent when someone confirms their email but has not yet edited the main
namespace:
diff --git a/GettingStarted.php b/GettingStarted.php
index 7a86c26..9852bc2 100644
--- a/GettingStarted.php
+++ b/GettingStarted.php
@@ -147,6 +147,29 @@
),
) + $gettingStartedModuleInfo;
+$wgResourceModules['ext.guidedTour.tour.gettingstartedtasktoolbarve'] = array(
+ 'scripts' => 'tours/gettingstartedtasktoolbarve.js',
+ 'dependencies' => array(
+ 'ext.guidedTour',
+ 'ext.gettingstarted.logging',
+ ),
+ 'messages' => array(
+ 'editsection',
+ 'vector-view-edit',
+ 'visualeditor-toolbar-savedialog',
+ 'guidedtour-tour-gettingstartedtasktoolbar-ambox-title',
+ 'guidedtour-tour-gettingstartedtasktoolbar-ambox-description',
+ 'guidedtour-tour-gettingstartedtasktoolbar-edit-article-title',
+
'guidedtour-tour-gettingstartedtasktoolbar-edit-article-description',
+ 'guidedtour-tour-gettingstartedtasktoolbar-edit-section-title',
+
'guidedtour-tour-gettingstartedtasktoolbar-edit-section-description',
+ 'guidedtour-tour-gettingstartedtasktoolbarve-click-save-title',
+
'guidedtour-tour-gettingstartedtasktoolbarve-click-save-description',
+ 'guidedtour-tour-gettingstarted-end-title',
+ 'guidedtour-tour-gettingstarted-end-description',
+ ),
+) + $gettingStartedModuleInfo;
+
// ext.gettingstarted.logging and ext.gettingstarted.openTask are on every
page site-wide
// regardless of bucket.
$wgResourceModules[ 'ext.gettingstarted.logging' ] = array(
@@ -199,7 +222,6 @@
'mediawiki.libs.guiders',
'ext.guidedTour.lib',
'ext.guidedTour.tour.gettingstartedtasktoolbarintro',
- 'ext.guidedTour.tour.gettingstartedtasktoolbar',
'ext.gettingstarted.logging',
),
'messages' => array(
diff --git a/resources/ext.gettingstarted.taskToolbar.js
b/resources/ext.gettingstarted.taskToolbar.js
index 8967770..e7f9b5f 100644
--- a/resources/ext.gettingstarted.taskToolbar.js
+++ b/resources/ext.gettingstarted.taskToolbar.js
@@ -54,7 +54,10 @@
title: mw.message(
'gettingstarted-task-toolbar-editing-help-title' ).text()
} ).text( mw.message(
'gettingstarted-task-toolbar-editing-help-text' ).text() )
.click( function ( evt ) {
- mw.guidedTour.launchTour(
'gettingstartedtasktoolbar' );
+ var tourName = mw.libs.ve !== undefined ?
+ 'gettingstartedtasktoolbarve' :
'gettingstartedtasktoolbar';
+
+ mw.guidedTour.launchTour( tourName );
evt.stopPropagation();
} );
diff --git a/resources/tours/gettingstartedtasktoolbar.js
b/resources/tours/gettingstartedtasktoolbar.js
index 9b4cd25..0c6fa72 100644
--- a/resources/tours/gettingstartedtasktoolbar.js
+++ b/resources/tours/gettingstartedtasktoolbar.js
@@ -1,4 +1,5 @@
// Tour started on article page, with task toolbar showing
+// Used for wikitext editing. The 'gettingstartedtasktoolbarve' tour is for
VisualEditor.
( function ( window, document, $, mw, gt ) {
var task = mw.gettingStarted.logging.getTaskForCurrentPage() || '',
@@ -16,6 +17,7 @@
gt.defineTour( {
name: 'gettingstartedtasktoolbar',
shouldLog: true,
+ showConditionally: 'wikitext',
steps: [ {
titlemsg:
'guidedtour-tour-gettingstartedtasktoolbar-ambox-title',
descriptionmsg:
'guidedtour-tour-gettingstartedtasktoolbar-ambox-description',
diff --git a/resources/tours/gettingstartedtasktoolbarve.js
b/resources/tours/gettingstartedtasktoolbarve.js
new file mode 100644
index 0000000..1afd740
--- /dev/null
+++ b/resources/tours/gettingstartedtasktoolbarve.js
@@ -0,0 +1,86 @@
+// Tour started on article page, with task toolbar showing
+// Used for VisualEditor. The 'gettingstartedtasktoolbar' tour is for
wikitext editing.
+
+( function ( $, mw, gt ) {
+ var task = mw.gettingStarted.logging.getTaskForCurrentPage() || '',
+ editSectionSelector = '.mw-editsection-link-primary',
+ hasEditSectionAtLoadTime;
+
+ // The code around the section stuff is a bit of a hack, but I want to
see if this is common
+ // so I don't over-framework it.
+ //
+ // The reason hasEditSection is a function is that through VE, users
can dynamically add or
+ // remove sections without a page load.
+ function hasEditSection() {
+ return $( editSectionSelector ).length > 0;
+ }
+
+ // https://bugzilla.wikimedia.org/show_bug.cgi?id=48198
+ if ( mw.config.get( 'wgCanonicalNamespace' ) !== '' || task.indexOf(
'gettingstarted-' ) !== 0 ) {
+ return;
+ }
+
+ // Ideally, the button would also change dynamically as well if they
re-start the tour (without a page load).
+ // However, with the way defineTour currently works, that is not
possible. The variable name is intended
+ // to make that clear.
+ hasEditSectionAtLoadTime = hasEditSection();
+
+ gt.defineTour( {
+ name: 'gettingstartedtasktoolbarve',
+ shouldLog: true,
+ showConditionally: 'VisualEditor',
+ steps: [ {
+ titlemsg:
'guidedtour-tour-gettingstartedtasktoolbar-ambox-title',
+ descriptionmsg:
'guidedtour-tour-gettingstartedtasktoolbar-ambox-description',
+ attachTo: '.ambox',
+ position: 'bottomLeft',
+ autoFocus: true,
+ width: 450,
+ buttons: [ {
+ action: 'next'
+ } ],
+ shouldSkip: function () {
+ return gt.isVisualEditorOpen() || $( '.ambox'
).length === 0;
+ }
+ }, {
+ titlemsg:
'guidedtour-tour-gettingstartedtasktoolbar-edit-article-title',
+ descriptionmsg:
'guidedtour-tour-gettingstartedtasktoolbar-edit-article-description',
+ position: 'bottom',
+ attachTo: '#ca-edit',
+ autoFocus: true,
+ width: 300,
+ shouldSkip: gt.isVisualEditorOpen,
+ buttons: [ {
+ namemsg: hasEditSectionAtLoadTime ?
'guidedtour-next-button' : 'guidedtour-okay-button',
+ onclick: function () {
+ if ( hasEditSection() ) {
+ mw.libs.guiders.next();
+ } else {
+ mw.libs.guiders.hideAll();
+ }
+ }
+ } ],
+ allowAutomaticOkay: false
+ }, {
+ titlemsg:
'guidedtour-tour-gettingstartedtasktoolbar-edit-section-title',
+ descriptionmsg:
'guidedtour-tour-gettingstartedtasktoolbar-edit-section-description',
+ position: 'right',
+ attachTo: editSectionSelector,
+ autoFocus: true,
+ width: 300,
+ shouldSkip: function () {
+ return gt.isVisualEditorOpen() ||
!hasEditSection();
+ }
+ }, {
+ titlemsg:
'guidedtour-tour-gettingstartedtasktoolbarve-click-save-title',
+ descriptionmsg:
'guidedtour-tour-gettingstartedtasktoolbarve-click-save-description',
+ attachTo: '.ve-ui-toolbar-saveButton',
+ position: 'left',
+ autoFocus: true,
+ closeOnClickOutside: false,
+ shouldSkip: function() {
+ return !gt.isEditing();
+ }
+ } ]
+ } );
+} ( jQuery, mediaWiki, mediaWiki.guidedTour ) );
--
To view, visit https://gerrit.wikimedia.org/r/72682
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I92958ba665b9462ca4ed941efcbe1170e3a0697c
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/extensions/GettingStarted
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Spage <[email protected]>
Gerrit-Reviewer: Swalling <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits