From 79cef0341e5e0559a207e4f67d5ed6c3b52ae592 Mon Sep 17 00:00:00 2001 From: Jordan Date: Wed, 12 Mar 2014 21:49:10 -0500 Subject: [PATCH] Fixed auto completion in campaign groups --- static/js/app/gophish.js | 20 +++++--------------- templates/dashboard.html | 2 +- templates/users.html | 2 +- 3 files changed, 7 insertions(+), 17 deletions(-) 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 ? '' : ', '}}