{"id":956,"date":"2019-06-29T22:22:19","date_gmt":"2019-06-30T03:22:19","guid":{"rendered":"http:\/\/hardlikesoftware.com\/weblog\/?p=956"},"modified":"2019-12-24T14:14:35","modified_gmt":"2019-12-24T19:14:35","slug":"interactive-grid-tour-app","status":"publish","type":"post","link":"https:\/\/hardlikesoftware.com\/weblog\/2019\/06\/29\/interactive-grid-tour-app\/","title":{"rendered":"Interactive Grid Tour App"},"content":{"rendered":"<p>At Kscope 19 in Seattle and APEX Connect in Bonn I presented a <a target=\"_blank\" href=\"https:\/\/www.doag.org\/formes\/pubfiles\/11306665\/2019-apex-john_snyders-beginner_session_apex_for_beginners_-_interactive_grid-praesentation.pdf\" rel=\"noopener noreferrer\">beginners session<\/a> on interactive grid where I demonstrated an app that gives a guided tour of the interactive grid features. As promised I&#8217;m making the app available. It uses the same data as the Sample Interactive Grids app so make sure that is installed first. Then <a href=\"\/weblog\/download\/apex\/Interactive Grid Tour f106.zip\">download the Interactive Grid Tour<\/a>. If you are new to interactive grid this app is a good introduction to what it can do. It takes a different approach compared to the Sample Interactive Grids app in that it guides you through just about all of the built-in capabilities with a series of popup notes.<\/p>\n<p><img loading=\"lazy\" src=\"http:\/\/hardlikesoftware.com\/weblog\/wp-content\/uploads\/2019\/06\/IGtour.png\" alt=\"Interactive Grid Tour\" class=\"aligncenter size-full wp-image-958\" width=\"843\" height=\"553\" srcset=\"https:\/\/hardlikesoftware.com\/weblog\/wp-content\/uploads\/2019\/06\/IGtour.png 843w, https:\/\/hardlikesoftware.com\/weblog\/wp-content\/uploads\/2019\/06\/IGtour-300x197.png 300w, https:\/\/hardlikesoftware.com\/weblog\/wp-content\/uploads\/2019\/06\/IGtour-768x504.png 768w\" sizes=\"(max-width: 843px) 100vw, 843px\" \/><\/p>\n<p>Even if you are already an expert on IG the app may still have some value for you. Have you ever wanted to make sure users are aware of some new feature in your app. You have probably seen apps that do this. After an upgrade they will popup a note or notes that point out some new things. There is a reusable widget in this app that does just this.<\/p>\n<p><!--more--><\/p>\n<p>[Update 24-Dec-19 there is a newer version of the showMe widget that works for 19.2 that you can find <a href=\"https:\/\/hardlikesoftware.com\/weblog\/2019\/12\/23\/all-the-things-that-pop-up\/\">here<\/a>]<\/p>\n<p>Here\u2019s the scenario: You have a popular app that has been in use for years. The users are very familiar with it. You have added two new features that they get to from buttons on the home page but you are concerned that users won\u2019t notice because their navigation patterns are so ingrained. You want a popup to educate them about the new features when they use the app. This is what the <code>showMe<\/code> widget is for. Making use of this widget will require some JavaScript and CSS skill.<\/p>\n<p>Here are the steps to make use of it in your own apps:<\/p>\n<ol>\n<li><a href=\"\/weblog\/download\/apex\/Interactive Grid Tour f106.zip\">Download<\/a> the tour app and install it. Run the app to get a feeling for what showMe can do.<\/li>\n<li>Go to Shared Components &gt; Application Files and extract (download) the <code>IGtour.css<\/code> and <code>showme.js<\/code> files.<\/li>\n<li>The styles needed for <code>showMe<\/code> widget are in the <code>IGtour.css<\/code> file. Copy all the rules after the &#8220;Show-me classes&#8221; comment into your application\u2019s CSS file. What, your app doesn\u2019t have it\u2019s own CSS file? Hmm. Must be a very straight forward app. No problem. You can add a new CSS file (recommended) or simply copy the rules into the page CSS inline attribute on any pages where <code>showMe<\/code> is going to be used.<\/li>\n<li>Go to your app where you want to add a tour. Or create a new app just to try this out.<\/li>\n<ol style=\"list-style: lower-alpha\" type=\"a\">\n<li>Go to Shared Components &gt; Static Application Files. Upload the <code>showme.js<\/code> file and the file where you added the CSS rules. I\u2019ll assume it is called <code>app.css<\/code>.<\/li>\n<li>Now go to Shared Components &gt; User Interface Attributes &gt; Desktop.<br \/>\nIn JavaScript File URLs enter:<\/p>\n<pre><code>    #APP_IMAGES#showme.js<\/code><\/pre>\n<p>In Cascading Style Sheets File URLs enter:<\/p>\n<pre><code>    #APP_IMAGES#app.css.<\/code><\/pre>\n<p>If you added the CSS rules to an existing file that is already loaded then this last step isn\u2019t needed. <strong>Note:<\/strong> If you are only adding a tour to one or a few specific pages then you could load these files just on those pages. The general idea is that these two files need to be loaded on any page where you want to give a tour of your app features.<\/li>\n<\/ol>\n<li>Go to the page where you want to add the tour. I\u2019m going to assume that there are two buttons on this page that represent the new features to call out and their static ids are &#8220;feature1&#8221; and &#8220;feature2&#8221;. You can substitute any jQuery selector you like in the tour steps and even add more steps (See step 7).<\/li>\n<li>Add an inline popup region to the page. Add a Static Content region to the Inline Dialogs position and set the Template to Inline Popup. Set the title to &#8220;Tour&#8221;. The title won\u2019t be seen. Set the templates options: Remove page Overlay and Set Dialog Size to None. The <code>showMe<\/code> widget uses the popup functionality but doesn\u2019t include it so that you can customize the popup to fit your needs. <strong>Note:<\/strong> you won&#8217;t use the <code>apex.theme.openRegion<\/code> API with this popup region.<\/li>\n<li>The tour is driven by markup added to the popup. Add the following to the popup region Source Text attribute.\n<pre style=\"white-space:pre;word-wrap:normal\"><code>&lt;ul class=\"show-me\"&gt;\n    &lt;li data-element=\"#feature1\"&gt;\n      Press this button to make a random person on the Internet a little happier today.\n    &lt;\/li&gt;\n    &lt;li data-element=\"#feature2\"&gt;\n      Press this button to be &lt;em&gt;5% more&lt;\/em&gt; productive.\n    &lt;\/li&gt;\n&lt;\/ul&gt;\n<\/code><\/pre>\n<p>The <code>show-me<\/code> class causes this list to be turned into a <code>showMe<\/code> widget automatically when the page loads. Each list element is a step in the tour. The content of the list element is shown next to the element identified by the jQuery selector in <code>data-element<\/code>. Other attributes used to control the showMe tour steps include: <code>data-name, data-position, data-zindex, data-width, data-height, data-url<\/code>. The position attribute controls the popup position relative to the element and can be one of &#8220;below&#8221; (default), &#8220;above&#8221;, &#8220;left&#8221;, &#8220;right&#8221;, &#8220;inside&#8221;, and &#8220;center&#8221;.<\/li>\n<li>Add a dynamic action to start the tour when the page loads.<br \/>\nName: start tour<br \/>\nEvent: Page Load<br \/>\nAdd one Execute JavaScript Code action and Add this code:<\/p>\n<pre><code>    $(\".show-me\").first().showMe(\"nextStep\");<\/code><\/pre>\n<\/li>\n<li>Add a Next button to the Next button position in the popup region created in step 6. Set the button name to TOUR_NEXT and the label to Next. Add a dynamic action to go to the next step of the tour. This looks a lot like the one in the previous step.<br \/>\nName: next step<br \/>\nEvent: Click<br \/>\nSelect Type: Button<br \/>\nButton: TOUR_NEXT<br \/>\nAdd one Execute JavaScript Code action and Add this code:<\/p>\n<pre><code>    $(\".show-me\").first().showMe(\"nextStep\");<\/code><\/pre>\n<\/li>\n<li>Now run the page and you should see the first tour popup. Click next to see the next tour step.<\/li>\n<\/ol>\n<p>See the Interactive Grid tour app for more advanced uses. It defines a number of actions and dynamic actions on the global page (page 0) because the tour is used throughout the app. The actions let you use keyboard shortcuts. The <code>showMe<\/code> step options <code>doBefore<\/code> and <code>doAfter<\/code> let you handle advanced situations where the state of the page needs to be set before the step can be shown such as selecting a tab or expanding a region. The logic to open a menu so that a tour step popup can point to a menu item is complicated and not very robust. The code for it is in the <code>IGtour.js<\/code> file.<\/p>\n<p>It would be easy to add a &#8220;don\u2019t show me this again&#8221; checkbox to the popup and save that state as a hidden page item backed by a user preference. The page load DA that starts the tour would only start it if the user hasn\u2019t checked the box. There are many other possibilities for starting or continuing the tour.<\/p>\n<p>Read the <code>showme.js<\/code> source code comments to learn about the options and methods it supports. You will probably want to modify the CSS for the popup for example to change the colors.<\/p>\n<p>Because the <code>showMe<\/code> widget is driven by simple list markup it would not be unreasonable to create an APEX list template for it. I did not do this because the list is specific to a given page, contains sometimes complex jQuery selectors, and doesn\u2019t leverage app URLs much. So I found it much more convenient to simply author the list markup right on the page.<\/p>\n<p>When I created showMe I wanted to leverage the popup widget as much as possible. One thing that was missing was the callout \u2013 that little triangle that points to the element that the popup is related to. So I added the callout functionality as part of showMe. Shakeeb and I liked it so much that we added it to the APEX <code>menu<\/code> and <code>popup<\/code> widgets and hopefully this will be in 19.2. So this <code>showMe<\/code> widget may need to be changed when the popup has its own callout implementation.<\/p>\n<p>If you add showMe to your app I would be happy to hear any feedback you have.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At Kscope 19 in Seattle and APEX Connect in Bonn I presented a beginners session on interactive grid where I demonstrated an app that gives<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/hardlikesoftware.com\/weblog\/2019\/06\/29\/interactive-grid-tour-app\/\">Continue reading<span class=\"screen-reader-text\">Interactive Grid Tour App<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18,13],"tags":[41,51,44,52,53],"_links":{"self":[{"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/posts\/956"}],"collection":[{"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/comments?post=956"}],"version-history":[{"count":18,"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/posts\/956\/revisions"}],"predecessor-version":[{"id":1033,"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/posts\/956\/revisions\/1033"}],"wp:attachment":[{"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/media?parent=956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/categories?post=956"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/tags?post=956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}