From 5a1f2a9f30fe83f604c991d87d228feb034d99dc Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sun, 6 Mar 2016 22:53:42 +0100 Subject: [PATCH] Ordering of accounts. --- accountant/frontend/static/js/accounts.js | 21 ------------------- .../frontend/static/views/accounts.html | 2 +- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/accountant/frontend/static/js/accounts.js b/accountant/frontend/static/js/accounts.js index 6954dce..38966e1 100644 --- a/accountant/frontend/static/js/accounts.js +++ b/accountant/frontend/static/js/accounts.js @@ -123,27 +123,6 @@ angular.module('accountant.accounts', [ account = angular.merge(account, $data); return account.$save().then(function(data) { - // Sort accounts by name. - $scope.accounts.sort(function(a, b) { - if(a.id && b.id) { - if(a.name < b.name) { - return -1; - } else if(a.name > b.name) { - return 1; - } else { - return a.id - b.id; - } - } else if (!a.id && !b.id) { - return 0; - } else if (!a.id) { - return -1; - } else if (!b.id) { - return 1; - } - - return 0; - }); - Notification.success('Account #' + data.id + ' saved.'); return data; diff --git a/accountant/frontend/static/views/accounts.html b/accountant/frontend/static/views/accounts.html index db6e2be..d5c7bc4 100644 --- a/accountant/frontend/static/views/accounts.html +++ b/accountant/frontend/static/views/accounts.html @@ -37,7 +37,7 @@ + ng-repeat="account in accounts | orderBy:'name'" ng-init="account.getSolds()">