mirror of https://github.com/gophish/gophish
Working on group editing
parent
20b1c80454
commit
33f240bfe0
|
@ -25,6 +25,11 @@ function save(){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dismiss(){
|
||||||
|
$("#modal\\.flashes").empty()
|
||||||
|
$("#modal").modal('hide')
|
||||||
|
}
|
||||||
|
|
||||||
function groupAdd(name){
|
function groupAdd(name){
|
||||||
groups.append({
|
groups.append({
|
||||||
name: name
|
name: name
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
|
<button type="button" class="btn btn-default" onclick="dismiss()">Cancel</button>
|
||||||
<button type="button" class="btn btn-primary" ng-click="ok(group)" data-dismiss="modal">Save Group</button>
|
<button type="button" class="btn btn-primary" onclick="save()">Save Group</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,6 +10,7 @@ function save(){
|
||||||
.success(function(data){
|
.success(function(data){
|
||||||
successFlash("Campaign successfully launched!")
|
successFlash("Campaign successfully launched!")
|
||||||
load()
|
load()
|
||||||
|
dismiss()
|
||||||
})
|
})
|
||||||
.error(function(data){
|
.error(function(data){
|
||||||
$("#modal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-danger\">\
|
$("#modal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-danger\">\
|
||||||
|
@ -17,12 +18,47 @@ function save(){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dismiss(){
|
||||||
|
$("#modal\\.flashes").empty()
|
||||||
|
$("#modal").modal('hide')
|
||||||
|
}
|
||||||
|
|
||||||
function groupAdd(name){
|
function groupAdd(name){
|
||||||
groups.append({
|
groups.append({
|
||||||
name: name
|
name: name
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function edit(group){
|
||||||
|
if (group == "new") {
|
||||||
|
console.log("new")
|
||||||
|
group = {}
|
||||||
|
}
|
||||||
|
targets = $("#targetsTable").dataTable()
|
||||||
|
// Handle Addition
|
||||||
|
$("#targetForm").submit(function(){
|
||||||
|
targets.DataTable()
|
||||||
|
.row.add([
|
||||||
|
$("#firstName").val(),
|
||||||
|
$("#lastName").val(),
|
||||||
|
$("#email").val(),
|
||||||
|
$("#position").val(),
|
||||||
|
'<span><i class="fa fa-trash-o"></i></span>'
|
||||||
|
])
|
||||||
|
.draw()
|
||||||
|
$("#targetForm>div>input").val('')
|
||||||
|
$("#firstName").focus()
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
// Handle Deletion
|
||||||
|
$("#targetsTable").on("click", "span>i.fa-trash-o", function(){
|
||||||
|
targets.DataTable()
|
||||||
|
.row( $(this).parents('tr') )
|
||||||
|
.remove()
|
||||||
|
.draw();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function load(){
|
function load(){
|
||||||
api.groups.get()
|
api.groups.get()
|
||||||
.success(function(groups){
|
.success(function(groups){
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
</h1>
|
</h1>
|
||||||
<div id="flashes" class="row"></div>
|
<div id="flashes" class="row"></div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#campaignModal"><i class="fa fa-plus"></i> New Campaign</button>
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal"><i class="fa fa-plus"></i> New Campaign</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="emptyMessage" class="row">
|
<div id="emptyMessage" class="row">
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Modal -->
|
<!-- Modal -->
|
||||||
<div class="modal fade" id="campaignModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
</h1>
|
</h1>
|
||||||
<div id="flashes" class="row"></div>
|
<div id="flashes" class="row"></div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#groupModal"><i class="fa fa-plus"></i> New Group</button>
|
<button type="button" class="btn btn-primary" onclick="edit('new')" data-toggle="modal" data-target="#modal"><i class="fa fa-plus"></i> New Group</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="emptyMessage" class="row">
|
<div id="emptyMessage" class="row">
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
</div> -->
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
<!-- Modal -->
|
<!-- Modal -->
|
||||||
<div class="modal fade" id="groupModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
@ -94,29 +94,46 @@
|
||||||
<input type="file" ng-file-select="onFileSelect($files)">
|
<input type="file" ng-file-select="onFileSelect($files)">
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<label class="control-label" for="users">Users:</label>
|
<div class="row">
|
||||||
<form ng:submit="addTarget()">
|
<form id="targetForm">
|
||||||
<div class="input-group">
|
<div class="col-sm-2">
|
||||||
<input type="email" class="form-control" placeholder="test@example.com" id="users" ng-model="newTarget.email" />
|
<input type="text" class="form-control" placeholder="First Name" id="firstName">
|
||||||
<span class="input-group-btn">
|
</div>
|
||||||
<button class="btn btn-primary"><i class="fa fa-plus"></i> Add</button>
|
<div class="col-sm-2">
|
||||||
</span>
|
<input type="text" class="form-control" placeholder="Last Name" id="lastName">
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<input type="email" class="form-control" placeholder="Email" id="email" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<input type="text" class="form-control" placeholder="Position" id="position">
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1">
|
||||||
|
<button type="submit" class="btn btn-danger btn-lg"><i class="fa fa-plus"></i> Add</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<table ng-table="editGroupTableParams" class="table table-hover table-striped table-condensed">
|
<table id="targetsTable" class="table table-hover table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>First Name</th>
|
||||||
|
<th>Last Name</th>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Position</th>
|
||||||
|
<th></th>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="target in $data" class="editable-row">
|
<!-- <tr ng-repeat="target in $data" class="editable-row">
|
||||||
<td>target.email
|
<td>target.email
|
||||||
<span ng-click="removeTarget(target)" class="remove-row"><i class="fa fa-trash-o"></i>
|
<span onclick="removeTarget()" class="remove-row"><i class="fa fa-trash-o"></i>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr> -->
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
<button type="button" class="btn btn-default" onclick="dismiss()">Close</button>
|
||||||
<button type="button" class="btn btn-primary" onclick="save()">Save changes</button>
|
<button type="button" class="btn btn-primary" onclick="save()">Save changes</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue