mirror of https://github.com/gophish/gophish
Updated interfacing with ng-table module. Will propagate changes to campaigns soon.
Updated footer copyright year Cleaned up tables in templatespull/24/head
parent
b471a886e3
commit
d72bc4b7df
|
@ -190,7 +190,7 @@ func API_Groups_Id(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
writeJSON(w, gj)
|
writeJSON(w, gj)
|
||||||
case r.Method == "DELETE":
|
case r.Method == "DELETE":
|
||||||
err := db.DeleteGroup(id)
|
err := db.DeleteGroup(id, ctx.Get(r, "user_id").(int64))
|
||||||
if checkError(err, w, "Error creating JSON response") {
|
if checkError(err, w, "Error creating JSON response") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
2
db/db.go
2
db/db.go
|
@ -207,6 +207,6 @@ func PostGroup(g *models.Group, uid int64) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeleteGroup(id int64) error {
|
func DeleteGroup(id int64, uid int64) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,3 +105,7 @@
|
||||||
float:right;
|
float:right;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pagination {
|
||||||
|
margin:0px;
|
||||||
|
}
|
|
@ -24,10 +24,25 @@ app.controller('CampaignCtrl', function($scope, CampaignService) {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('GroupCtrl', function($scope, GroupService) {
|
app.controller('GroupCtrl', function($scope, GroupService, ngTableParams) {
|
||||||
GroupService.query(function(groups) {
|
|
||||||
$scope.groups = groups
|
|
||||||
})
|
$scope.tableParams = new ngTableParams({
|
||||||
|
page: 1, // show first page
|
||||||
|
count: 10, // count per page
|
||||||
|
sorting: {
|
||||||
|
name: 'asc' // initial sorting
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
total: 0, // length of data
|
||||||
|
getData: function($defer, params) {
|
||||||
|
GroupService.query(function(groups) {
|
||||||
|
$scope.groups = groups
|
||||||
|
params.total(groups.length)
|
||||||
|
$defer.resolve(groups.slice((params.page() - 1) * params.count(), params.page() * params.count()));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$scope.editGroup = function(group) {
|
$scope.editGroup = function(group) {
|
||||||
if (group === 'new') {
|
if (group === 'new') {
|
||||||
|
@ -61,8 +76,7 @@ app.controller('GroupCtrl', function($scope, GroupService) {
|
||||||
newGroup.$save(function() {
|
newGroup.$save(function() {
|
||||||
$scope.groups.push(newGroup);
|
$scope.groups.push(newGroup);
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
newGroup.$update()
|
newGroup.$update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<hr>
|
<hr>
|
||||||
<footer>
|
<footer>
|
||||||
<p>© Jordan (<a href="https://github.com/jordan-wright">jordan-wright</a>) 2013</p>
|
<p>© Jordan (<a href="https://github.com/jordan-wright">jordan-wright</a>) 2014</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
<!-- Placed at the end of the document so the pages load faster -->
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
|
|
@ -25,18 +25,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<table ng-table class="table table-hover table-striped table-bordered">
|
<table ng-table="tableParams" class="table table-hover table-striped table-bordered">
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="col-sm-1">Name</th>
|
|
||||||
<th class="col-sm-2">Members</th>
|
|
||||||
<th class="col-sm-1">Modified Date</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="group in groups" class="editable-row">
|
<tr ng-repeat="group in $data" class="editable-row">
|
||||||
<td>{{group.name}}</td>
|
<td data-title="'Name'" class="col-sm-1">{{group.name}}</td>
|
||||||
<td>
|
<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 ? '' : ', '}}
|
||||||
</span>
|
</span>
|
||||||
|
@ -56,14 +49,14 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>{{group.modified_date | date:'medium'}}</td>
|
<td data-title="'Modified Date'" class="col-sm-1">{{group.modified_date | date:'medium'}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- New Campaign Modal -->
|
<!-- New Campaign Modal -->
|
||||||
<div class="modal" id="newGroupModal" tabindex="-1" role="dialog" aria-labelledby="groupModalLabel" aria-hidden="true" >
|
<div class="modal" id="newGroupModal" tabindex="-1" role="dialog" aria-labelledby="groupModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
@ -81,12 +74,12 @@
|
||||||
</div>
|
</div>
|
||||||
<label class="control-label" for="users">Users:</label>
|
<label class="control-label" for="users">Users:</label>
|
||||||
<form ng:submit="addTarget()">
|
<form ng:submit="addTarget()">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="email" class="form-control" placeholder="test@example.com" id="users" ng-model="newTarget.email" />
|
<input type="email" class="form-control" placeholder="test@example.com" id="users" ng-model="newTarget.email" />
|
||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<br />
|
<br />
|
||||||
<table ng-table class="table table-hover table-striped table-condensed">
|
<table ng-table class="table table-hover table-striped table-condensed">
|
||||||
|
|
Loading…
Reference in New Issue