Cleaned up entry() code.

This commit is contained in:
Alexis Lahouze 2013-01-13 12:27:42 +01:00
parent 36efe79dd1
commit f19b6488b0

View File

@ -1,14 +1,14 @@
// Entry object // Entry object
function entry(data){ function entry(){
this.id=ko.observable(ko.utils.unwrapObservable(data.id)); this.id=ko.observable();
this.value_date=ko.observable(ko.utils.unwrapObservable(data.value_date)); this.value_date=ko.observable();
this.operation_date=ko.observable(ko.utils.unwrapObservable(data.operation_date)); this.operation_date=ko.observable();
this.label=ko.observable(ko.utils.unwrapObservable(data.label)); this.label=ko.observable();
this.value=ko.observable(ko.utils.unwrapObservable(data.value)); this.value=ko.observable();
this.account_id=ko.observable(ko.utils.unwrapObservable(data.account_id)); this.account_id=ko.observable();
this.sold=ko.observable(ko.utils.unwrapObservable(data.sold)); this.sold=ko.observable();
this.pointedsold=ko.observable(ko.utils.unwrapObservable(data.pointedsold)); this.pointedsold=ko.observable();
this.category=ko.observable(ko.utils.unwrapObservable(data.category)); this.category=ko.observable();
} }
// Util function to show a message in message placeholder. // Util function to show a message in message placeholder.
@ -212,9 +212,8 @@ var ListViewModel = function() {
}; };
self.add = function() { self.add = function() {
var newEntry = new entry({ var newEntry = new entry();
account_id: self.account().id newEntry.account_id(self.account().id);
});
self.entries.unshift(newEntry); self.entries.unshift(newEntry);