Merge branch 'table-style' of https://github.com/StrangeUSB/gophish into StrangeUSB-table-style

# Conflicts:
#	static/js/app/campaigns.js
#	static/js/app/dashboard.js
#	static/js/app/landing_pages.js
#	static/js/app/templates.js
#	static/js/app/users.js
pull/91/head
Jordan Wright 2016-01-20 21:53:12 -06:00
commit 080b3a6c27
11 changed files with 113 additions and 30 deletions

30
static/css/main.css vendored
View File

@ -341,3 +341,33 @@
float:none !important; float:none !important;
} }
} }
/* Table Styling */
.modal-content .dataTable tbody td {
font-size: 16px;/* Smaller font on modal tables */
}
.dataTables_info{
font-size: 15px;
}
/* Sort Icons */
table.dataTable thead .sorting:after, table.dataTable thead .sorting_asc:after, table.dataTable thead .sorting_desc:after {
font-family: 'FontAwesome' !important;
position: relative !important;
display: initial !important;
top: initial!important;
right: initial!important;
left: 6px;
color: #1abc9c;
}
table.dataTable thead .sorting:after{
content: "\f0dc" !important;
color: initial;
}
table.dataTable thead .sorting_asc:after {
content: "\f0de" !important;
opacity: .8 !important;
}
table.dataTable thead .sorting_desc:after {
content: "\f0dd" !important;
opacity: .8 !important;
}

View File

