Provides auto start and "filter by tip class" query strings to facilitate multipage tours.

Technical pointers when creating tour tips

Query strings

  • ?tour- Auto starts the tour on page. eg ?tour=1
  • ?tips - Filters down the tips available on the page based based on the provided class. eg ?tips=tip-views-ui-displays

Tour module generates output like (from admin/structure/views/view/frontpage/edit)

<li
  class="tip-module-views-ui tip-type-text tip-views-ui-displays odd first" ## Use for ?tips
  data-aria-labelledby="tour-tip-views-ui-displays-label"
  data-aria-describedby="tour-tip-views-ui-displays-contents"
  data-id="views-display-top"
>
  <h2 id="tour-tip-views-ui-displays-label" class="tour-tip-label">Displays in this view</h2>
  <p id="tour-tip-views-ui-displays-contents" class="tour-tip-body">A view can ... </p>
  <div class="tour-progress">1 of 10</div>
</li>

You may use the class classes to filter on tips.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nick_schuch’s picture

Here is a patch that demonstrates that this is definitely achievable. This is purely a proof of concept patch and Im going to look at consolidating the tour_multipage custom module into the core tour module.

nick_schuch’s picture

To kick off this basic multipage tour just trigger off the tour on the front page.

nick_schuch’s picture

Status: Active » Needs review
FileSize
6.45 KB

The following patch allows for multipage tips.

How can we use this patch for multipage?

Tours can leverage this patch and become multipage tour by including links to a url with the query string ?tour=1. To only show tips of a specific type the query string ?tips=tour-module-view-ui (as an example). Can be used.

What is left?

- It looks like overlay wants to run the tour twice (parent and overlay windows)....

Status: Needs review » Needs work

The last submitted patch, tour-multipage-1942576-3.patch, failed testing.

nick_schuch’s picture

Rerolled after Language patch commit.

nick_schuch’s picture

Status: Needs work » Needs review
nick_schuch’s picture

The following patch adds:

1) Fixes js errors when filtered down to no tips.
2) Hides the "Tour" toggle button if no tips are available once filtered.

nick_schuch’s picture

Issue tags: +JavaScript

Adding tag for javascript review.

nod_’s picture

is the setTimout required at all? hve you tried without, Since it's in a behavior already it's already at the DOMContentLoaded stage of the page.

I wouldn't look to much into the _removeIrrelevantTourItems, see #1938032: Simplify tour.js.

Looks good otherwise :)

nick_schuch’s picture

Thanks nod_!

The timeout was added in because the tips didnt get enough time to position correctly on the page. I have included a screenshot. This is reproducible by removing the timeout.

Screen Shot 2013-03-21 at 10.12.06 PM.png

Also, Ill get the review happening on the simplifying the js issue :)

nick_schuch’s picture

Hopefully we can get in the simplify js issue first and reroll this here.

nod_’s picture

is the same thing happening when overlay is not used?

nick_schuch’s picture

No. Looks like it's all good outside of overlay.

larowlan’s picture

Issue tags: -JavaScript

#7: tour-multipage-1942576-7.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +JavaScript

The last submitted patch, tour-multipage-1942576-7.patch, failed testing.

larowlan’s picture

Status: Needs work » Needs review
+++ b/core/modules/tour/js/tour.jsundefined
@@ -171,13 +184,16 @@ Drupal.tour.views.ToggleTourView = Backbone.View.extend({
+        if (($document.find('#' + itemId + ', .' + itemClass).length === 0) ||

will need a re-roll against latest HEAD

+++ b/core/modules/tour/js/tour.jsundefined
@@ -201,4 +221,4 @@ Drupal.tour.views.ToggleTourView = Backbone.View.extend({
\ No newline at end of file

Missing new line

+++ b/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.phpundefined
@@ -39,6 +39,13 @@ class Tour extends ConfigEntityBase {
+  public $module;

+++ b/core/modules/tour/lib/Drupal/tour/TourRenderController.phpundefined
@@ -26,6 +26,13 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
+              'tip-module-' . drupal_clean_css_identifier($entity->get('module')),

+++ b/core/modules/tour/tests/tour_test/config/tour.tour.tour-test-2.ymlundefined
@@ -1,4 +1,5 @@
+module: tour_test

+++ b/core/modules/tour/tests/tour_test/config/tour.tour.tour-test.ymlundefined
@@ -1,4 +1,5 @@
+module: tour_test

+++ b/core/modules/views/views_ui/config/tour.tour.views-ui.ymlundefined
@@ -1,4 +1,5 @@
+module: views_ui

aren't these already in?

nick_schuch’s picture

Issue tags: +Needs reroll

Correct. Will reroll tonight.

nick_schuch’s picture

All rerolled an ready for review. To test this:

* "admin/structure/views/view/frontpage/edit?tour=1" - Starts the tour on page load (can be a link in tips on other pages).
* "admin/structure/views/view/frontpage/edit?tour=1&tips=tip-views-ui-displays" - Filters down to a single tip (this means multipage tours don't get high jacked by other tours on the page).

Kristen Pol’s picture

@nick_schuch - don't see an attachment.

nick_schuch’s picture

oh! late nights... thanks Kirsten Pol!

Kristen Pol’s picture

Thanks for the patch! I tested and the tour links you provided work. I'm not clear how the multipage tour works though. The links were just for a tour on views. In one case the full tour and the other, just showing one part of the tour. Can you explain how to test the multipage tour feature?

I reviewed the code and it looks fine to me. I don't know what bbq is for but it sounds delicious :)

nick_schuch’s picture

Absolutely.

Other tips could provide a "Continue the tour" link with a url containing the ?tour=1 query on the end. This will start the tour on that pages load. If I wanted to filter down the tips on the continued page I could include the tips= to filter them down to a specific subset.

Kristen Pol’s picture

Status: Needs review » Reviewed & tested by the community

Ah, gotcha :) So... is it easy to add the "Continue the tour" link? I haven't played with tour yet. We want to make a multilingual tour:

#1940590: META: Write a multipage multilingual tour

and it will be multipage. Multilingual multipage madness! :)

So... I'll mark RTBC since this patch does what you say it does and the code looks okay.

nick_schuch’s picture

Thanks for the review Kristen Pol!

The link could be displayed in the body text of the tip. Which could be a sentence at the end explaining "Continue tour here" or body text in the tip could even link to the page and kick off the tour.

Maybe we should arrange a hangout some time? That way we could coordinate tips and the word being done on tour?

tstoeckler’s picture

Status: Reviewed & tested by the community » Needs review

I'm not sure the setTimeout() thing has been sufficiently is there anyway to fix the positioning in the overlay without a setTimeout(). IMO it would be a shame to add such ugliness only because of good old overlay... If there's no other way, I can live with it, but I don't have the impression that was really explored. Hence, setting to needs review.

Kristen Pol’s picture

@nick_schuch - I'm not sure I'll be doing the multilingual tour myself. I'm behind with work-work :/ Though, it sounds fun to do! :)

Kristen Pol’s picture

It would be great if this one was resolved so the multilingual tours can link to each other:

#1940590: META: Write a multipage multilingual tour

clemens.tolboom’s picture

Patch needed a re-roll.

I've added some documentation as we now use the query string.

TODOs:

Remove the timeout if possible as mentioned by @tstoeckler in #25

I don't get the ?tips option yet.

        // Filter tips vs query string.
        if (query.tips && !$(this).hasClass(query.tips)) {
          removals = true;
          $this.remove();
          return;
        }

This means 'remove all but named classes' thus one has to know all classes on the other page which must be kept. I expected a continue from tip aka jump to tip on the next page.

clemens.tolboom’s picture

I've adjusted the toolbar tour from #1920468: Write tour integration for the first page after install showing extend and other things to test with. Also attached is #2027469: View UI Tour is not working and had a sandbox update..

This will auto start the next tour.

  1. copy the attached yaml files to sites/default/files/config_*/active. Make sure to remove the '_' from the file names.
  2. apply this issues patch
  3. clear cache
  4. visit the frontpage
  5. start tour
  6. when on 'configuration' click on 'Edit frontpage view'
  7. see it continues the 'Edit view tour'
clemens.tolboom’s picture

Category: task » feature

Testing is even more simple by navigate to a tour page with ?tour=1 like

http://drupal.d8/#overlay=admin/structure/views/view/frontpage?tour=1

As this issue has a patch it's a feature request which must go in this week :-/

nick_schuch’s picture

Assigned: nick_schuch » Unassigned

Needs a javascript expert. Removing myself from task.

Kristen Pol’s picture

Issue tags: +sprint, +Tour

Adding some tags.

nick_schuch’s picture

As discussed with nod_ in IRC. There are issues with the "active" state which breaks positioning of the tips. Have rerolled without the timeout.

nod_’s picture

Status: Needs review » Reviewed & tested by the community

the issue is with upstream actually. The toolbar bug is legit but wasn't the reason for the bug like I thought earlier.

Not much we can do at our level it should be taken with upstream.

Kristen Pol’s picture

Thanks @nod_ for the review!

Would love for this to get committed soon so the multilingual tours can use asap :)

clemens.tolboom’s picture

My question from #28 isn't addressed.

I don't get the ?tips option yet.

This means 'remove all but named classes' thus one has to know all classes on the other page which must be kept. I expected a continue from tip aka jump to tip on the next page.

Filtering on class is AFAIK not related to the tips but to the content unless tour.schema.yml tour.tip.attributes has a 'class'. Does it?

I checked tou_ui TipPluginTextExtended but does not see a class attribute. Only data-id and data-class.

nick_schuch’s picture

Tips get provided a series of classes in there respective markup. This allows for contrib to have flexibility and could be anything from theming to js behaviours. In our case we can use "?tips" to filter down tips to a specific subset. Out of the following markup provided via "admin/structure/views/view/content/edit":

<li data-id="views-display-top" data-aria-describedby="tour-tip-views-ui-displays-contents" data-aria-labelledby="tour-tip-views-ui-displays-label" class="tip-module-views-ui tip-type-text tip-views-ui-displays odd first"></li>
<li data-class="views-display-top li.active" data-aria-describedby="tour-tip-views-ui-displays-contents" data-aria-labelledby="tour-tip-views-ui-displays-label" class="tip-module-views-ui tip-type-text tip-views-ui-active-display even"></li>
<li data-class="views-ui-display-tab-bucket.format" data-aria-describedby="tour-tip-views-ui-displays-contents" data-aria-labelledby="tour-tip-views-ui-displays-label" class="tip-module-views-ui tip-type-text tip-views-ui-format even"></li>
<li data-class="views-ui-display-tab-bucket.filter-criteria" data-aria-describedby="tour-tip-views-ui-displays-contents" data-aria-labelledby="tour-tip-views-ui-displays-label" class="tip-module-views-ui tip-type-text tip-views-ui-filter even"></li>
<li data-class="views-ui-display-tab-bucket.sort-criteria" data-aria-describedby="tour-tip-views-ui-displays-contents" data-aria-labelledby="tour-tip-views-ui-displays-label" class="tip-module-views-ui tip-type-text tip-views-ui-sorts even"></li>
<li data-id="preview-submit" data-aria-describedby="tour-tip-views-ui-displays-contents" data-aria-labelledby="tour-tip-views-ui-displays-label" class="tip-module-views-ui tip-type-text tip-views-ui-preview even last" data-text="End tour"></li>

All these tips will be shown when pressing the "Tour" toggle in the top right of the page.

If I were to add "?tour=1&tips=tip-views-ui-displays" to the url I would only then see one tip (our tip with the tip-views-ui-displays class) and the tour will start immediately.

However that is just an example.

A more practical scenario for this would be if multiple tours where present on a page and I only wanted to show the only the views ui tour. I could provide a link that had "?tour=1&tips=tip-module-views-ui" appended to the end of the url and all the tips above will still show as they have this class required. If another tour was added to this page later down the track this would also ensure only the views ui tour would still be displayed.

nick_schuch’s picture

Category: feature » task

Reverting #30.

clemens.tolboom’s picture

ic ... so these are the tip IDs and not classes.

@nick_schuch: what do you mean with

reverting #30

We certainly need an issue summary update on this.

klonos’s picture

...

klonos’s picture

Issue summary: View changes

Updated issue summary.

nick_schuch’s picture

Issue summary has been updated.

larowlan’s picture

re #39
They are classes, not tip ids. Using a tip id means we can only filter to a single tip. Using a class means we can filter to a group.
The class is part of the tip attributes. The tip attributes are parsed into a standard Attributes object which is rendered as html attributes. Any valid html attribute can be used, including (in this case) class. The attributes property is marked as a sequence in the config schema to cover that it contains an array of variable attributes.
Tour module helpfully adds some default classes if none are provided in the yaml and in most cases this will be enough. These default classes include odd/even, first/last, the tip type (eg tip-type-text) and one identifying the module that the tour belongs to (eg tip-module-views-ui).
As articulated by @nick_schuch at #37 filtering by class means that upon arriving at a page with ?tour=1&tips=foo the available tips on the page are filtered down to only those matching the foo class. Consider a general 'introduction to Drupal' tour that might visit several pages within the site but only show an overview tip on each of those pages, using the tips=foo parameter allows for this behaviour. The tour could visit each page in the multi-page tour, show a selection of tips (targeted by the ?tips=foo parameter) from that page and continue to the next page. Without the ?tips=foo parameter, the multipage tour would present all tips on the page.

clemens.tolboom’s picture

@larowlan thanks for this explanation in #42.

Unfortunately I still don't get it as AFAIK the attribute values are the destination/target for each tips.

Is the issue summary link the one that should work?
- http://drupal.d8/admin/structure/views/view/frontpage/edit?tips=tip-view...

YesCT’s picture

Issue tags: +RTBC July 1

This issue was RTBC and passing tests on July 1, the beginning of API freeze.

larowlan’s picture

@Clemens, I think we are talking about different things, you are talking about the target element (uses data-id or data-class) that the tip describes. I am talking about the markup that wraps the tip that is output in the page (and transformed into a tip by joyride plugin). The attributes allows you to add additional attributes to the output tip, to aid theming/styling etc of a given tip.

larowlan’s picture

Issue summary: View changes

Provide instructions on multipage.

clemens.tolboom’s picture

@larowlan tnx again. I had a hangout with Nick and finally got it :/

I've updated the issue summary with one tip html output. The class is marked now. Other parts like tip direction (top, bottom, etc) and target still needs some description but that's another issue.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update

I don't understand how this issue "Demonstrates a multipage tour"... the issue title / summary could do with an update.

+++ b/core/modules/tour/js/tour.jsundefined
@@ -9,6 +9,10 @@
+ * It uses the query string for:
+ * - tour: start tour automaticly
+ * - tips: filter a subset of tips

I think this should include examples of how

+++ b/core/modules/tour/js/tour.jsundefined
@@ -159,7 +172,9 @@ Drupal.tour.views.ToggleTourView = Backbone.View.extend({
+   * Removes tour items for elements that don't exist or name from query string.
+   *
+   * Tour tips are filter by adding ?tips=

This documentation needs improvement...

+++ b/core/modules/tour/js/tour.jsundefined
@@ -171,15 +186,22 @@ Drupal.tour.views.ToggleTourView = Backbone.View.extend({
+        // Filter tips vs query string.
+        if (query.tips && !$(this).hasClass(query.tips)) {
+          removals = true;
+          $this.remove();
+          return;
+        }
+        // Filter tips vs page markup.
+        if ((itemId && $document.find('#' + itemId).length) ||
+            (itemClass && $document.find('.' + itemClass).length)) {
           return;
         }

Are there boxing matches going on here? The comments could do with being improved here.

nick_schuch’s picture

Title: Demonstrate a multipage tour » Tour tips to be able to link to other pages and start tour's automatically.
Status: Needs work » Needs review
FileSize
3.94 KB
1.91 KB

Here are the documentation changes as per alexpott's review in #47. I have also updated the issue title accordingly.

larowlan’s picture

Status: Needs review » Needs work
+++ b/core/modules/tour/js/tour.jsundefined
@@ -11,8 +11,11 @@
+ * - tour: Start tour automaticly on page load.

Should be automatically. Can we make it a proper sentence while you're at it. When ?tour=1 is present, the tour will start automatically after the page has loaded. Or similar.

+++ b/core/modules/tour/js/tour.jsundefined
@@ -11,8 +11,11 @@
+ * - tips: Filter a subset of tips based on tip's class.

'Pass ?tips=class in the url to filter the available tips to the subset which match the given class' perhaps?

+++ b/core/modules/tour/js/tour.jsundefined
@@ -172,9 +175,14 @@ Drupal.tour.views.ToggleTourView = Backbone.View.extend({
+   *   don't have the "foo" class.

I think you mean bar? If not I've got no idea what's going on :)

+++ b/core/modules/tour/js/tour.jsundefined
@@ -193,13 +201,13 @@ Drupal.tour.views.ToggleTourView = Backbone.View.extend({
+        // Remove tip from display based on provided query string (if set).

Can we make this a proper sentence? 'If the query parameter 'tips' is set, remove all tips that don't have the matching class'.

+++ b/core/modules/tour/js/tour.jsundefined
@@ -193,13 +201,13 @@ Drupal.tour.views.ToggleTourView = Backbone.View.extend({
+        // Remove tip from display if no corresponding page element.

'Remove all tips from the DOM if there is no corresponding page element'?

Feel free to tell me to take a long walk of a short pier.

nick_schuch’s picture

Nope, not at all, appreciate the feedback. Will get right on it!

nick_schuch’s picture

Status: Needs work » Needs review
FileSize
4.11 KB
1.86 KB

Here are the fixed as identified in #49.

nick_schuch’s picture

larowlan’s picture

+++ b/core/modules/tour/js/tour.jsundefined
@@ -171,15 +196,23 @@ Drupal.tour.views.ToggleTourView = Backbone.View.extend({
-        if ((!itemId && !itemClass) ||

We lost this line, I suspect that will mean modal tips will no longer work

larowlan’s picture

gremlins on d.o

nick_schuch’s picture

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

The interdiff between 52 and 55 is not correct...

+++ b/core/modules/views_ui/config/tour.tour.views-ui.ymlundefined
@@ -11,8 +11,6 @@ tips:

@@ -11,8 +11,6 @@ tips:
     label: Active display
     body: This is the active display in the view. When there are multiple displays, one link for each display is shown and you can switch displays simply by clicking on the display link.
     weight: "2"
-    attributes:
-      data-class: views-display-top li.active
   views-ui-displays:
     id: views-ui-displays

Is this change necessary?

I'm guess not as this is the first time it has appeared in this patch.

nick_schuch’s picture

Status: Needs work » Needs review
FileSize
4.01 KB
652 bytes

alexpott++

Your rock!

larowlan’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Tour, -RTBC July 1

Thanks @alexpott.

larowlan’s picture

Issue tags: +Tour, +RTBC July 1

Tagmonster--

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 102b8e4 and pushed to 8.x. Thanks!

alexpott’s picture

Title: Tour tips to be able to link to other pages and start tour's automatically. » Change notice: Tour tips to be able to link to other pages and start tour's automatically.
Priority: Normal » Critical
Status: Fixed » Active
Issue tags: -Needs issue summary update +Needs change record

Actually lets update https://drupal.org/node/1921162 with the new functionality.

nick_schuch’s picture

Issue tags: -Needs change record

Have updated notice as per suggestion in #62.

nick_schuch’s picture

Priority: Critical » Normal
Status: Active » Fixed
klonos’s picture

Title: Change notice: Tour tips to be able to link to other pages and start tour's automatically. » Tour tips to be able to link to other pages and start tour's automatically.

...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

xtfer’s picture

xtfer’s picture

Issue summary: View changes

Added html snippet to explain ?tips