diff options
Diffstat (limited to 'www/js/views/submit.js')
-rw-r--r-- | www/js/views/submit.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/www/js/views/submit.js b/www/js/views/submit.js index 8faf32b..b48461c 100644 --- a/www/js/views/submit.js +++ b/www/js/views/submit.js @@ -15,11 +15,6 @@ 'click #submit_register': 'onClickSubmit' }, - initialize: function() { - this.listenTo(this.model, 'sync', this.onReportSync ); - this.listenTo( this.model, 'error', this.onReportError ); - }, - render: function(){ if ( !this.template ) { console.log('no template to render'); @@ -40,7 +35,10 @@ if ( this.validate() ) { this.model.set('user', FMS.currentUser); - this.model.save(); + this.report = new FMS.Report( this.model.toJSON() ); + this.listenTo( this.report, 'sync', this.onReportSync ); + this.listenTo( this.report, 'error', this.onReportError ); + this.report.save(); } }, @@ -48,6 +46,8 @@ if ( FMS.currentUser ) { FMS.currentUser.save(); } + FMS.currentDraft = new FMS.Draft(); + FMS.createdReport = this.report; this.navigate( 'sent', 'left' ); }, |