Skip to content

Instantly share code, notes, and snippets.

@bnadlerjr
Created November 13, 2012 20:55
Show Gist options
  • Select an option

  • Save bnadlerjr/4068336 to your computer and use it in GitHub Desktop.

Select an option

Save bnadlerjr/4068336 to your computer and use it in GitHub Desktop.
---
title: Welcome to Middleman
---
%h1 Dashboard
%h2 Net Income
%table
%caption Net Income Over Time
%thead
%th Month Ending
%th Income
%th Expenses
%th Net Income
%tfoot
%tr
%td Totals
%tbody(data-bind="foreach: rows")
%tr
%td(data-bind="text: monthEnding")
%td(data-bind="text: income")
%td(data-bind="text: expenses")
%td(data-bind="text: netIncome")
// Overall view model for screen
function NetIncomeViewModel() {
var self = this;
self.rows = ko.observableArray([]);
$.getJSON('/api/net_income', function(data) {
self.rows(data);
});
}
ko.applyBindings(new NetIncomeViewModel());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment