Some improvements in tour

This commit is contained in:
James Cole
2015-07-12 12:45:41 +02:00
parent 50752a5bfe
commit 9c09353559
5 changed files with 59 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
/* globals $, columnChart, google, lineChart, pieChart, stackedColumnChart, areaChart */
/* globals $, columnChart,showTour, Tour, google, lineChart, pieChart, stackedColumnChart, areaChart */
$(function () {
"use strict";
@@ -9,18 +9,32 @@ $(function () {
// do chart JS stuff.
drawChart();
}
$.getJSON('json/tour').success(function (data) {
var tour = new Tour({steps: data.steps, template: data.template});
// Initialize the tour
tour.init();
// Start the tour
tour.start();
});
if (showTour) {
$.getJSON('json/tour').success(function (data) {
var tour = new Tour(
{
steps: data.steps,
template: data.template,
onEnd: endTheTour
});
// Initialize the tour
tour.init();
// Start the tour
tour.start();
}).fail(function () {
console.log('Already had tour.');
});
}
});
function endTheTour() {
"use strict";
$.post('json/end-tour', {_token: token});
}
function drawChart() {
"use strict";
areaChart('chart/account/frontpage', 'accounts-chart');