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?
return cb()
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
if error?
return cb(null, false)

View file

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

View file

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

View file

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