diff --git a/www/assets/dashboard.css.spt b/www/assets/dashboard.css.spt
new file mode 100644
index 0000000000..c9af77662a
--- /dev/null
+++ b/www/assets/dashboard.css.spt
@@ -0,0 +1,7 @@
+[---]
+[---] text/css via scss
+#dashboard {
+ section {
+ display: none;
+ }
+}
diff --git a/www/assets/dashboard.js b/www/assets/dashboard.js
index d009f8184e..96f500f912 100644
--- a/www/assets/dashboard.js
+++ b/www/assets/dashboard.js
@@ -1,5 +1,21 @@
Dashboard = {models: {}, views: {}, collections: {}};
+Dashboard.Router = Backbone.Router.extend({
+ routes: {'ledger': 'ledger', 'accounts': 'accounts'},
+ ledger: function() {
+ $('section').hide();
+ $('#general-ledger').show();
+ },
+ accounts: function() {
+ $('section').hide();
+ $('#chart-of-accounts').show();
+ }
+});
+
+
+// Models
+// ======
+
Dashboard.models.Account = Backbone.Model.extend({
defaults: {
number: null,
@@ -8,21 +24,54 @@ Dashboard.models.Account = Backbone.Model.extend({
}
});
+
+// Collections
+// ===========
+
Dashboard.collections.Accounts = Backbone.Collection.extend({
- url: '/dashboard/accounts/',
+ url: '/v2/accounts/',
model: Dashboard.models.Account,
parse: function(data) {
return data.accounts;
}
});
+
+// Views
+// =====
+
+Dashboard.views.Main = Backbone.View.extend({
+ el: 'body',
+ initialize: function() {
+ new Dashboard.views.GeneralLedger;
+ new Dashboard.views.ChartOfAccounts;
+
+ this.router = new Dashboard.Router;
+ Backbone.history.start({pushState: true, root: "/dashboard/"});
+ },
+ events: {
+ 'click #navigation a': 'loadSection'
+ },
+ loadSection: function(e) {
+ this.router.navigate($(e.currentTarget).attr('href'), {trigger: true});
+ e.preventDefault();
+ },
+});
+
+Dashboard.views.GeneralLedger = Backbone.View.extend({
+ el: '#general-ledger',
+ initialize: function() {
+ this.$tbody= this.$('tbody');
+ },
+});
+
Dashboard.views.ChartOfAccounts = Backbone.View.extend({
el: '#chart-of-accounts',
initialize: function() {
this.$tbody= this.$('tbody');
this.data = new Dashboard.collections.Accounts();
- this.data.fetch({reset:true});
this.listenTo(this.data, 'reset', this.addAll);
+ this.data.fetch({reset:true});
},
addOne: function (account) {
var view = new Dashboard.views.AccountRow({model: account});
@@ -46,6 +95,10 @@ Dashboard.views.AccountRow = Backbone.View.extend({
}
});
+
+// Entrypoint
+// ==========
+
Dashboard.init = function() {
- new Dashboard.views.ChartOfAccounts();
+ new Dashboard.views.Main();
};
diff --git a/www/dashboard/%index.spt b/www/dashboard/%index.spt
new file mode 100644
index 0000000000..d88759e774
--- /dev/null
+++ b/www/dashboard/%index.spt
@@ -0,0 +1,57 @@
+from aspen import Response
+[---]
+if user.ANON:
+ raise Response(401)
+if not user.ADMIN:
+ raise Response(403)
+[---] text/html
+
+
+
Dashboard
+
+
+
+
+
+
+
+
+ Dashboard
+
+
+
+ General Ledger
+
+
+ Account |
+ Debits |
+ Credits |
+
+
+
+
+
+
+ Chart of Accounts
+
+
+ Number |
+ Name |
+ Type |
+
+
+
+
+
+
+
+