Replace separate autocompile ctrl with listener in PdfController

This commit is contained in:
Alasdair Smith 2017-09-04 11:41:52 +01:00
parent 53bb4fdde0
commit 9f1adfd0c0
4 changed files with 6 additions and 12 deletions

View file

@ -1,5 +1,4 @@
div.full-size.pdf(ng-controller="PdfController")
.FIXME(ng-controller="AutoCompileController")
.toolbar.toolbar-tall
.btn-group(
dropdown,

View file

@ -1,8 +1,7 @@
define [
"ide/pdf/controllers/PdfController"
"ide/pdf/controllers/PdfViewToggleController"
"ide/pdfng/directives/pdfJs",
"ide/pdf/controllers/AutoCompileController"
"ide/pdfng/directives/pdfJs"
], () ->
class PdfManager
constructor: (@ide, @$scope) ->

View file

@ -1,9 +0,0 @@
define [
"base"
], (App) ->
App.controller "AutoCompileController", ["$scope", "ide", ($scope, ide) ->
ide.$scope.$on "ide:opAcknowledged", _.debounce(() ->
if (!ide.$scope.hasLintingError)
$scope.recompile()
, 3000)
]

View file

@ -73,6 +73,11 @@ define [
$scope.pdf.view = 'errors'
$scope.pdf.renderingError = true
ide.$scope.$on "ide:opAcknowledged", _.debounce(() ->
if (!ide.$scope.hasLintingError)
$scope.recompile()
, 3000)
# abort compile if syntax checks fail
$scope.stop_on_validation_error = localStorage("stop_on_validation_error:#{$scope.project_id}")
$scope.stop_on_validation_error ?= true # turn on for all users by default