From 56d1e8c4d69050cd448739289ec812a94b0e52fd Mon Sep 17 00:00:00 2001 From: FelisCatus Date: Sat, 22 Oct 2016 22:52:04 -0400 Subject: [PATCH] Parse source when switching states from switch profile. Fix #765. --- omega-web/src/omega/controllers/switch_profile.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/omega-web/src/omega/controllers/switch_profile.coffee b/omega-web/src/omega/controllers/switch_profile.coffee index 73da791..b2306f2 100644 --- a/omega-web/src/omega/controllers/switch_profile.coffee +++ b/omega-web/src/omega/controllers/switch_profile.coffee @@ -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