| 1052 | function($alert, $http, $location, $routeParams, $scope, $window) { |
| 1053 | |
| 1054 | function goBack(flashMessageOrOptions) { |
| 1055 | if (flashMessageOrOptions) { |
| 1056 | $alert.danger(flashMessageOrOptions); |
| 1057 | } |
| 1058 | |
| 1059 | if ($window.history.length > 1) { |
| 1060 | // If the browser has something in its history, just go back. |
| 1061 | $window.history.back(); |
| 1062 | } else { |
| 1063 | // Otherwise navigate to the framework page, which is likely the |
| 1064 | // previous page anyway. |
| 1065 | $location.path('/frameworks/' + $routeParams.framework_id).replace(); |
| 1066 | } |
| 1067 | } |
| 1068 | |
| 1069 | var reroute = function() { |
| 1070 | var agent = $scope.agents[$routeParams.agent_id]; |