Parse source when switching states from switch profile. Fix #765.

This commit is contained in:
FelisCatus 2016-10-22 22:52:04 -04:00
parent 497d5de8ce
commit 56d1e8c4d6

View File

@ -395,6 +395,11 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $rootScope,
$scope.loadRules = true
omegaTarget.state(stateEditorKey, {editSource: $scope.editSource})
$rootScope.$on '$stateChangeStart', (event, _, __, fromState) ->
if $scope.editSource and $scope.source.touched
sourceValid = parseSource()
event.preventDefault() unless sourceValid
$scope.$on 'omegaApplyOptions', (event) ->
if $scope.attached?.ruleList and not $scope.attached.sourceUrl
$scope.attachedRuleListError = undefined