Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit efa95a91 authored by Robin Tissot's avatar Robin Tissot

Update onboarding.js and allow exiting with escape when on last step.

parent d611cbe1
......@@ -828,9 +828,9 @@
"dev": true
},
"intro.js": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/intro.js/-/intro.js-0.6.0.tgz",
"integrity": "sha1-D82p9DZOIBiX4RKJ4A3S5S4col8="
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/intro.js/-/intro.js-3.3.1.tgz",
"integrity": "sha512-Y+iMbIzVQou9PDRP5miKa7NNQeUkSA6XFp+atnGiTarEi2jghthSLK+9JUvdM6QvQ9G+bpOEfKd+DNtWJlGb9w=="
},
"is-core-module": {
"version": "2.2.0",
......
......@@ -16,7 +16,7 @@
"diff": "^4.0.1",
"dropzone": "^5.5.1",
"file-loader": "^6.2.0",
"intro.js": "^0.6.0",
"intro.js": "^3.3.1",
"jquery": "^3.3.1",
"jquery-ui-dist": "^1.12.1",
"js-cookie": "^2.2.0",
......
......@@ -4,24 +4,29 @@ Just set ONBOARDING_PAGE in the page before the scripts block.super eg:
const ONBOARDING_PAGE = 'onboarding_document_form';
*/
export function bootOnboarding() {
if (typeof ONBOARDING_PAGE !== 'undefined') {
var onboarding_page_done = userProfile.get(ONBOARDING_PAGE) || false;
if (!onboarding_page_done) {
var intro = introJs().setOptions({'skipLabel': "Skip"});
intro.oncomplete(function() {
userProfile.set(ONBOARDING_PAGE, true);
})
intro.onexit(function(aa) {
if (!userProfile.get(ONBOARDING_PAGE, true)) {
if (confirm("Are you sure you want to avoid further help?")) {
exitOnboarding();
intro.onbeforeexit(function(aa) {
if (intro._currentStep<intro._introItems.length-1) {
if (!userProfile.get(ONBOARDING_PAGE, true)) {
if (confirm("Are you sure you want to avoid further help?")) {
exitOnboarding();
} else {
return false;
}
}
} else {
userProfile.set(ONBOARDING_PAGE, true);
}
});
//document_form
if (ONBOARDING_PAGE == 'onboarding_document_form') {
intro.setOptions({
......@@ -48,7 +53,7 @@ export function bootOnboarding() {
},
]
});
} else if (ONBOARDING_PAGE == 'onboarding_images') {
intro.setOptions({
steps: [
......@@ -89,7 +94,7 @@ export function bootOnboarding() {
}
]
});
} else if (ONBOARDING_PAGE == 'onboarding_edit') {
intro.setOptions({
steps: [
......@@ -125,7 +130,7 @@ export function bootOnboarding() {
}]
});
}
document.addEventListener('DOMContentLoaded', function() {
intro.start();
});
......
......@@ -21,7 +21,7 @@ window.Dropzone = require('dropzone/dist/dropzone');
// Intro.js needs to be explicitly set on window, as it's used at boot time
// by onboarding.js
window.introJs = require('intro.js/intro').introJs;
window.introJs = require('intro.js');
// moment needs to be explicitly set on window, as it's used at boot time
// by trans_modal.js
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment