From 6733599a5f448d4f354390a78cc361016066935e Mon Sep 17 00:00:00 2001 From: "Thomas R. Koll" Date: Tue, 19 Jan 2016 10:02:16 +0100 Subject: [PATCH] api-client: Move around files and prepare to show account transactions --- hledger-api/static/accounts/index.html | 1 + hledger-api/static/accounts/show.html | 1 + hledger-api/static/accounts/sidebar.html | 21 +++++++++++++++++++++ hledger-api/static/accounts/view.html | 14 -------------- hledger-api/static/hledger-client.js | 22 ++++++++++++++++++---- hledger-api/static/index.html | 5 +++-- 6 files changed, 44 insertions(+), 20 deletions(-) create mode 100644 hledger-api/static/accounts/index.html create mode 100644 hledger-api/static/accounts/show.html create mode 100644 hledger-api/static/accounts/sidebar.html delete mode 100644 hledger-api/static/accounts/view.html diff --git a/hledger-api/static/accounts/index.html b/hledger-api/static/accounts/index.html new file mode 100644 index 000000000..31800c0de --- /dev/null +++ b/hledger-api/static/accounts/index.html @@ -0,0 +1 @@ +
diff --git a/hledger-api/static/accounts/show.html b/hledger-api/static/accounts/show.html new file mode 100644 index 000000000..90046ab99 --- /dev/null +++ b/hledger-api/static/accounts/show.html @@ -0,0 +1 @@ +{{account}} diff --git a/hledger-api/static/accounts/sidebar.html b/hledger-api/static/accounts/sidebar.html new file mode 100644 index 000000000..c03daf143 --- /dev/null +++ b/hledger-api/static/accounts/sidebar.html @@ -0,0 +1,21 @@ +
+

Accounts

+
+ +
+ + diff --git a/hledger-api/static/accounts/view.html b/hledger-api/static/accounts/view.html deleted file mode 100644 index 174bbd955..000000000 --- a/hledger-api/static/accounts/view.html +++ /dev/null @@ -1,14 +0,0 @@ -
-

Accounts

- Search: -
    -
  • -
- -
diff --git a/hledger-api/static/hledger-client.js b/hledger-api/static/hledger-client.js index 1d2fe5f59..9b7898614 100644 --- a/hledger-api/static/hledger-client.js +++ b/hledger-api/static/hledger-client.js @@ -2,6 +2,7 @@ var hledger = angular.module('hledger', [ 'ui.router', 'ngResource' ]) +hledger.api_root = '/api/v1'; function listToTree(list, id_field, parent_field) { children = function(list, parent_id) { return $.grep(list, @@ -19,10 +20,23 @@ function listToTree(list, id_field, parent_field) { hledger.config(function($stateProvider, $urlRouterProvider) { //$urlRouterProvider.otherwise("/"); $stateProvider + .state('dashboard', { + url: "" + }) .state('accounts', { + abstract: true, url: "/accounts", - templateUrl: "accounts/index.html", - controller: 'AccountsController' + templateUrl: "accounts/index.html" + }) + .state('accounts.show', { + url: "/:id", + templateUrl: 'accounts/show.html', + resolve: { + Account: 'Account', + account: function(Account, $stateParams) { + return Account.get($stateParams); + } + } }) .state('help', { url: "/help", @@ -31,7 +45,7 @@ hledger.config(function($stateProvider, $urlRouterProvider) { }); hledger.factory('Journal', function($resource) { - return($resource("/journals/:id")); + return($resource(hledger.api_root + "/journals/:id")); }); hledger.controller("JournalController", function($scope, Journal) { @@ -41,7 +55,7 @@ hledger.controller("JournalController", function($scope, Journal) { }); hledger.factory('Account', function($resource) { - return($resource("/accounts/:id")); + return($resource(hledger.api_root + "/accounts/:id")); }); hledger.controller("AccountsController", function($scope, Account) { diff --git a/hledger-api/static/index.html b/hledger-api/static/index.html index dccd386c2..5a7aa51ca 100644 --- a/hledger-api/static/index.html +++ b/hledger-api/static/index.html @@ -16,12 +16,13 @@ -
+
+