From 467c6feb8e4197382463611f38c15cf93be69836 Mon Sep 17 00:00:00 2001 From: "Peter M. Elias" Date: Sat, 12 Jul 2014 15:27:32 +0000 Subject: [PATCH 01/11] adjusted package name for NPM --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 39947a6..8990fa4 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "ngOnboarding", + "name": "ng-onboarding", "version": "0.1.7", "devDependencies": { "grunt": "~0.4.1", From 440ce8109c121dc762e4192652d0d3f72664a830 Mon Sep 17 00:00:00 2001 From: "Peter M. Elias" Date: Sat, 12 Jul 2014 15:31:56 +0000 Subject: [PATCH 02/11] updated README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 053d6f0..bb6f9ca 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,12 @@ ngOnboarding is a tooltip tutorial / onboarding framework for [Angular.js](http: This library requires Angular.js 1.2 or greater along with any recent version of jQuery. +## Installation + +```bash +npm install ng-onboarding +``` + ## Demo You can find a very simple example of ngOnboarding [here](http://adamalbrecht.github.io/ngOnboarding/). From d4cd7bbe8cc46c227761a9f4edfb676b9fe76157 Mon Sep 17 00:00:00 2001 From: "Peter M. Elias" Date: Sat, 12 Jul 2014 15:37:33 +0000 Subject: [PATCH 03/11] update repository in packagejson file --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index 8990fa4..79b78e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,10 @@ { "name": "ng-onboarding", "version": "0.1.7", + "repository": { + "type": "git", + "url": "https://github.com/adamalbrecht/ngOnboarding" + }, "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-coffee": "~0.7", From 4430981a78e2d3801b4b049f5b57f4a36040b6de Mon Sep 17 00:00:00 2001 From: Patrick Riley Date: Thu, 20 Nov 2014 19:18:05 -0500 Subject: [PATCH 04/11] Undefined Scope Index Fix *This fix will allow undefined index handling...i.e. when onboardingSteps load asynchronously and scope index is not yet available. *Example: *Say you have a factory, OnboardingFactory, that loads the steps. $scope.onboardingEnabled = false; OnboardingFactory.getOnboardingSteps().then(function(steps){ $scope.onboardingSteps = steps; $scope.onboardingEnabled = true; $scope.onboardingIndex = 0; }); *Check index watch newval is undefined instead of === null to allow for this. --- dist/ng-onboarding.js | 2 +- dist/ng-onboarding.min.js | 2 +- src/ng-onboarding.coffee | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/ng-onboarding.js b/dist/ng-onboarding.js index 52b74a4..f7fa72d 100644 --- a/dist/ng-onboarding.js +++ b/dist/ng-onboarding.js @@ -75,7 +75,7 @@ }; scope.$watch('index', function(newVal, oldVal) { var attr, k, v, _i, _len; - if (newVal === null) { + if (typeof(newVal) == 'undefined') { scope.enabled = false; setupOverlay(false); return; diff --git a/dist/ng-onboarding.min.js b/dist/ng-onboarding.min.js index 8897ba1..8d0c409 100644 --- a/dist/ng-onboarding.min.js +++ b/dist/ng-onboarding.min.js @@ -1 +1 @@ -(function(){var a;a=angular.module("ngOnboarding",[]),a.provider("ngOnboardingDefaults",function(){return{options:{overlay:!0,overlayOpacity:.6,overlayClass:"onboarding-overlay",popoverClass:"onboarding-popover",titleClass:"onboarding-popover-title",contentClass:"onboarding-popover-content",arrowClass:"onboarding-arrow",buttonContainerClass:"onboarding-button-container",buttonClass:"onboarding-button",showButtons:!0,nextButtonText:"Next →",previousButtonText:"← Previous",showDoneButton:!0,doneButtonText:"Done",closeButtonClass:"onboarding-close-button",closeButtonText:"X",stepClass:"onboarding-step-info",showStepInfo:!0},$get:function(){return this.options},set:function(a,b){var c,d,e;if("object"==typeof a){e=[];for(c in a)d=a[c],e.push(this.options[c]=d);return e}return this.options[a]=b}}}),a.directive("onboardingPopover",["ngOnboardingDefaults","$sce","$timeout",function(a,b){return{restrict:"E",scope:{enabled:"=",steps:"=",onFinishCallback:"=",index:"=stepIndex"},replace:!0,link:function(c){var d,e,f,g;return e=null,d=["title","top","right","bottom","left","width","height","position"],c.stepCount=c.steps.length,c.next=function(){return c.index=c.index+1},c.previous=function(){return c.index=c.index-1},c.close=function(){return c.enabled=!1,f(!1),c.onFinishCallback?c.onFinishCallback():void 0},c.$watch("index",function(h){var i,j,k,l,m;if(null===h)return c.enabled=!1,void f(!1);for(e=c.steps[c.index],c.lastStep=c.index+1===c.steps.length,c.showNextButton=c.index+10,l=0,m=d.length;m>l;l++)i=d[l],c[i]=null;for(j in a)k=a[j],void 0===e[j]&&(c[j]=k);for(j in e)k=e[j],c[j]=k;return c.description=b.trustAsHtml(c.description),c.nextButtonText=b.trustAsHtml(c.nextButtonText),c.previousButtonText=b.trustAsHtml(c.previousButtonText),c.doneButtonText=b.trustAsHtml(c.doneButtonText),c.closeButtonText=b.trustAsHtml(c.closeButtonText),f(),g()}),f=function(a){return null==a&&(a=!0),$(".onboarding-focus").removeClass("onboarding-focus"),a&&e.attachTo&&c.overlay?$(e.attachTo).addClass("onboarding-focus"):void 0},g=function(){var a,b,d,f,g,h,i;return a=e.attachTo,c.position=e.position,h=15,i=15,a&&(c.left||c.right||(d=null,f=null,"right"===c.position?d=$(a).offset().left+$(a).outerWidth()+h:"left"===c.position?f=$(window).width()-$(a).offset().left+h:("top"===c.position||"bottom"===c.position)&&(d=$(a).offset().left),e.xOffset&&(null!==d&&(d+=e.xOffset),null!==f&&(f-=e.xOffset)),c.left=d,c.right=f),c.top||c.bottom||(g=null,b=null,"left"===c.position||"right"===c.position?g=$(a).offset().top:"bottom"===c.position?g=$(a).offset().top+$(a).outerHeight()+i:"top"===c.position&&(b=$(window).height()-$(a).offset().top+i),e.yOffset&&(null!==g&&(g+=e.yOffset),null!==b&&(b-=e.yOffset)),c.top=g,c.bottom=b)),c.positionClass=c.position&&c.position.length?"onboarding-"+c.position:null},c.steps.length&&!c.index?c.index=0:void 0},template:"
\n
\n
\n
\n

\n \n
\n

\n
\n
\n Step {{index + 1}} of {{stepCount}}\n \n \n \n
\n
\n
"}}])}).call(this); \ No newline at end of file +(function(){var a;a=angular.module("ngOnboarding",[]),a.provider("ngOnboardingDefaults",function(){return{options:{overlay:!0,overlayOpacity:.6,overlayClass:"onboarding-overlay",popoverClass:"onboarding-popover",titleClass:"onboarding-popover-title",contentClass:"onboarding-popover-content",arrowClass:"onboarding-arrow",buttonContainerClass:"onboarding-button-container",buttonClass:"onboarding-button",showButtons:!0,nextButtonText:"Next →",previousButtonText:"← Previous",showDoneButton:!0,doneButtonText:"Done",closeButtonClass:"onboarding-close-button",closeButtonText:"X",stepClass:"onboarding-step-info",showStepInfo:!0},$get:function(){return this.options},set:function(a,b){var c,d,e;if("object"==typeof a){e=[];for(c in a)d=a[c],e.push(this.options[c]=d);return e}return this.options[a]=b}}}),a.directive("onboardingPopover",["ngOnboardingDefaults","$sce","$timeout",function(a,b){return{restrict:"E",scope:{enabled:"=",steps:"=",onFinishCallback:"=",index:"=stepIndex"},replace:!0,link:function(c){var d,e,f,g;return e=null,d=["title","top","right","bottom","left","width","height","position"],c.stepCount=c.steps.length,c.next=function(){return c.index=c.index+1},c.previous=function(){return c.index=c.index-1},c.close=function(){return c.enabled=!1,f(!1),c.onFinishCallback?c.onFinishCallback():void 0},c.$watch("index",function(h){var i,j,k,l,m;if('undefined'==typeof(h))return c.enabled=!1,void f(!1);for(e=c.steps[c.index],c.lastStep=c.index+1===c.steps.length,c.showNextButton=c.index+10,l=0,m=d.length;m>l;l++)i=d[l],c[i]=null;for(j in a)k=a[j],void 0===e[j]&&(c[j]=k);for(j in e)k=e[j],c[j]=k;return c.description=b.trustAsHtml(c.description),c.nextButtonText=b.trustAsHtml(c.nextButtonText),c.previousButtonText=b.trustAsHtml(c.previousButtonText),c.doneButtonText=b.trustAsHtml(c.doneButtonText),c.closeButtonText=b.trustAsHtml(c.closeButtonText),f(),g()}),f=function(a){return null==a&&(a=!0),$(".onboarding-focus").removeClass("onboarding-focus"),a&&e.attachTo&&c.overlay?$(e.attachTo).addClass("onboarding-focus"):void 0},g=function(){var a,b,d,f,g,h,i;return a=e.attachTo,c.position=e.position,h=15,i=15,a&&(c.left||c.right||(d=null,f=null,"right"===c.position?d=$(a).offset().left+$(a).outerWidth()+h:"left"===c.position?f=$(window).width()-$(a).offset().left+h:("top"===c.position||"bottom"===c.position)&&(d=$(a).offset().left),e.xOffset&&(null!==d&&(d+=e.xOffset),null!==f&&(f-=e.xOffset)),c.left=d,c.right=f),c.top||c.bottom||(g=null,b=null,"left"===c.position||"right"===c.position?g=$(a).offset().top:"bottom"===c.position?g=$(a).offset().top+$(a).outerHeight()+i:"top"===c.position&&(b=$(window).height()-$(a).offset().top+i),e.yOffset&&(null!==g&&(g+=e.yOffset),null!==b&&(b-=e.yOffset)),c.top=g,c.bottom=b)),c.positionClass=c.position&&c.position.length?"onboarding-"+c.position:null},c.steps.length&&!c.index?c.index=0:void 0},template:"
\n
\n
\n
\n

\n \n
\n

\n
\n
\n Step {{index + 1}} of {{stepCount}}\n \n \n \n
\n
\n
"}}])}).call(this); \ No newline at end of file diff --git a/src/ng-onboarding.coffee b/src/ng-onboarding.coffee index 10e51dd..50d25ca 100644 --- a/src/ng-onboarding.coffee +++ b/src/ng-onboarding.coffee @@ -66,7 +66,7 @@ app.directive 'onboardingPopover', ['ngOnboardingDefaults', '$sce', '$timeout', # Watch for changes in the current step index scope.$watch 'index', (newVal, oldVal) -> - if newVal == null + if typeof(newVal) == 'undefined' scope.enabled = false setupOverlay(false) return @@ -130,7 +130,7 @@ app.directive 'onboardingPopover', ['ngOnboardingDefaults', '$sce', '$timeout', top = $(attachTo).offset().top + $(attachTo).outerHeight() + yMargin else if scope.position == 'top' bottom = $(window).height() - $(attachTo).offset().top + yMargin - + if curStep['yOffset'] top = top + curStep['yOffset'] if top != null From dd1022e8c13c11516da815db1ee28d294ba4c2d5 Mon Sep 17 00:00:00 2001 From: Patrick Riley Date: Thu, 20 Nov 2014 19:39:12 -0500 Subject: [PATCH 05/11] Undefined Index Fix *Adjust step count to account for steps deferred initialization *This fix will allow undefined index handling...i.e. when onboardingSteps load asynchronously and scope index is not yet available. *Example: *Say you have a factory, OnboardingFactory, that loads the steps. $scope.onboardingEnabled = false; OnboardingFactory.getOnboardingSteps().then(function(steps){ $scope.onboardingSteps = steps; $scope.onboardingEnabled = true; $scope.onboardingIndex = 0; }); *Check index watch newval is undefined instead of === null to allow for this. --- dist/ng-onboarding.js | 4 ++-- dist/ng-onboarding.min.js | 2 +- src/ng-onboarding.coffee | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/ng-onboarding.js b/dist/ng-onboarding.js index f7fa72d..bd73165 100644 --- a/dist/ng-onboarding.js +++ b/dist/ng-onboarding.js @@ -59,7 +59,6 @@ var attributesToClear, curStep, setupOverlay, setupPositioning; curStep = null; attributesToClear = ['title', 'top', 'right', 'bottom', 'left', 'width', 'height', 'position']; - scope.stepCount = scope.steps.length; scope.next = function() { return scope.index = scope.index + 1; }; @@ -75,7 +74,7 @@ }; scope.$watch('index', function(newVal, oldVal) { var attr, k, v, _i, _len; - if (typeof(newVal) == 'undefined') { + if (typeof newVal === 'undefined') { scope.enabled = false; setupOverlay(false); return; @@ -84,6 +83,7 @@ scope.lastStep = scope.index + 1 === scope.steps.length; scope.showNextButton = scope.index + 1 < scope.steps.length; scope.showPreviousButton = scope.index > 0; + scope.stepCount = scope.steps.length; for (_i = 0, _len = attributesToClear.length; _i < _len; _i++) { attr = attributesToClear[_i]; scope[attr] = null; diff --git a/dist/ng-onboarding.min.js b/dist/ng-onboarding.min.js index 8d0c409..14fae74 100644 --- a/dist/ng-onboarding.min.js +++ b/dist/ng-onboarding.min.js @@ -1 +1 @@ -(function(){var a;a=angular.module("ngOnboarding",[]),a.provider("ngOnboardingDefaults",function(){return{options:{overlay:!0,overlayOpacity:.6,overlayClass:"onboarding-overlay",popoverClass:"onboarding-popover",titleClass:"onboarding-popover-title",contentClass:"onboarding-popover-content",arrowClass:"onboarding-arrow",buttonContainerClass:"onboarding-button-container",buttonClass:"onboarding-button",showButtons:!0,nextButtonText:"Next →",previousButtonText:"← Previous",showDoneButton:!0,doneButtonText:"Done",closeButtonClass:"onboarding-close-button",closeButtonText:"X",stepClass:"onboarding-step-info",showStepInfo:!0},$get:function(){return this.options},set:function(a,b){var c,d,e;if("object"==typeof a){e=[];for(c in a)d=a[c],e.push(this.options[c]=d);return e}return this.options[a]=b}}}),a.directive("onboardingPopover",["ngOnboardingDefaults","$sce","$timeout",function(a,b){return{restrict:"E",scope:{enabled:"=",steps:"=",onFinishCallback:"=",index:"=stepIndex"},replace:!0,link:function(c){var d,e,f,g;return e=null,d=["title","top","right","bottom","left","width","height","position"],c.stepCount=c.steps.length,c.next=function(){return c.index=c.index+1},c.previous=function(){return c.index=c.index-1},c.close=function(){return c.enabled=!1,f(!1),c.onFinishCallback?c.onFinishCallback():void 0},c.$watch("index",function(h){var i,j,k,l,m;if('undefined'==typeof(h))return c.enabled=!1,void f(!1);for(e=c.steps[c.index],c.lastStep=c.index+1===c.steps.length,c.showNextButton=c.index+10,l=0,m=d.length;m>l;l++)i=d[l],c[i]=null;for(j in a)k=a[j],void 0===e[j]&&(c[j]=k);for(j in e)k=e[j],c[j]=k;return c.description=b.trustAsHtml(c.description),c.nextButtonText=b.trustAsHtml(c.nextButtonText),c.previousButtonText=b.trustAsHtml(c.previousButtonText),c.doneButtonText=b.trustAsHtml(c.doneButtonText),c.closeButtonText=b.trustAsHtml(c.closeButtonText),f(),g()}),f=function(a){return null==a&&(a=!0),$(".onboarding-focus").removeClass("onboarding-focus"),a&&e.attachTo&&c.overlay?$(e.attachTo).addClass("onboarding-focus"):void 0},g=function(){var a,b,d,f,g,h,i;return a=e.attachTo,c.position=e.position,h=15,i=15,a&&(c.left||c.right||(d=null,f=null,"right"===c.position?d=$(a).offset().left+$(a).outerWidth()+h:"left"===c.position?f=$(window).width()-$(a).offset().left+h:("top"===c.position||"bottom"===c.position)&&(d=$(a).offset().left),e.xOffset&&(null!==d&&(d+=e.xOffset),null!==f&&(f-=e.xOffset)),c.left=d,c.right=f),c.top||c.bottom||(g=null,b=null,"left"===c.position||"right"===c.position?g=$(a).offset().top:"bottom"===c.position?g=$(a).offset().top+$(a).outerHeight()+i:"top"===c.position&&(b=$(window).height()-$(a).offset().top+i),e.yOffset&&(null!==g&&(g+=e.yOffset),null!==b&&(b-=e.yOffset)),c.top=g,c.bottom=b)),c.positionClass=c.position&&c.position.length?"onboarding-"+c.position:null},c.steps.length&&!c.index?c.index=0:void 0},template:"
\n
\n
\n
\n

\n \n
\n

\n
\n
\n Step {{index + 1}} of {{stepCount}}\n \n \n \n
\n
\n
"}}])}).call(this); \ No newline at end of file +(function(){var a;a=angular.module("ngOnboarding",[]),a.provider("ngOnboardingDefaults",function(){return{options:{overlay:!0,overlayOpacity:.6,overlayClass:"onboarding-overlay",popoverClass:"onboarding-popover",titleClass:"onboarding-popover-title",contentClass:"onboarding-popover-content",arrowClass:"onboarding-arrow",buttonContainerClass:"onboarding-button-container",buttonClass:"onboarding-button",showButtons:!0,nextButtonText:"Next →",previousButtonText:"← Previous",showDoneButton:!0,doneButtonText:"Done",closeButtonClass:"onboarding-close-button",closeButtonText:"X",stepClass:"onboarding-step-info",showStepInfo:!0},$get:function(){return this.options},set:function(a,b){var c,d,e;if("object"==typeof a){e=[];for(c in a)d=a[c],e.push(this.options[c]=d);return e}return this.options[a]=b}}}),a.directive("onboardingPopover",["ngOnboardingDefaults","$sce","$timeout",function(a,b){return{restrict:"E",scope:{enabled:"=",steps:"=",onFinishCallback:"=",index:"=stepIndex"},replace:!0,link:function(c){var d,e,f,g;return e=null,d=["title","top","right","bottom","left","width","height","position"],c.next=function(){return c.index=c.index+1},c.previous=function(){return c.index=c.index-1},c.close=function(){return c.enabled=!1,f(!1),c.onFinishCallback?c.onFinishCallback():void 0},c.$watch("index",function(h){var i,j,k,l,m;if("undefined"==typeof h)return c.enabled=!1,void f(!1);for(e=c.steps[c.index],c.lastStep=c.index+1===c.steps.length,c.showNextButton=c.index+10,c.stepCount=c.steps.length,l=0,m=d.length;m>l;l++)i=d[l],c[i]=null;for(j in a)k=a[j],void 0===e[j]&&(c[j]=k);for(j in e)k=e[j],c[j]=k;return c.description=b.trustAsHtml(c.description),c.nextButtonText=b.trustAsHtml(c.nextButtonText),c.previousButtonText=b.trustAsHtml(c.previousButtonText),c.doneButtonText=b.trustAsHtml(c.doneButtonText),c.closeButtonText=b.trustAsHtml(c.closeButtonText),f(),g()}),f=function(a){return null==a&&(a=!0),$(".onboarding-focus").removeClass("onboarding-focus"),a&&e.attachTo&&c.overlay?$(e.attachTo).addClass("onboarding-focus"):void 0},g=function(){var a,b,d,f,g,h,i;return a=e.attachTo,c.position=e.position,h=15,i=15,a&&(c.left||c.right||(d=null,f=null,"right"===c.position?d=$(a).offset().left+$(a).outerWidth()+h:"left"===c.position?f=$(window).width()-$(a).offset().left+h:("top"===c.position||"bottom"===c.position)&&(d=$(a).offset().left),e.xOffset&&(null!==d&&(d+=e.xOffset),null!==f&&(f-=e.xOffset)),c.left=d,c.right=f),c.top||c.bottom||(g=null,b=null,"left"===c.position||"right"===c.position?g=$(a).offset().top:"bottom"===c.position?g=$(a).offset().top+$(a).outerHeight()+i:"top"===c.position&&(b=$(window).height()-$(a).offset().top+i),e.yOffset&&(null!==g&&(g+=e.yOffset),null!==b&&(b-=e.yOffset)),c.top=g,c.bottom=b)),c.positionClass=c.position&&c.position.length?"onboarding-"+c.position:null},c.steps.length&&!c.index?c.index=0:void 0},template:"
\n
\n
\n
\n

\n \n
\n

\n
\n
\n Step {{index + 1}} of {{stepCount}}\n \n \n \n
\n
\n
"}}])}).call(this); \ No newline at end of file diff --git a/src/ng-onboarding.coffee b/src/ng-onboarding.coffee index 50d25ca..59558c8 100644 --- a/src/ng-onboarding.coffee +++ b/src/ng-onboarding.coffee @@ -53,7 +53,6 @@ app.directive 'onboardingPopover', ['ngOnboardingDefaults', '$sce', '$timeout', # Important Variables curStep = null attributesToClear = ['title', 'top', 'right', 'bottom', 'left', 'width', 'height', 'position'] - scope.stepCount = scope.steps.length # Button Actions scope.next = -> scope.index = scope.index + 1 @@ -75,6 +74,7 @@ app.directive 'onboardingPopover', ['ngOnboardingDefaults', '$sce', '$timeout', scope.lastStep = (scope.index + 1 == scope.steps.length) scope.showNextButton = (scope.index + 1 < scope.steps.length) scope.showPreviousButton = (scope.index > 0) + scope.stepCount = scope.steps.length for attr in attributesToClear scope[attr] = null for k, v of ngOnboardingDefaults From dd885250498b8876548e5d613d7cbdee728d1ee1 Mon Sep 17 00:00:00 2001 From: Juan Manuel Garcia Olivares Date: Fri, 17 Apr 2015 11:00:35 -0300 Subject: [PATCH 06/11] new configs --- dist/ng-onboarding.js | 6 +++++- dist/ng-onboarding.min.js | 2 +- src/ng-onboarding.coffee | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dist/ng-onboarding.js b/dist/ng-onboarding.js index bd73165..661dab3 100644 --- a/dist/ng-onboarding.js +++ b/dist/ng-onboarding.js @@ -23,6 +23,8 @@ closeButtonClass: 'onboarding-close-button', closeButtonText: 'X', stepClass: 'onboarding-step-info', + actualStepText: 'Step', + totalStepText: 'of', showStepInfo: true }, $get: function() { @@ -103,6 +105,8 @@ scope.previousButtonText = $sce.trustAsHtml(scope.previousButtonText); scope.doneButtonText = $sce.trustAsHtml(scope.doneButtonText); scope.closeButtonText = $sce.trustAsHtml(scope.closeButtonText); + scope.actualStepText = $sce.trustAsHtml(scope.actualStepText); + scope.totalStepText = $sce.trustAsHtml(scope.totalStepText); setupOverlay(); return setupPositioning(); }); @@ -177,7 +181,7 @@ return scope.index = 0; } }, - template: "
\n
\n
\n
\n

\n \n
\n

\n
\n
\n Step {{index + 1}} of {{stepCount}}\n \n \n \n
\n
\n
" + template: "
\n
\n
\n
\n

\n \n
\n

\n
\n
\n {{actualStepText}} {{index + 1}} {{totalStepText}} {{stepCount}}\n \n \n \n
\n
\n
" }; } ]); diff --git a/dist/ng-onboarding.min.js b/dist/ng-onboarding.min.js index 14fae74..4cf7a05 100644 --- a/dist/ng-onboarding.min.js +++ b/dist/ng-onboarding.min.js @@ -1 +1 @@ -(function(){var a;a=angular.module("ngOnboarding",[]),a.provider("ngOnboardingDefaults",function(){return{options:{overlay:!0,overlayOpacity:.6,overlayClass:"onboarding-overlay",popoverClass:"onboarding-popover",titleClass:"onboarding-popover-title",contentClass:"onboarding-popover-content",arrowClass:"onboarding-arrow",buttonContainerClass:"onboarding-button-container",buttonClass:"onboarding-button",showButtons:!0,nextButtonText:"Next →",previousButtonText:"← Previous",showDoneButton:!0,doneButtonText:"Done",closeButtonClass:"onboarding-close-button",closeButtonText:"X",stepClass:"onboarding-step-info",showStepInfo:!0},$get:function(){return this.options},set:function(a,b){var c,d,e;if("object"==typeof a){e=[];for(c in a)d=a[c],e.push(this.options[c]=d);return e}return this.options[a]=b}}}),a.directive("onboardingPopover",["ngOnboardingDefaults","$sce","$timeout",function(a,b){return{restrict:"E",scope:{enabled:"=",steps:"=",onFinishCallback:"=",index:"=stepIndex"},replace:!0,link:function(c){var d,e,f,g;return e=null,d=["title","top","right","bottom","left","width","height","position"],c.next=function(){return c.index=c.index+1},c.previous=function(){return c.index=c.index-1},c.close=function(){return c.enabled=!1,f(!1),c.onFinishCallback?c.onFinishCallback():void 0},c.$watch("index",function(h){var i,j,k,l,m;if("undefined"==typeof h)return c.enabled=!1,void f(!1);for(e=c.steps[c.index],c.lastStep=c.index+1===c.steps.length,c.showNextButton=c.index+10,c.stepCount=c.steps.length,l=0,m=d.length;m>l;l++)i=d[l],c[i]=null;for(j in a)k=a[j],void 0===e[j]&&(c[j]=k);for(j in e)k=e[j],c[j]=k;return c.description=b.trustAsHtml(c.description),c.nextButtonText=b.trustAsHtml(c.nextButtonText),c.previousButtonText=b.trustAsHtml(c.previousButtonText),c.doneButtonText=b.trustAsHtml(c.doneButtonText),c.closeButtonText=b.trustAsHtml(c.closeButtonText),f(),g()}),f=function(a){return null==a&&(a=!0),$(".onboarding-focus").removeClass("onboarding-focus"),a&&e.attachTo&&c.overlay?$(e.attachTo).addClass("onboarding-focus"):void 0},g=function(){var a,b,d,f,g,h,i;return a=e.attachTo,c.position=e.position,h=15,i=15,a&&(c.left||c.right||(d=null,f=null,"right"===c.position?d=$(a).offset().left+$(a).outerWidth()+h:"left"===c.position?f=$(window).width()-$(a).offset().left+h:("top"===c.position||"bottom"===c.position)&&(d=$(a).offset().left),e.xOffset&&(null!==d&&(d+=e.xOffset),null!==f&&(f-=e.xOffset)),c.left=d,c.right=f),c.top||c.bottom||(g=null,b=null,"left"===c.position||"right"===c.position?g=$(a).offset().top:"bottom"===c.position?g=$(a).offset().top+$(a).outerHeight()+i:"top"===c.position&&(b=$(window).height()-$(a).offset().top+i),e.yOffset&&(null!==g&&(g+=e.yOffset),null!==b&&(b-=e.yOffset)),c.top=g,c.bottom=b)),c.positionClass=c.position&&c.position.length?"onboarding-"+c.position:null},c.steps.length&&!c.index?c.index=0:void 0},template:"
\n
\n
\n
\n

\n \n
\n

\n
\n
\n Step {{index + 1}} of {{stepCount}}\n \n \n \n
\n
\n
"}}])}).call(this); \ No newline at end of file +(function(){var a;a=angular.module("ngOnboarding",[]),a.provider("ngOnboardingDefaults",function(){return{options:{overlay:!0,overlayOpacity:.6,overlayClass:"onboarding-overlay",popoverClass:"onboarding-popover",titleClass:"onboarding-popover-title",contentClass:"onboarding-popover-content",arrowClass:"onboarding-arrow",buttonContainerClass:"onboarding-button-container",buttonClass:"onboarding-button",showButtons:!0,nextButtonText:"Next →",previousButtonText:"← Previous",showDoneButton:!0,doneButtonText:"Done",closeButtonClass:"onboarding-close-button",closeButtonText:"X",stepClass:"onboarding-step-info",actualStepText:"Step",totalStepText:"of",showStepInfo:!0},$get:function(){return this.options},set:function(a,b){var c,d,e;if("object"==typeof a){e=[];for(c in a)d=a[c],e.push(this.options[c]=d);return e}return this.options[a]=b}}}),a.directive("onboardingPopover",["ngOnboardingDefaults","$sce","$timeout",function(a,b,c){return{restrict:"E",scope:{enabled:"=",steps:"=",onFinishCallback:"=",index:"=stepIndex"},replace:!0,link:function(c,d,e){var f,g,h,i;return g=null,f=["title","top","right","bottom","left","width","height","position"],c.next=function(){return c.index=c.index+1},c.previous=function(){return c.index=c.index-1},c.close=function(){return c.enabled=!1,h(!1),c.onFinishCallback?c.onFinishCallback():void 0},c.$watch("index",function(d,e){var j,k,l,m,n;if("undefined"==typeof d)return c.enabled=!1,void h(!1);for(g=c.steps[c.index],c.lastStep=c.index+1===c.steps.length,c.showNextButton=c.index+10,c.stepCount=c.steps.length,m=0,n=f.length;n>m;m++)j=f[m],c[j]=null;for(k in a)l=a[k],void 0===g[k]&&(c[k]=l);for(k in g)l=g[k],c[k]=l;return c.description=b.trustAsHtml(c.description),c.nextButtonText=b.trustAsHtml(c.nextButtonText),c.previousButtonText=b.trustAsHtml(c.previousButtonText),c.doneButtonText=b.trustAsHtml(c.doneButtonText),c.closeButtonText=b.trustAsHtml(c.closeButtonText),c.actualStepText=b.trustAsHtml(c.actualStepText),c.totalStepText=b.trustAsHtml(c.totalStepText),h(),i()}),h=function(a){return null==a&&(a=!0),$(".onboarding-focus").removeClass("onboarding-focus"),a&&g.attachTo&&c.overlay?$(g.attachTo).addClass("onboarding-focus"):void 0},i=function(){var a,b,d,e,f,h,i;return a=g.attachTo,c.position=g.position,h=15,i=15,a&&(c.left||c.right||(d=null,e=null,"right"===c.position?d=$(a).offset().left+$(a).outerWidth()+h:"left"===c.position?e=$(window).width()-$(a).offset().left+h:("top"===c.position||"bottom"===c.position)&&(d=$(a).offset().left),g.xOffset&&(null!==d&&(d+=g.xOffset),null!==e&&(e-=g.xOffset)),c.left=d,c.right=e),c.top||c.bottom||(f=null,b=null,"left"===c.position||"right"===c.position?f=$(a).offset().top:"bottom"===c.position?f=$(a).offset().top+$(a).outerHeight()+i:"top"===c.position&&(b=$(window).height()-$(a).offset().top+i),g.yOffset&&(null!==f&&(f+=g.yOffset),null!==b&&(b-=g.yOffset)),c.top=f,c.bottom=b)),c.position&&c.position.length?c.positionClass="onboarding-"+c.position:c.positionClass=null},c.steps.length&&!c.index?c.index=0:void 0},template:"
\n
\n
\n
\n

\n \n
\n

\n
\n
\n {{actualStepText}} {{index + 1}} {{totalStepText}} {{stepCount}}\n \n \n \n
\n
\n
"}}])}).call(this); \ No newline at end of file diff --git a/src/ng-onboarding.coffee b/src/ng-onboarding.coffee index 59558c8..88b58bd 100644 --- a/src/ng-onboarding.coffee +++ b/src/ng-onboarding.coffee @@ -29,6 +29,8 @@ app.provider "ngOnboardingDefaults", -> closeButtonClass: 'onboarding-close-button', closeButtonText: 'X', stepClass: 'onboarding-step-info', + actualStepText: 'Step', + totalStepText: 'of', showStepInfo: true } $get: -> @@ -89,6 +91,8 @@ app.directive 'onboardingPopover', ['ngOnboardingDefaults', '$sce', '$timeout', scope.previousButtonText = $sce.trustAsHtml(scope.previousButtonText) scope.doneButtonText = $sce.trustAsHtml(scope.doneButtonText) scope.closeButtonText = $sce.trustAsHtml(scope.closeButtonText) + scope.actualStepText = $sce.trustAsHtml(scope.actualStepText) + scope.totalStepText = $sce.trustAsHtml(scope.totalStepText) setupOverlay() setupPositioning() @@ -157,7 +161,7 @@ app.directive 'onboardingPopover', ['ngOnboardingDefaults', '$sce', '$timeout',

- Step {{index + 1}} of {{stepCount}} + {{actualStepText}} {{index + 1}} {{totalStepText}} {{stepCount}} From ca622c908e7e81c19584aefabdcf66a7f49d1725 Mon Sep 17 00:00:00 2001 From: Juan Manuel Garcia Olivares Date: Fri, 17 Apr 2015 11:00:44 -0300 Subject: [PATCH 07/11] fix version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 79b78e2..77a9445 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ng-onboarding", - "version": "0.1.7", + "version": "0.1.8", "repository": { "type": "git", "url": "https://github.com/adamalbrecht/ngOnboarding" From 271c292762b6d20891534b08112d5648d850e708 Mon Sep 17 00:00:00 2001 From: Juan Manuel Garcia Olivares Date: Fri, 17 Apr 2015 11:01:01 -0300 Subject: [PATCH 08/11] changing texts only in step one --- index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 0e747f7..14ce384 100644 --- a/index.html +++ b/index.html @@ -99,7 +99,9 @@

Content Zone 4

overlay: true, title: 'Welcome!', description: "This is a box with the position set to 'centered'.", - position: 'centered' + position: 'centered', + actualStepText: 'Paso', + totalStepText: 'de' }, { attachTo: '#content_1', From 01151a12d96a5447a09be57d3705ef495203c3fb Mon Sep 17 00:00:00 2001 From: Juan Manuel Garcia Olivares Date: Fri, 17 Apr 2015 11:01:11 -0300 Subject: [PATCH 09/11] adding configs to readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index bb6f9ca..8444e49 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ There are a number of options that can be passed to each step in your on-boardin | yOffset | null | Offset the vertical position of the popover relative to the attached element. | + ## Overriding Directive Defaults You can also pre-configure some options during your app's configuration phase. @@ -97,6 +98,8 @@ app.config(function(ngOnboardingDefaultsProvider) { | showDoneButton | true | Show a 'Done' button on the last popover | | showStepInfo | true | Shows 'Step X of Y' text on each popover | | closeButtonText | X | Text/HTML used for the close button | +| actualStepText | 'Step' | Text previous the actual step | +| totalStepText | 'of' | Text between actual step and total steps | The CSS classes used in the HTML are also configurable. Please see the source for more info. From 58f4ac40f94a774fea68f23990f98dcd52b66772 Mon Sep 17 00:00:00 2001 From: gavwu Date: Tue, 8 Dec 2015 03:33:28 -0600 Subject: [PATCH 10/11] Remove duplicate api description Height from readme.md file --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 8444e49..528dac6 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,6 @@ There are a number of options that can be passed to each step in your on-boardin | width | null | Width of the popover. Defaults to the width of the content. | | height | null | Height of the popover. Defaults to the height of the content. | | top, right, bottom, left | null | Set the positioning of the popover explicitly. -| height | null | Height of the popover. Defaults to the height of the content. | | xOffset | null | Offset the horizontal position of the popover relative to the attached element. | | yOffset | null | Offset the vertical position of the popover relative to the attached element. | From 1df14890b13f3e1404bdce9244d7f67cf1470d94 Mon Sep 17 00:00:00 2001 From: kogre Date: Thu, 14 Apr 2016 19:53:07 +0200 Subject: [PATCH 11/11] Only set onboarding-focus when onboarding is enabled Built js Make update cycle also run on 'enabled' change --- dist/ng-onboarding.js | 6 +++--- dist/ng-onboarding.min.js | 2 +- src/ng-onboarding.coffee | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/ng-onboarding.js b/dist/ng-onboarding.js index 661dab3..dd458fe 100644 --- a/dist/ng-onboarding.js +++ b/dist/ng-onboarding.js @@ -74,9 +74,9 @@ return scope.onFinishCallback(); } }; - scope.$watch('index', function(newVal, oldVal) { + scope.$watchGroup(['index', 'enabled'], function(newVals, oldVal) { var attr, k, v, _i, _len; - if (typeof newVal === 'undefined') { + if (typeof newVals[0] === 'undefined') { scope.enabled = false; setupOverlay(false); return; @@ -116,7 +116,7 @@ } $('.onboarding-focus').removeClass('onboarding-focus'); if (showOverlay) { - if (curStep['attachTo'] && scope.overlay) { + if (curStep['attachTo'] && scope.overlay && scope.enabled) { return $(curStep['attachTo']).addClass('onboarding-focus'); } } diff --git a/dist/ng-onboarding.min.js b/dist/ng-onboarding.min.js index 4cf7a05..5c026eb 100644 --- a/dist/ng-onboarding.min.js +++ b/dist/ng-onboarding.min.js @@ -1 +1 @@ -(function(){var a;a=angular.module("ngOnboarding",[]),a.provider("ngOnboardingDefaults",function(){return{options:{overlay:!0,overlayOpacity:.6,overlayClass:"onboarding-overlay",popoverClass:"onboarding-popover",titleClass:"onboarding-popover-title",contentClass:"onboarding-popover-content",arrowClass:"onboarding-arrow",buttonContainerClass:"onboarding-button-container",buttonClass:"onboarding-button",showButtons:!0,nextButtonText:"Next →",previousButtonText:"← Previous",showDoneButton:!0,doneButtonText:"Done",closeButtonClass:"onboarding-close-button",closeButtonText:"X",stepClass:"onboarding-step-info",actualStepText:"Step",totalStepText:"of",showStepInfo:!0},$get:function(){return this.options},set:function(a,b){var c,d,e;if("object"==typeof a){e=[];for(c in a)d=a[c],e.push(this.options[c]=d);return e}return this.options[a]=b}}}),a.directive("onboardingPopover",["ngOnboardingDefaults","$sce","$timeout",function(a,b,c){return{restrict:"E",scope:{enabled:"=",steps:"=",onFinishCallback:"=",index:"=stepIndex"},replace:!0,link:function(c,d,e){var f,g,h,i;return g=null,f=["title","top","right","bottom","left","width","height","position"],c.next=function(){return c.index=c.index+1},c.previous=function(){return c.index=c.index-1},c.close=function(){return c.enabled=!1,h(!1),c.onFinishCallback?c.onFinishCallback():void 0},c.$watch("index",function(d,e){var j,k,l,m,n;if("undefined"==typeof d)return c.enabled=!1,void h(!1);for(g=c.steps[c.index],c.lastStep=c.index+1===c.steps.length,c.showNextButton=c.index+10,c.stepCount=c.steps.length,m=0,n=f.length;n>m;m++)j=f[m],c[j]=null;for(k in a)l=a[k],void 0===g[k]&&(c[k]=l);for(k in g)l=g[k],c[k]=l;return c.description=b.trustAsHtml(c.description),c.nextButtonText=b.trustAsHtml(c.nextButtonText),c.previousButtonText=b.trustAsHtml(c.previousButtonText),c.doneButtonText=b.trustAsHtml(c.doneButtonText),c.closeButtonText=b.trustAsHtml(c.closeButtonText),c.actualStepText=b.trustAsHtml(c.actualStepText),c.totalStepText=b.trustAsHtml(c.totalStepText),h(),i()}),h=function(a){return null==a&&(a=!0),$(".onboarding-focus").removeClass("onboarding-focus"),a&&g.attachTo&&c.overlay?$(g.attachTo).addClass("onboarding-focus"):void 0},i=function(){var a,b,d,e,f,h,i;return a=g.attachTo,c.position=g.position,h=15,i=15,a&&(c.left||c.right||(d=null,e=null,"right"===c.position?d=$(a).offset().left+$(a).outerWidth()+h:"left"===c.position?e=$(window).width()-$(a).offset().left+h:("top"===c.position||"bottom"===c.position)&&(d=$(a).offset().left),g.xOffset&&(null!==d&&(d+=g.xOffset),null!==e&&(e-=g.xOffset)),c.left=d,c.right=e),c.top||c.bottom||(f=null,b=null,"left"===c.position||"right"===c.position?f=$(a).offset().top:"bottom"===c.position?f=$(a).offset().top+$(a).outerHeight()+i:"top"===c.position&&(b=$(window).height()-$(a).offset().top+i),g.yOffset&&(null!==f&&(f+=g.yOffset),null!==b&&(b-=g.yOffset)),c.top=f,c.bottom=b)),c.position&&c.position.length?c.positionClass="onboarding-"+c.position:c.positionClass=null},c.steps.length&&!c.index?c.index=0:void 0},template:"
\n
\n
\n
\n

\n \n
\n

\n
\n
\n {{actualStepText}} {{index + 1}} {{totalStepText}} {{stepCount}}\n \n \n \n
\n
\n
"}}])}).call(this); \ No newline at end of file +(function(){var a;a=angular.module("ngOnboarding",[]),a.provider("ngOnboardingDefaults",function(){return{options:{overlay:!0,overlayOpacity:.6,overlayClass:"onboarding-overlay",popoverClass:"onboarding-popover",titleClass:"onboarding-popover-title",contentClass:"onboarding-popover-content",arrowClass:"onboarding-arrow",buttonContainerClass:"onboarding-button-container",buttonClass:"onboarding-button",showButtons:!0,nextButtonText:"Next →",previousButtonText:"← Previous",showDoneButton:!0,doneButtonText:"Done",closeButtonClass:"onboarding-close-button",closeButtonText:"X",stepClass:"onboarding-step-info",actualStepText:"Step",totalStepText:"of",showStepInfo:!0},$get:function(){return this.options},set:function(a,b){var c,d,e;if("object"==typeof a){e=[];for(c in a)d=a[c],e.push(this.options[c]=d);return e}return this.options[a]=b}}}),a.directive("onboardingPopover",["ngOnboardingDefaults","$sce","$timeout",function(a,b,c){return{restrict:"E",scope:{enabled:"=",steps:"=",onFinishCallback:"=",index:"=stepIndex"},replace:!0,link:function(c,d,e){var f,g,h,i;return g=null,f=["title","top","right","bottom","left","width","height","position"],c.next=function(){return c.index=c.index+1},c.previous=function(){return c.index=c.index-1},c.close=function(){return c.enabled=!1,h(!1),c.onFinishCallback?c.onFinishCallback():void 0},c.$watchGroup(["index","enabled"],function(d,e){var j,k,l,m,n;if("undefined"==typeof d[0])return c.enabled=!1,void h(!1);for(g=c.steps[c.index],c.lastStep=c.index+1===c.steps.length,c.showNextButton=c.index+10,c.stepCount=c.steps.length,m=0,n=f.length;n>m;m++)j=f[m],c[j]=null;for(k in a)l=a[k],void 0===g[k]&&(c[k]=l);for(k in g)l=g[k],c[k]=l;return c.description=b.trustAsHtml(c.description),c.nextButtonText=b.trustAsHtml(c.nextButtonText),c.previousButtonText=b.trustAsHtml(c.previousButtonText),c.doneButtonText=b.trustAsHtml(c.doneButtonText),c.closeButtonText=b.trustAsHtml(c.closeButtonText),c.actualStepText=b.trustAsHtml(c.actualStepText),c.totalStepText=b.trustAsHtml(c.totalStepText),h(),i()}),h=function(a){return null==a&&(a=!0),$(".onboarding-focus").removeClass("onboarding-focus"),a&&g.attachTo&&c.overlay&&c.enabled?$(g.attachTo).addClass("onboarding-focus"):void 0},i=function(){var a,b,d,e,f,h,i;return a=g.attachTo,c.position=g.position,h=15,i=15,a&&(c.left||c.right||(d=null,e=null,"right"===c.position?d=$(a).offset().left+$(a).outerWidth()+h:"left"===c.position?e=$(window).width()-$(a).offset().left+h:("top"===c.position||"bottom"===c.position)&&(d=$(a).offset().left),g.xOffset&&(null!==d&&(d+=g.xOffset),null!==e&&(e-=g.xOffset)),c.left=d,c.right=e),c.top||c.bottom||(f=null,b=null,"left"===c.position||"right"===c.position?f=$(a).offset().top:"bottom"===c.position?f=$(a).offset().top+$(a).outerHeight()+i:"top"===c.position&&(b=$(window).height()-$(a).offset().top+i),g.yOffset&&(null!==f&&(f+=g.yOffset),null!==b&&(b-=g.yOffset)),c.top=f,c.bottom=b)),c.position&&c.position.length?c.positionClass="onboarding-"+c.position:c.positionClass=null},c.steps.length&&!c.index?c.index=0:void 0},template:"
\n
\n
\n
\n

\n \n
\n

\n
\n
\n {{actualStepText}} {{index + 1}} {{totalStepText}} {{stepCount}}\n \n \n \n
\n
\n
"}}])}).call(this); \ No newline at end of file diff --git a/src/ng-onboarding.coffee b/src/ng-onboarding.coffee index 88b58bd..c3b5877 100644 --- a/src/ng-onboarding.coffee +++ b/src/ng-onboarding.coffee @@ -66,8 +66,8 @@ app.directive 'onboardingPopover', ['ngOnboardingDefaults', '$sce', '$timeout', scope.onFinishCallback() # Watch for changes in the current step index - scope.$watch 'index', (newVal, oldVal) -> - if typeof(newVal) == 'undefined' + scope.$watchGroup ['index','enabled'], (newVals, oldVal) -> + if typeof(newVals[0]) == 'undefined' scope.enabled = false setupOverlay(false) return @@ -99,7 +99,7 @@ app.directive 'onboardingPopover', ['ngOnboardingDefaults', '$sce', '$timeout', setupOverlay = (showOverlay=true) -> $('.onboarding-focus').removeClass('onboarding-focus') if showOverlay - if curStep['attachTo'] && scope.overlay + if curStep['attachTo'] && scope.overlay && scope.enabled $(curStep['attachTo']).addClass('onboarding-focus') setupPositioning = ->