mirror of
https://github.com/gophish/gophish
synced 2024-11-14 16:27:23 +00:00
Fixed auto completion in campaign groups
This commit is contained in:
parent
445bdd90a9
commit
79cef0341e
3 changed files with 7 additions and 17 deletions
|
@ -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);
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
<label class="control-label" for="users">Groups:</label>
|
||||
<form ng:submit="addGroup()">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" placeholder="Group Name" id="users" typeahead="group.name for group in getGroups($viewValue)" typeahead-editable="false" ng-model="group.name" />
|
||||
<input type="text" class="form-control" placeholder="Group Name" id="users" typeahead="group.name for group in groups | filter:{name:$viewValue}" typeahead-editable="false" ng-model="group.name" />
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary"><i class="fa fa-plus"></i> Add</button>
|
||||
</span>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<table ng-table="mainTableParams" class="table table-hover table-striped table-bordered">
|
||||
<tbody>
|
||||
<tr ng-repeat="group in $data" class="editable-row">
|
||||
<td data-title="'Name'" class="col-sm-1">{{group.name}}</td>
|
||||
<td data-title="'Name'" sortable="'name'" class="col-sm-1">{{group.name}}</td>
|
||||
<td data-title="'Members'" class="col-sm-2">
|
||||
<span ng-repeat="target in group.targets">
|
||||
{{target.email}}{{$last ? '' : ', '}}
|
||||
|
|
Loading…
Reference in a new issue