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

View File

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

View File

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

View File

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

View File

@ -53,7 +53,13 @@ function dismiss() {
}
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() {
save(idx)
})
@ -122,7 +128,13 @@ function load() {
groups = gs
$("#emptyMessage").hide()
$("#groupTable").show()
groupTable = $("#groupTable").DataTable();
groupTable = $("#groupTable").DataTable({
destroy: true,
columnDefs: [{
orderable: false,
targets: "no-sort"
}]
});
groupTable.clear();
$.each(groups, function(i, group) {
var targets = ""

View File

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

View File

@ -67,7 +67,7 @@
<th>Name</th>
<th>Created Date</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>
</thead>
<tbody>

View File

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

View File

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

View File

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