Skip to content

Commit ff18966

Browse files
committed
bumped version
1 parent 6467bfc commit ff18966

File tree

5 files changed

+79
-54
lines changed

5 files changed

+79
-54
lines changed

bower.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-bootstrap-tour",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"main": "dist/angular-bootstrap-tour.js",
55
"ignore": [
66
".editorconfig",
@@ -26,7 +26,6 @@
2626
"respond": "~1.4.2"
2727
},
2828
"resolutions": {
29-
"angular": "1.2.16",
30-
"angular-route": "1.2.16"
29+
"angular": "1.2.16"
3130
}
3231
}

demo/angular-bootstrap-tour.js

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188

189189
//Pass static options through or use defaults
190190
var tour = {},
191+
templateReady,
191192
events = 'onStart onEnd afterGetState afterSetState afterRemoveState onShow onShown onHide onHidden onNext onPrev onPause onResume'.split(' '),
192193
options = 'name container keyboard storage debug redirect duration basePath backdrop orphan'.split(' ');
193194

@@ -198,7 +199,7 @@
198199
TourHelpers.attachEventHandlers(scope, attrs, tour, events);
199200

200201
//Compile template
201-
TourHelpers.attachTemplate(scope, attrs, tour);
202+
templateReady = TourHelpers.attachTemplate(scope, attrs, tour);
202203

