diff --git a/static/js/app/gophish.js b/static/js/app/gophish.js index 3922afa8..c3bce55a 100644 --- a/static/js/app/gophish.js +++ b/static/js/app/gophish.js @@ -20,7 +20,7 @@ app.factory('GroupService', function($resource) { }); }); -app.controller('CampaignCtrl', function($scope, CampaignService, ngTableParams, $http) { +app.controller('CampaignCtrl', function($scope, CampaignService, GroupService, ngTableParams, $http) { $scope.flashes = [] $scope.mainTableParams = new ngTableParams({ page: 1, // show first page @@ -39,6 +39,10 @@ app.controller('CampaignCtrl', function($scope, CampaignService, ngTableParams, } }); + GroupService.query(function(groups) { + $scope.groups = groups; + }) + $scope.addGroup = function() { if ($scope.group.name != "") { $scope.campaign.groups.push({ @@ -75,20 +79,6 @@ app.controller('CampaignCtrl', function($scope, CampaignService, ngTableParams, } }); - $scope.getGroups = function(val) { - return $http.get('/api/groups/?api_key=' + API_KEY, { - params: { - q: val - } - }).then(function(res) { - var groups = []; - angular.forEach(res.data, function(item) { - groups.push(item); - }); - return groups; - }); - }; - $scope.saveCampaign = function(campaign) { $scope.flashes = [] var newCampaign = new CampaignService(campaign); diff --git a/templates/dashboard.html b/templates/dashboard.html index 9b2b1488..fee9aa70 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -70,7 +70,7 @@
- + diff --git a/templates/users.html b/templates/users.html index 89d06807..614e535b 100644 --- a/templates/users.html +++ b/templates/users.html @@ -28,7 +28,7 @@ - +
{{group.name}}{{group.name}} {{target.email}}{{$last ? '' : ', '}}