Add Archived Campaigns View (#1367)

* Adding archived view for campaigns (#1334)

* Formatted the code, did some very minor cleanup, and rebuilt the minified JS

Closes #448
pull/1386/head
Jordan Wright 2019-02-19 21:30:18 -06:00 committed by GitHub
parent ba8ceb81da
commit 3cec2dabbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 22 deletions

File diff suppressed because one or more lines are too long

View File

@ -334,7 +334,18 @@ $(document).ready(function () {
$("#loading").hide() $("#loading").hide()
if (campaigns.length > 0) { if (campaigns.length > 0) {
$("#campaignTable").show() $("#campaignTable").show()
campaignTable = $("#campaignTable").DataTable({ $("#campaignTableArchive").show()
campaignTableOriginal = $("#campaignTable").DataTable({
columnDefs: [{
orderable: false,
targets: "no-sort"
}],
order: [
[1, "desc"]
]
});
campaignTableArchive = $("#campaignTableArchive").DataTable({
columnDefs: [{ columnDefs: [{
orderable: false, orderable: false,
targets: "no-sort" targets: "no-sort"
@ -344,6 +355,11 @@ $(document).ready(function () {
] ]
}); });
$.each(campaigns, function (i, campaign) { $.each(campaigns, function (i, campaign) {
campaignTable = campaignTableOriginal
if (campaign.status === "Completed") {
campaignTable = campaignTableArchive
}
label = labels[campaign.status] || "label-default"; label = labels[campaign.status] || "label-default";
//section for tooltips on the status of a campaign to show some quick stats //section for tooltips on the status of a campaign to show some quick stats

View File

@ -12,6 +12,18 @@
<i class="fa fa-plus"></i> New Campaign</button> <i class="fa fa-plus"></i> New Campaign</button>
</div> </div>
&nbsp; &nbsp;
<ul class="nav nav-tabs" role="tablist">
<li class="active" role="activeCampaigns"><a href="#activeCampaigns" aria-controls="activeCampaigns" role="tab"
data-toggle="tab">Active Campaigns</a></li>
<li role="archivedCampaigns"><a href="#archivedCampaigns" aria-controls="archivedCampaigns" role="tab"
data-toggle="tab">Archived Campaigns</a></li>
</ul>
</br>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="activeCampaigns">
<div id="flashes" class="row"></div>
&nbsp;
<div id="loading"> <div id="loading">
<i class="fa fa-spinner fa-spin fa-4x"></i> <i class="fa fa-spinner fa-spin fa-4x"></i>
</div> </div>
@ -35,6 +47,31 @@
</table> </table>
</div> </div>
</div> </div>
<div role="tabpanel" class="tab-pane" id="archivedCampaigns">
</br>
<div id="emptyMessage" class="row" style="display:none;">
</br>
<div class="alert alert-info">
No archived campaigns.
</div>
</div>
<div class="row">
<table id="campaignTableArchive" class="table" style="display:none;">
<thead>
<tr>
<th class="col-md-3">Name</th>
<th class="col-md-4">Created Date</th>
<th class="col-md-2">Status</th>
<th class="col-md-3 no-sort"></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Modal --> <!-- Modal -->
<div class="modal fade" id="modal" 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">