203204
//Monitor number of steps
204205
scope.$watchCollection(ctrl.getSteps, function (steps) {
@@ -216,8 +217,10 @@
216217
}
217218

218219
//Initialize tour
219-
scope.tour = ctrl.init(tour);
220-
scope.tour.refresh = ctrl.refreshTour;
220+
templateReady.then(function () {
221+
scope.tour = ctrl.init(tour);
222+
scope.tour.refresh = ctrl.refreshTour;
223+
});
221224

222225
}
223226
};
@@ -235,7 +238,7 @@
235238
(function (app) {
236239
'use strict';
237240

238-
app.factory('TourHelpers', ['$templateCache', '$compile', 'TourConfig', function ($templateCache, $compile, TourConfig) {
241+
app.factory('TourHelpers', ['$templateCache', '$http', '$compile', 'TourConfig', '$q', function ($templateCache, $http, $compile, TourConfig, $q) {
239242

240243
var helpers = {},
241244
safeApply;
@@ -281,17 +284,18 @@
281284
*
282285
* @param {String} templateUrl
283286
* @param {$rootScope.Scope} scope
284-
* @returns {Function}
287+
* @returns {Promise}
285288
*/
286289
function lookupTemplate(templateUrl, scope) {
287290

288-
var template = $templateCache.get(templateUrl);
289-
290-
if (template) {
291-
return compileTemplate(template, scope);
292-
}
293-
294-
return null;
291+
return $http.get(templateUrl, {
292+
cache: $templateCache
293+
}).success(function (template) {
294+
if (template) {
295+
return compileTemplate(template, scope);
296+
}
297+
return '';
298+
});
295299

296300
}
297301

@@ -320,20 +324,26 @@
320324
*/
321325
helpers.attachTemplate = function (scope, attrs, options) {
322326

323-
var template;
327+
var deferred = $q.defer(),
328+
template;
324329

325330
if (attrs[helpers.getAttrName('template')]) {
326331
template = compileTemplate(scope.$eval(attrs[helpers.getAttrName('template')]), scope);
327-
}
328-
329-
if (attrs[helpers.getAttrName('templateUrl')]) {
330-
template = lookupTemplate(attrs[helpers.getAttrName('templateUrl')], scope);
331-
}
332-
333-
if (template) {
334332
options.template = template;
333+
deferred.resolve(template);
334+
} else if (attrs[helpers.getAttrName('templateUrl')]) {
335+
lookupTemplate(attrs[helpers.getAttrName('templateUrl')], scope).then(function (template) {
336+
if (template) {
337+
options.template = template;
338+
deferred.resolve(template);
339+
}
340+
});
341+
} else {
342+
deferred.resolve();
335343
}
336344

345+
return deferred.promise;
346+
337347
};
338348

339349
/**
@@ -418,9 +428,10 @@
418428
stepId: attrs.tourStep
419429
},
420430
events = 'onShow onShown onHide onHidden onNext onPrev onPause onResume'.split(' '),
421-
options = 'content title path animation container placement backdrop redirect orphan reflex nextStep prevStep nextPath prevPath'.split(' '),
431+
options = 'content title path animation container placement backdrop redirect orphan reflex duration nextStep prevStep nextPath prevPath'.split(' '),
422432
orderWatch,
423-
skipWatch;
433+
skipWatch,
434+
templateReady;
424435

425436
//Pass interpolated values through
426437
TourHelpers.attachInterpolatedValues(attrs, step, options);
@@ -433,7 +444,7 @@
433444
TourHelpers.attachEventHandlers(scope, attrs, step, events);
434445

435446
//Compile templates
436-
TourHelpers.attachTemplate(scope, attrs, step);
447+
templateReady = TourHelpers.attachTemplate(scope, attrs, step);
437448

438449
//Check whether or not the step should be skipped
439450
function stepIsSkipped() {
@@ -442,7 +453,7 @@
442453
skipped = scope.$eval(attrs[TourHelpers.getAttrName('skip')]);
443454
}
444455
if (!skipped) {
445-
skipped = !!step.path || element.is(':hidden');
456+
skipped = !!step.path || (element.is(':hidden') && !attrs.availableWhenHidden);
446457
}
447458
return skipped;
448459
}
@@ -489,7 +500,9 @@
489500
}
490501

491502
//Add step to tour
492-
ctrl.addStep(step);
503+
templateReady.then(function () {
504+
ctrl.addStep(step);
505+
});
493506

494507
}
495508
};

dist/angular-bootstrap-tour.js

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188

189189
//Pass static options through or use defaults
190190
var tour = {},
191+
templateReady,
191192
events = 'onStart onEnd afterGetState afterSetState afterRemoveState onShow onShown onHide onHidden onNext onPrev onPause onResume'.split(' '),
192193
options = 'name container keyboard storage debug redirect duration basePath backdrop orphan'.split(' ');
193194

@@ -198,7 +199,7 @@
198199
TourHelpers.attachEventHandlers(scope, attrs, tour, events);
199200

200201
//Compile template
201-
TourHelpers.attachTemplate(scope, attrs, tour);
202+
templateReady = TourHelpers.attachTemplate(scope, attrs, tour);
202203

203204
//Monitor number of steps
204205
scope.$watchCollection(ctrl.getSteps, function (steps) {
@@ -216,8 +217,10 @@
216217
}
217218

218219
//Initialize tour
219-
scope.tour = ctrl.init(tour);
220-
scope.tour.refresh = ctrl.refreshTour;
220+
templateReady.then(function () {
221+
scope.tour = ctrl.init(tour);
222+
scope.tour.refresh = ctrl.refreshTour;
223+
});
221224

222225
}
223226
};
@@ -235,7 +238,7 @@
235238
(function (app) {
236239
'use strict';
237240

238-
app.factory('TourHelpers', ['$templateCache', '$compile', 'TourConfig', function ($templateCache, $compile, TourConfig) {
241+
app.factory('TourHelpers', ['$templateCache', '$http', '$compile', 'TourConfig', '$q', function ($templateCache, $http, $compile, TourConfig, $q) {
239242

240243
var helpers = {},
241244
safeApply;
@@ -281,17 +284,18 @@
281284
*
282285
* @param {String} templateUrl
283286
* @param {$rootScope.Scope} scope
284-
* @returns {Function}
287+
* @returns {Promise}
285288
*/
286289
function lookupTemplate(templateUrl, scope) {
287290

288-
var template = $templateCache.get(templateUrl);
289-
290-
if (template) {
291-
return compileTemplate(template, scope);
292-
}
293-
294-
return null;
291+
return $http.get(templateUrl, {
292+
cache: $templateCache
293+
}).success(function (template) {
294+
if (template) {
295+
return compileTemplate(template, scope);
296+
}
297+
return '';
298+
});
295299

296300
}
297301

@@ -320,20 +324,26 @@
320324
*/
321325
helpers.attachTemplate = function (scope, attrs, options) {
322326

323-
var template;
327+
var deferred = $q.defer(),
328+
template;
324329

325330
if (attrs[helpers.getAttrName('template')]) {
326331
template = compileTemplate(scope.$eval(attrs[helpers.getAttrName('template')]), scope);
327-
}
328-
329-
if (attrs[helpers.getAttrName('templateUrl')]) {
330-
template = lookupTemplate(attrs[helpers.getAttrName('templateUrl')], scope);
331-
}
332-
333-
if (template) {
334332
options.template = template;
333+
deferred.resolve(template);
334+
} else if (attrs[helpers.getAttrName('templateUrl')]) {
335+
lookupTemplate(attrs[helpers.getAttrName('templateUrl')], scope).then(function (template) {
336+
if (template) {
337+
options.template = template;
338+
deferred.resolve(template);
339+
}
340+
});
341+
} else {
342+
deferred.resolve();
335343
}
336344

345+
return deferred.promise;
346+
337347
};
338348

339349
/**
@@ -418,9 +428,10 @@
418428
stepId: attrs.tourStep
419429
},
420430
events = 'onShow onShown onHide onHidden onNext onPrev onPause onResume'.split(' '),
421-
options = 'content title path animation container placement backdrop redirect orphan reflex nextStep prevStep nextPath prevPath'.split(' '),
431+
options = 'content title path animation container placement backdrop redirect orphan reflex duration nextStep prevStep nextPath prevPath'.split(' '),
422432
orderWatch,
423-
skipWatch;
433+
skipWatch,
434+
templateReady;
424435

425436
//Pass interpolated values through
426437
TourHelpers.attachInterpolatedValues(attrs, step, options);
@@ -433,7 +444,7 @@
433444
TourHelpers.attachEventHandlers(scope, attrs, step, events);
434445

435446
//Compile templates
436-
TourHelpers.attachTemplate(scope, attrs, step);
447+
templateReady = TourHelpers.attachTemplate(scope, attrs, step);
437448

438449
//Check whether or not the step should be skipped
439450
function stepIsSkipped() {
@@ -489,7 +500,9 @@
489500
}
490501

491502
//Add step to tour
492-
ctrl.addStep(step);
503+
templateReady.then(function () {
504+
ctrl.addStep(step);
505+
});
493506

494507
}
495508
};

dist/angular-bootstrap-tour.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-bootstrap-tour",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"description": "angular-bootstrap-tour scaffolded with generator-microjs v0.1.2.",
55
"author": {
66
"name": "",

0 commit comments

Comments
 (0)