mirror of https://github.com/gophish/gophish
Fixed auto completion in campaign groups
parent
445bdd90a9
commit
79cef0341e
|
@ -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.flashes = []
|
||||||
$scope.mainTableParams = new ngTableParams({
|
$scope.mainTableParams = new ngTableParams({
|
||||||
page: 1, // show first page
|
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() {
|
$scope.addGroup = function() {
|
||||||
if ($scope.group.name != "") {
|
if ($scope.group.name != "") {
|
||||||
$scope.campaign.groups.push({
|
$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.saveCampaign = function(campaign) {
|
||||||
$scope.flashes = []
|
$scope.flashes = []
|
||||||
var newCampaign = new CampaignService(campaign);
|
var newCampaign = new CampaignService(campaign);
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
<label class="control-label" for="users">Groups:</label>
|
<label class="control-label" for="users">Groups:</label>
|
||||||
<form ng:submit="addGroup()">
|
<form ng:submit="addGroup()">
|
||||||
<div class="input-group">
|
<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">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-primary"><i class="fa fa-plus"></i> Add</button>
|
<button class="btn btn-primary"><i class="fa fa-plus"></i> Add</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<table ng-table="mainTableParams" class="table table-hover table-striped table-bordered">
|
<table ng-table="mainTableParams" class="table table-hover table-striped table-bordered">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="group in $data" class="editable-row">
|
<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">
|
<td data-title="'Members'" class="col-sm-2">
|
||||||
<span ng-repeat="target in group.targets">
|
<span ng-repeat="target in group.targets">
|
||||||
{{target.email}}{{$last ? '' : ', '}}
|
{{target.email}}{{$last ? '' : ', '}}
|
||||||
|
|
Loading…
Reference in New Issue