(function () { "use strict"; angular.module('shared') .component('tutorialPopup', { require: { tutorial: '^^tutorial' }, bindings: { targetElementSelector: '@', nextButtonText: '@', name: '@' }, template: '' +' ' +' ' +' ' +'
' +'
' +' ' +' ' +'
' +'
' +' ', controller: 'TutorialPopup', transclude: true }) .controller('TutorialPopup', [ function TutorialPopup() { var ctrl = this; var isActive = false; ctrl.isOverlayActive = false; ctrl.targetElement; ctrl.index; ctrl.$onInit = function() { ctrl.isOverlayActive = ctrl.tutorial.isOverlayActive(); setNextButtonText(); } ctrl.show = function() { isActive = true; ctrl.popoverCtrl.open(); } ctrl.hide = function() { isActive = false; ctrl.popoverCtrl.close(); } ctrl.setTargetElement = function(element) { ctrl.targetElement = element; ctrl.popoverCtrl.addTargetElement(ctrl.targetElement); } ctrl.isActive = function() { return isActive; } ctrl.onNextButtonClick = function() { ctrl.tutorial.showNextPopup(); } ctrl.onDismissedButtonClick = function() { ctrl.tutorial.dismiss(); } ctrl.isNotLastPopup = function () { return !ctrl.tutorial.isPopupLastPopup(ctrl.index); } ctrl.popoverOnInit = function(popoverCtrl) { ctrl.popoverCtrl = popoverCtrl; ctrl.tutorial.registerPopupController(ctrl); } ctrl.setIndex = function(index) { ctrl.index = index; } function setNextButtonText() { if(!ctrl.nextButtonText) { ctrl.nextButtonText = "Next Tip"; } } } ]); })();