Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tour breaks when tour has tour-step-enabled="false" and tour-step-on-next="redirectTo" on it #145

Open
RusinovAnton opened this issue Aug 11, 2017 · 1 comment
Milestone

Comments

@RusinovAnton
Copy link

Hello, thanks for you work on this project, very appreciated.

I am using the exact versions of the following:

  • Browser: Google Chrome Version 60.0.3112.90 (Official Build) (64-bit)
  • AngularJS: 1.6.5
  • Angular Bootstrap: 2.5.0
  • Angular UI Tour: 0.8.2
  • Angular UI Router: 0.4.2

I have installed this library via: Bower

I have observed the following behavior:
I have around 25 steps on different pages and I need to check whether user has permission to see some steps. Now I have issue when my step with on-next redirect is disabled the tour breaks down, because redirect function wasn't run and I have no next enabled step on my page.

This is how I expected it to behave:
Maybe I could run on-next redirect function for last disabled step before enabled one?
Is there some solution to this case? Thanks.

Here is my tour config, and all related step configs:

      uiTourService.createDetachedTour('MyTour', {
            backdrop: true,
            useUiRouter: true,
            templateUrl: 'views/tour/tour_step.html',
            scrollOffset: 250,
        });
tour-step="currentTourStepId"
tour-step-order="3"
tour-step-placement="top"
tour-step-title="CurrentStepTitle"
tour-step-content="CurrentStepContent"
tour-enabled="$ctrl.checkPermissions('currentTourStepId')"
tour-step-on-next="tourRedirect('next.state', { ...nextParams }, 'nextStepId')"
tour-step="nextStepId"
tour-step-order="4"
tour-step-placement="right"
tour-step-title="NextStepTitle"
tour-step-content="NextStepContent"
tour-enabled="$ctrl.checkPermissions('nextStepId')"
tour-step-on-next="tourRedirect('nextnext.state', { ...nextnextParams }, 'nextnextStepId')"

Additional notes/code:

$scope.tourRedirect = function (state, params, nextStepId) {
    if (!$scope.currentTour) {
        return;
    }
    $state.go(state, params);
    return $scope.currentTour.waitFor(nextStepId);
};
@benmarch
Copy link
Owner

Hey @RusinovAnton, I think the only way I can make a change to help is to expose the getNextStep() function which will tell you if the next enabled step is before or after the redirect. I don't want to start adding more data to the scope because that adds complexity, but exposing more on the tour object could be useful. It would still be a private function for now though, so using it would be at your own risk of unreported breaking changes.

@benmarch benmarch added this to the 1.0.0 milestone Sep 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants