Only create Controller when showing onboarding

This commit is contained in:
James Allen 2017-02-15 09:47:37 +01:00
parent bdee15128b
commit d01d6a35cf
4 changed files with 116 additions and 118 deletions

View file

@ -225,7 +225,7 @@ module.exports = ProjectController =
if !user_id? if !user_id?
return cb() return cb()
timeout = setTimeout cb, 500 timeout = setTimeout cb, 500
AnalyticsManager.getLastOccurance user_id, "shown-track-changes-onboarding", (error, event) -> AnalyticsManager.getLastOccurance user_id, "shown-track-changes-onboarding-2", (error, event) ->
clearTimeout timeout clearTimeout timeout
if error? if error?
return cb(null, false) return cb(null, false)

View file

@ -1,7 +1,7 @@
div(ng-controller="FeatureOnboardingController")
.feat-onboard( .feat-onboard(
ng-controller="FeatureOnboardingController"
ng-class="('feat-onboard-step' + onboarding.innerStep)" ng-class="('feat-onboard-step' + onboarding.innerStep)"
ng-if="!state.loading && showCollabFeaturesOnboarding" ng-if="!state.loading && ui.showCollabFeaturesOnboarding"
ng-cloak ng-cloak
stop-propagation="click" stop-propagation="click"
) )

View file

@ -73,6 +73,10 @@ define [
} }
$scope.user = window.user $scope.user = window.user
$scope.$watch "project.features.trackChangesVisible", (visible) ->
return if !visible?
$scope.ui.showCollabFeaturesOnboarding = window.showTrackChangesOnboarding and visible
$scope.shouldABTestPlans = false $scope.shouldABTestPlans = false
if $scope.user.signUpDate >= '2016-10-27' if $scope.user.signUpDate >= '2016-10-27'
$scope.shouldABTestPlans = true $scope.shouldABTestPlans = true

View file

@ -6,15 +6,9 @@ define [
innerStep: 1 innerStep: 1
nSteps: 4 nSteps: 4
$scope.$watch "project.features.trackChangesVisible", (visible) ->
return if !visible?
$scope.showCollabFeaturesOnboarding = window.showTrackChangesOnboarding and visible
$scope.dismiss = () -> $scope.dismiss = () ->
event_tracking.sendMB "shown-track-changes-onboarding" event_tracking.sendMB "shown-track-changes-onboarding-2"
$scope.$applyAsync(() -> $scope.showCollabFeaturesOnboarding = false) $scope.$applyAsync(() -> $scope.ui.showCollabFeaturesOnboarding = false)
$(document).off "keydown", handleKeydown
$(document).off "click", $scope.dismiss
$scope.gotoPrevStep = () -> $scope.gotoPrevStep = () ->
if $scope.onboarding.innerStep > 1 if $scope.onboarding.innerStep > 1