2016-10-20 15:39:43 +00:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
2016-10-24 11:20:08 +00:00
|
|
|
App.controller "FeatureOnboardingController", ($scope, settings) ->
|
2016-10-21 14:00:52 +00:00
|
|
|
$scope.innerStep = 1
|
2016-10-20 15:39:43 +00:00
|
|
|
|
|
|
|
$scope.turnCodeCheckOn = () ->
|
2016-10-25 14:01:30 +00:00
|
|
|
settings.saveSettings({ syntaxValidation: true })
|
2016-11-01 11:36:05 +00:00
|
|
|
$scope.settings.syntaxValidation = true
|
2016-10-21 11:02:53 +00:00
|
|
|
navToInnerStep2()
|
2016-10-20 15:39:43 +00:00
|
|
|
|
2016-11-01 11:36:05 +00:00
|
|
|
$scope.turnCodeCheckOff = () ->
|
2016-10-25 14:01:30 +00:00
|
|
|
settings.saveSettings({ syntaxValidation: false })
|
2016-11-01 11:36:05 +00:00
|
|
|
$scope.settings.syntaxValidation = false
|
2016-10-21 11:02:53 +00:00
|
|
|
navToInnerStep2()
|
2016-10-20 15:39:43 +00:00
|
|
|
|
2016-10-24 11:20:08 +00:00
|
|
|
$scope.dismiss = () ->
|
2016-10-31 20:18:08 +00:00
|
|
|
$scope.ui.leftMenuShown = false
|
|
|
|
$scope.ui.showCodeCheckerOnboarding = false
|
2016-10-24 11:20:08 +00:00
|
|
|
|
2016-10-21 11:02:53 +00:00
|
|
|
navToInnerStep2 = () ->
|
|
|
|
$scope.innerStep = 2
|
2016-10-20 15:39:43 +00:00
|
|
|
$scope.ui.leftMenuShown = true
|
2016-11-01 16:17:42 +00:00
|
|
|
|
|
|
|
handleKeypress = (e) ->
|
|
|
|
if e.keyCode == 13
|
|
|
|
if $scope.innerStep == 1
|
|
|
|
$scope.turnCodeCheckOn()
|
|
|
|
else
|
|
|
|
$scope.dismiss()
|
|
|
|
|
|
|
|
$(document).on "keypress", handleKeypress
|
|
|
|
|
|
|
|
$scope.$on "$destroy", () ->
|
|
|
|
$(document).off "keypress", handleKeypress
|