From 22834c75a67f290e993a9fcc2a26963eca3e4064 Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Fri, 6 Jan 2017 17:58:36 -0600 Subject: [PATCH] Changed default sorting order in campaign tables to show most recent campaigns first. Fixes #426 --- static/js/app/campaigns.js | 9 ++++++--- static/js/app/dashboard.js | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/static/js/app/campaigns.js b/static/js/app/campaigns.js index 7a310a27..b921a759 100644 --- a/static/js/app/campaigns.js +++ b/static/js/app/campaigns.js @@ -241,14 +241,14 @@ function copy(idx) { }) // Set our initial values api.campaignId.get(campaigns[idx].id) - .success(function(campaign){ + .success(function(campaign) { $("#name").val("Copy of " + campaign.name) $("#template").val(campaign.template.name) $("#page").val(campaign.page.name) $("#profile").val(campaign.smtp.name) $("#url").val(campaign.url) }) - .error(function(data){ + .error(function(data) { $("#modal\\.flashes").empty().append("
\ " + data.responseJSON.message + "
") }) @@ -312,7 +312,10 @@ $(document).ready(function() { columnDefs: [{ orderable: false, targets: "no-sort" - }] + }], + order: [ + [1, "desc"] + ] }); $.each(campaigns, function(i, campaign) { label = labels[campaign.status] || "label-default"; diff --git a/static/js/app/dashboard.js b/static/js/app/dashboard.js index 4ced94cf..6bfd8acb 100644 --- a/static/js/app/dashboard.js +++ b/static/js/app/dashboard.js @@ -56,7 +56,10 @@ $(document).ready(function() { columnDefs: [{ orderable: false, targets: "no-sort" - }] + }], + order: [ + [1, "desc"] + ] }); $.each(campaigns, function(i, campaign) { var campaign_date = moment(campaign.created_date).format('MMMM Do YYYY, h:mm:ss a')