Cleaned up entry() code.

This commit is contained in:
Alexis Lahouze 2013-01-13 12:27:42 +01:00
parent 36efe79dd1
commit f19b6488b0
1 changed files with 12 additions and 13 deletions

View File

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