@ -106,6 +106,12 @@ $(document).ready(function() {
api.campaigns.get() api.campaigns.get()
.success(function(cs) { .success(function(cs) {
campaigns = cs campaigns = cs
campaignTable = $("#campaignTable").DataTable({
columnDefs: [{
orderable: false,
targets: "no-sort"
}]
});
$("#loading").hide() $("#loading").hide()
if (campaigns.length > 0) { if (campaigns.length > 0) {
$("#campaignTable").show() $("#campaignTable").show()
@ -146,7 +152,12 @@ $(document).ready(function() {
return false; return false;
}) })
// Create the group typeahead objects // Create the group typeahead objects
groupTable = $("#groupTable").DataTable() groupTable = $("#groupTable").DataTable({
columnDefs: [{
orderable: false,
targets: "no-sort"
}]
})
group_bh = new Bloodhound({ group_bh = new Bloodhound({
datumTokenizer: function(g) { datumTokenizer: function(g) {
return Bloodhound.tokenizers.whitespace(g.name) return Bloodhound.tokenizers.whitespace(g.name)

View File

@ -50,7 +50,11 @@ $(document).ready(function() {
showLabel: false showLabel: false
} }
var average = 0 var average = 0
campaignTable = $("#campaignTable").DataTable(); campaignTable = $("#campaignTable").DataTable({
columnDefs: [
{ orderable: false, targets: "no-sort" }
]
});
$.each(campaigns, function(i, campaign) { $.each(campaigns, function(i, campaign) {
var campaign_date = moment(campaign.created_date).format('MMMM Do YYYY h:mm:ss a') var campaign_date = moment(campaign.created_date).format('MMMM Do YYYY h:mm:ss a')
var label = labels[campaign.status] || "label-default"; var label = labels[campaign.status] || "label-default";

View File

@ -95,7 +95,13 @@ function load() {
$("#loading").hide() $("#loading").hide()
if (pages.length > 0) { if (pages.length > 0) {
$("#pagesTable").show() $("#pagesTable").show()
pagesTable = $("#pagesTable").DataTable(); pagesTable = $("#pagesTable").DataTable({
destroy: true,
columnDefs: [{
orderable: false,
targets: "no-sort"
}]
});
pagesTable.clear() pagesTable.clear()
$.each(pages, function(i, page) { $.each(pages, function(i, page) {
pagesTable.row.add([ pagesTable.row.add([

View File

@ -80,7 +80,19 @@ function deleteTemplate(idx) {
} }
function attach(files) { function attach(files) {
attachmentsTable = $("#attachmentsTable").DataTable(); attachmentsTable = $("#attachmentsTable").DataTable({
destroy: true,
"order": [
[1, "asc"]
],
columnDefs: [{
orderable: false,
targets: "no-sort"
}, {
sClass: "datatable_hidden",
targets: [3, 4]
}]
});
$.each(files, function(i, file) { $.each(files, function(i, file) {
var reader = new FileReader(); var reader = new FileReader();
/* Make this a datatable */ /* Make this a datatable */
@ -111,17 +123,19 @@ function edit(idx) {
}) })
$("#html_editor").ckeditor() $("#html_editor").ckeditor()
$("#attachmentsTable").show() $("#attachmentsTable").show()
attachmentsTable = null attachmentsTable = $('#attachmentsTable').DataTable({
if ($.fn.dataTable.isDataTable('#attachmentsTable')) { destroy: true,
attachmentsTable = $('#attachmentsTable').DataTable(); "order": [
} else { [1, "asc"]
attachmentsTable = $("#attachmentsTable").DataTable({ ],
"aoColumnDefs": [{ columnDefs: [{
"targets": [3, 4], orderable: false,
"sClass": "datatable_hidden" targets: "no-sort"
}] }, {
}); sClass: "datatable_hidden",
} targets: [3, 4]
}]
});
var template = { var template = {
attachments: [] attachments: []
} }
@ -185,7 +199,13 @@ function load() {
$("#loading").hide() $("#loading").hide()
if (templates.length > 0) { if (templates.length > 0) {
$("#templateTable").show() $("#templateTable").show()
templateTable = $("#templateTable").DataTable(); templateTable = $("#templateTable").DataTable({
destroy: true,
columnDefs: [{
orderable: false,
targets: "no-sort"
}]
});
templateTable.clear() templateTable.clear()
$.each(templates, function(i, template) { $.each(templates, function(i, template) {
templateTable.row.add([ templateTable.row.add([

View File

@ -53,7 +53,13 @@ function dismiss() {
} }
function edit(idx) { function edit(idx) {
targets = $("#targetsTable").dataTable() targets = $("#targetsTable").dataTable({
destroy: true, // Destroy any other instantiated table - http://datatables.net/manual/tech-notes/3#destroy
columnDefs: [{
orderable: false,
targets: "no-sort"
}]
})
$("#modalSubmit").unbind('click').click(function() { $("#modalSubmit").unbind('click').click(function() {
save(idx) save(idx)
}) })
@ -122,7 +128,13 @@ function load() {
groups = gs groups = gs
$("#emptyMessage").hide() $("#emptyMessage").hide()
$("#groupTable").show() $("#groupTable").show()
groupTable = $("#groupTable").DataTable(); groupTable = $("#groupTable").DataTable({
destroy: true,
columnDefs: [{
orderable: false,
targets: "no-sort"
}]
});
groupTable.clear(); groupTable.clear();
$.each(groups, function(i, group) { $.each(groups, function(i, group) {
var targets = "" var targets = ""

View File

@ -47,7 +47,7 @@
<th>Name</th> <th>Name</th>
<th>Created Date</th> <th>Created Date</th>
<th>Status</th> <th>Status</th>
<th class="col-md-2"></th> <th class="col-md-2 no-sort"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -113,7 +113,7 @@
<table id="groupTable" class="table table-hover table-striped table-condensed"> <table id="groupTable" class="table table-hover table-striped table-condensed">
<thead> <thead>
<th>Group Name</th> <th>Group Name</th>
<th></th> <th class="no-sort"></th>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>

View File

@ -67,7 +67,7 @@
<th>Name</th> <th>Name</th>
<th>Created Date</th> <th>Created Date</th>
<th>Status</th> <th>Status</th>
<th class="col-md-2 col-sm-2"></th> <th class="col-md-2 col-sm-2 no-sort"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -44,7 +44,7 @@
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Last Modified Date</th> <th>Last Modified Date</th>
<th class="col-md-2"></th> <th class="col-md-2 no-sort"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -46,7 +46,7 @@
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Modified Date</th> <th>Modified Date</th>
<th class="col-md-2"></th> <th class="col-md-2 no-sort"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -102,11 +102,11 @@
<table id="attachmentsTable" class="table"> <table id="attachmentsTable" class="table">
<thead> <thead>
<tr> <tr>
<th class="col-md-1"></th> <th class="col-md-1 no-sort"></th>
<th class="col-md-10">Name</th> <th class="col-md-10">Name</th>
<th class="col-md-1"></th> <th class="col-md-1 no-sort"></th>
<th class="datatable_hidden">Content</th> <th class="datatable_hidden no-sort">Content</th>
<th class="datatable_hidden">Type</th> <th class="datatable_hidden no-sort">Type</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -47,7 +47,7 @@
<th>Name</th> <th>Name</th>
<th>Members</th> <th>Members</th>
<th>Modified Date</th> <th>Modified Date</th>
<th class="col-md-2"></th> <th class="col-md-2 no-sort"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -94,14 +94,14 @@
</form> </form>
</div> </div>
<br /> <br />
<table id="targetsTable" class="table table-hover table-striped"> <table id="targetsTable" class="table table-hover table-striped table-condensed">
<thead> <thead>
<tr> <tr>
<th>First Name</th> <th>First Name</th>
<th>Last Name</th> <th>Last Name</th>
<th>Email</th> <th>Email</th>
<th>Position</th> <th>Position</th>
<th></th> <th class="no-sort"></th>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>