From 5fd2e7d91ea1d799973ccd5f6b057769bc8c3f60 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 8 Nov 2010 23:12:56 +0100 Subject: [PATCH] cleanup reset code this allows us to use same code to provide reset button regardless of type of work submitted --- templates/conference/Registration.html.ep | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/templates/conference/Registration.html.ep b/templates/conference/Registration.html.ep index 6d9e66b..20d82de 100644 --- a/templates/conference/Registration.html.ep +++ b/templates/conference/Registration.html.ep @@ -45,22 +45,21 @@ console.debug( 'load symposium ', s_id ); }, reset: function() { console.debug( this.Registration ); - var current_symposium = null; - var current_person = null; - if ( this.registration && this.registration.type == 'symposium' ) { - current_symposium = this.registration.symposium; - current_person = this.registration.person; - if ( this.registration.$id ) current_symposium.work_nr++; // only if saved -console.debug( 'current_symposium', current_symposium, this.registration ) + var last = this.registration; + if ( last && last.type == 'symposium' ) { + if ( last.$id ) last.symposium.work_nr++; // only if saved } this.registration = new this.Registration( this.master ); - if ( current_symposium ) { - this.registration.symposium = current_symposium; - this.registration.type = 'symposium'; - this.registration.person = current_person; + if ( last ) { + this.registration.category = last.category; + this.registration.type = last.type; + this.registration.person = last.person; + + if ( last.type == 'symposium' ) + this.registration.symposium = last.symposium; } this.last_saved = {}; -console.debug( 'reset', current_symposium, this.registration, this.$location.hashPath ); +console.debug( 'reset', this.registration, this.$location.hashPath, last ); }, save: function(){ var self = this; @@ -404,6 +403,7 @@ input.ng-validation-error { +