From eb616ead196d034e4c6107055a7b34d05fcc0dc1 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 15 Nov 2010 17:55:29 +0100 Subject: [PATCH] fix load_symposium and make it more robust --- public/app/conference/registration.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/public/app/conference/registration.js b/public/app/conference/registration.js index c42c178..5a285ce 100644 --- a/public/app/conference/registration.js +++ b/public/app/conference/registration.js @@ -28,12 +28,11 @@ console.debug( 'hash_change', id, this.registration.$id ); if ( id != this.registration.$id ) { if (id) { var self = this; - this.registration = this.Registration.get({ id: id }, function(registration) { + this.Registration.get({ id: id }, function(registration) { +console.debug('registration', id, registration); self.last_saved = angular.copy(registration); - if ( registration.type == 'symposium' ) { - //self.symposium = self.Symposium.get({ id: s_id }); - self.load_symposium(); - } + self.registration = registration; // needed for load_symposium below + self.load_symposium(); }); } else this.reset(); @@ -80,9 +79,12 @@ console.debug( 'reset', this.registration, this.$location.hashPath, last ); }, load_symposium: function() { var self = this; - var s_id = self.registration.symposium.$id || self.registration.$id; + if ( self.registration.type != 'symposium' ) return; - if ( s_id = self.symposium.$id ) { + var s_id = self.registration.$id; + if ( self.registration.symposium ) s_id = self.registration.symposium.$id; + + if ( self.symposium && self.symposium.$id == s_id ) { console.debug('load_symposium ', s_id, ' allready loaded'); return; } -- 2.20.1