overleaf/services/web/public/coffee/ide/FeatureOnboardingController.coffee

35 lines
884 B
CoffeeScript
Raw Normal View History

2016-10-20 11:39:43 -04:00
define [
"base"
], (App) ->
2016-10-24 07:20:08 -04:00
App.controller "FeatureOnboardingController", ($scope, settings) ->
$scope.innerStep = 1
2016-10-20 11:39:43 -04:00
$scope.turnCodeCheckOn = () ->
settings.saveSettings({ syntaxValidation: true })
2016-11-01 07:36:05 -04:00
$scope.settings.syntaxValidation = true
navToInnerStep2()
2016-10-20 11:39:43 -04:00
2016-11-01 07:36:05 -04:00
$scope.turnCodeCheckOff = () ->
settings.saveSettings({ syntaxValidation: false })
2016-11-01 07:36:05 -04:00
$scope.settings.syntaxValidation = false
navToInnerStep2()
2016-10-20 11:39:43 -04:00
2016-10-24 07:20:08 -04:00
$scope.dismiss = () ->
2016-10-31 16:18:08 -04:00
$scope.ui.leftMenuShown = false
$scope.ui.showCodeCheckerOnboarding = false
2016-10-24 07:20:08 -04:00
navToInnerStep2 = () ->
$scope.innerStep = 2
2016-10-20 11:39:43 -04:00
$scope.ui.leftMenuShown = true
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