Updated font-awesome to 4.3.0

Added buttons for editing/viewing/deleting objects in the tables (actual functionality to follow)
pull/24/head
unknown 2015-07-06 22:26:08 -05:00
parent 8224eb8989
commit 4685b36928
15 changed files with 624 additions and 521 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 248 KiB

After

Width:  |  Height:  |  Size: 306 KiB

Binary file not shown.

Binary file not shown.

BIN
static/font/fontawesome-webfont.woff2 vendored Normal file

Binary file not shown.

View File

@ -11,7 +11,7 @@ function save(){
username: $("input[name=username]").val(), username: $("input[name=username]").val(),
password: $("input[name=password]").val(), password: $("input[name=password]").val(),
}, },
groups: [{name : "Morning catch employees"}] groups: [{name : "Test group"}]
} }
// Submit the campaign // Submit the campaign
api.campaigns.post(campaign) api.campaigns.post(campaign)
@ -28,9 +28,12 @@ function save(){
function dismiss(){ function dismiss(){
$("#modal\\.flashes").empty() $("#modal\\.flashes").empty()
$("#modal").modal('hide') $("#modal").modal('hide')
$("#groupTable").dataTable().DataTable().clear().draw()
} }
function edit(campaign){ function edit(campaign){
// Clear the bloodhound instance
bh.clear();
if (campaign == "new") { if (campaign == "new") {
api.groups.get() api.groups.get()
.success(function(groups){ .success(function(groups){
@ -39,16 +42,59 @@ function edit(campaign){
return false; return false;
} }
else { else {
bh.add(groups)
}
})
}
}
$(document).ready(function(){
api.campaigns.get()
.success(function(campaigns){
if (campaigns.length > 0){
$("#emptyMessage").hide()
$("#campaignTable").show()
campaignTable = $("#campaignTable").DataTable();
$.each(campaigns, function(i, campaign){
campaignTable.row.add([
moment(campaign.created_date).format('MMMM Do YYYY, h:mm:ss a'),
campaign.name,
campaign.status,
"<div class='pull-right'><button class='btn btn-success' onclick='alert(\"test\")'>\
<i class='fa fa-bar-chart'></i>\
</button>\
<button class='btn btn-danger' onclick='alert(\"test\")'>\
<i class='fa fa-trash-o'></i>\
</button></div>"
]).draw()
})
}
})
.error(function(){
errorFlash("Error fetching campaigns")
})
$("#groupForm").submit(function(){
groupTable.row.add([
$("#groupSelect").val(),
'<span style="cursor:pointer;"><i class="fa fa-trash-o"></i></span>'
]).draw()
$("#groupTable").on("click", "span>i.fa-trash-o", function(){
groupTable.row( $(this).parents('tr') )
.remove()
.draw();
})
return false;
})
// Create the group typeahead objects // Create the group typeahead objects
var groupTable = $("#groupTable").DataTable() groupTable = $("#groupTable").DataTable()
var suggestion_template = Hogan.compile('<div>{{name}}</div>') suggestion_template = Hogan.compile('<div>{{name}}</div>')
var bh = new Bloodhound({ bh = new Bloodhound({
datumTokenizer: function(g) { return Bloodhound.tokenizers.whitespace(g.name) }, datumTokenizer: function(g) { return Bloodhound.tokenizers.whitespace(g.name) },
queryTokenizer: Bloodhound.tokenizers.whitespace, queryTokenizer: Bloodhound.tokenizers.whitespace,
local: groups local: []
}) })
bh.initialize() bh.initialize()
$("#groups.typeahead.form-control").typeahead({ $("#groupSelect.typeahead.form-control").typeahead({
hint: true, hint: true,
highlight: true, highlight: true,
minLength: 1 minLength: 1
@ -62,39 +108,6 @@ function edit(campaign){
} }
}) })
.bind('typeahead:select', function(ev, group){ .bind('typeahead:select', function(ev, group){
groupTable.row.add([ $("#groupSelect").typeahead('val', group.name)
group.name,
'<span style="cursor:pointer;"><i class="fa fa-trash-o"></i></span>'
]).draw()
}); });
//<span ng-click="removeGroup(group)" class="remove-row"><i class="fa fa-trash-o"></i>
//</span>
}
})
}
}
function load(){
api.campaigns.get()
.success(function(campaigns){
if (campaigns.length > 0){
$("#emptyMessage").hide()
$("#campaignTable").show()
campaignTable = $("#campaignTable").DataTable();
$.each(campaigns, function(i, campaign){
campaignTable.row.add([
campaign.created_date,
campaign.name,
campaign.status
]).draw()
})
}
})
.error(function(){
errorFlash("Error fetching campaigns")
})
}
$(document).ready(function(){
load()
}) })

View File

@ -1,5 +1,8 @@
var overview_chart_options = { var overview_chart_options = {
animationEasing:"linear" animationEasing:"linear",
customTooltips: function(tooltip) {
console.log(tooltip)
}
} }
function load(){ function load(){
@ -8,20 +11,22 @@ function load(){
if (campaigns.length > 0){ if (campaigns.length > 0){
var overview_ctx = $("#overview_chart").get(0).getContext("2d"); var overview_ctx = $("#overview_chart").get(0).getContext("2d");
// Create the overview chart data // Create the overview chart data
var overview_data = {labels:[],data:[]} var overview_data = {labels:[],datasets:[{data:[]}]}
var average = 0 var average = 0
$("#emptyMessage").hide() $("#emptyMessage").hide()
$("#campaignTable").show() $("#campaignTable").show()
campaignTable = $("#campaignTable").DataTable(); campaignTable = $("#campaignTable").DataTable();
$.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')
// Add it to the table // Add it to the table
campaignTable.row.add([ campaignTable.row.add([
campaign.created_date,
campaign.name, campaign.name,
campaign_date,
campaign.status campaign.status
]).draw() ]).draw()
// Add it to the chart data // Add it to the chart data
overview_data.labels.push(camaign.created_date) overview_data.labels.push(campaign_date)
campaign.y = 0
$.each(campaign.results, function(j, result){ $.each(campaign.results, function(j, result){
if (result.status == "Success"){ if (result.status == "Success"){
campaign.y++; campaign.y++;
@ -29,10 +34,10 @@ function load(){
}) })
campaign.y = Math.floor((campaign.y / campaign.results.length) * 100) campaign.y = Math.floor((campaign.y / campaign.results.length) * 100)
average += campaign.y average += campaign.y
overview_data.data.push(campaign.y) overview_data.datasets[0].data.push({y:campaign.y, test: "test"})
}) })
average = Math.floor(average / campaigns.length); average = Math.floor(average / campaigns.length);
var overview_chart = new Chart(overview_ctx).Line(campaigns, overview_chart_options); var overview_chart = new Chart(overview_ctx).Line(overview_data, overview_chart_options);
} }
}) })
.error(function(){ .error(function(){

View File

@ -92,7 +92,13 @@ function load(){
$.each(templates, function(i, template){ $.each(templates, function(i, template){
templateTable.row.add([ templateTable.row.add([
template.name, template.name,
moment(template.modified_date).format('MMMM Do YYYY, h:mm:ss a') moment(template.modified_date).format('MMMM Do YYYY, h:mm:ss a'),
"<div class='pull-right'><button class='btn btn-success' onclick='alert(\"test\")'>\
<i class='fa fa-pencil'></i>\
</button>\
<button class='btn btn-danger' onclick='alert(\"test\")'>\
<i class='fa fa-trash-o'></i>\
</button></div>"
]).draw() ]).draw()
}) })
} }

View File

@ -107,7 +107,13 @@ function load(){
groupTable.row.add([ groupTable.row.add([
group.name, group.name,
targets, targets,
moment(group.modified_date).format('MMMM Do YYYY, h:mm:ss a') moment(group.modified_date).format('MMMM Do YYYY, h:mm:ss a'),
"<div class='pull-right'><button class='btn btn-success' onclick='alert(\"test\")'>\
<i class='fa fa-pencil'></i>\
</button>\
<button class='btn btn-danger' onclick='alert(\"test\")'>\
<i class='fa fa-trash-o'></i>\
</button></div>"
]).draw() ]).draw()
}) })
} }

View File

@ -44,6 +44,7 @@
<th>Created Date</th> <th>Created Date</th>
<th>Name</th> <th>Name</th>
<th>Status</th> <th>Status</th>
<th class="col-md-2"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -118,9 +119,9 @@
</div> </div>
</div> </div>
<label class="control-label" for="users">Groups:</label> <label class="control-label" for="users">Groups:</label>
<form> <form id="groupForm">
<div class="input-group"> <div class="input-group">
<input type="text" class="typeahead form-control" placeholder="Group Name" id="groups" /> <input type="text" class="typeahead form-control" placeholder="Group Name" id="groupSelect" />
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-primary typeahead-button"><i class="fa fa-plus"></i> Add</button> <button class="btn btn-primary typeahead-button"><i class="fa fa-plus"></i> Add</button>
</span> </span>

View File

@ -25,11 +25,9 @@
<h1 class="page-header"> <h1 class="page-header">
Dashboard Dashboard
</h1> </h1>
<div ng-show="!campaigns.length"> <div id="emptyMessage" class="row">
<div class="row">
<div class="alert alert-info"> <div class="alert alert-info">
No campaigns yet. No campaigns created yet. Let's create one!
</div>
</div> </div>
</div> </div>
<div> <div>
@ -41,11 +39,11 @@
<h2>Recent Campaigns</h2> <h2>Recent Campaigns</h2>
</div> </div>
<div class="row"> <div class="row">
<a href="#/campaigns"><button type="button" class="btn btn-primary">View All</button></a> <a href="/campaigns"><button type="button" class="btn btn-primary">View All</button></a>
</div> </div>
&nbsp;&nbsp; &nbsp;&nbsp;
<div class="row"> <div class="row">
<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="campaign in $data" class="editable-row"> <tr ng-repeat="campaign in $data" class="editable-row">
<td data-title="'Created Date'" class="col-sm-1">campaign.created_date | date:'medium'</td> <td data-title="'Created Date'" class="col-sm-1">campaign.created_date | date:'medium'</td>
@ -69,6 +67,17 @@
<td data-title="'Status'" class="col-sm-1">campaign.status</td> <td data-title="'Status'" class="col-sm-1">campaign.status</td>
</tr> </tr>
</tbody> </tbody>
</table> -->
<table id="campaignTable" class="table" style="display:none;">
<thead>
<tr>
<th>Name</th>
<th>Created Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
</tbody>
</table> </table>
</div> </div>
</div> </div>

View File

@ -43,6 +43,7 @@
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Modified Date</th> <th>Modified Date</th>
<th class="col-md-2"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -44,6 +44,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>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>