work: {
title: '',
abstract: '',
- authors:[ { name:'', surname:'', inst:'', email:'' } ]
+ authors:[ { name:'', surname:'', inst:'', email:'' } ],
+ organizers: []
},
- symposium: { organizers: [ {name:'', surname:'', inst:'', email:'' } ], work_nr: 1 }
+ symposium: {
+ organizers: [],
+ work_nr: 1
+ }
};
- this.Registration = $resource( '/data/conference/Registration/:id', { id:'' } );
+ this.Registration = $resource( '/data/:database/Registration/:id', { id:'', database: database } );
this.reset();
this.$watch('$location.hashPath', this.hash_change);
this.$xhr = $xhr;
+ console.debug( 'database', database );
}
Registration.$inject=['$resource','$xhr'];
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();
},
load_symposium: function() {
var self = this;
- var s_id = self.registration.symposium.$id || self.registration.$id;
+ if ( self.registration.type != 'symposium' ) return;
+
+ var s_id = self.registration.$id;
+ if ( self.registration.symposium ) s_id = self.registration.symposium.$id;
- if ( s_id = self.symposium.$id ) {
+ if ( self.symposium && self.symposium.$id == s_id ) {
console.debug('load_symposium ', s_id, ' allready loaded');
return;
}
console.debug( self.$xhr );
self.$xhr("JSON"
- , "http://localhost:5984/conference/_design/symposium/_view/works?callback=JSON_CALLBACK;key=" + s_id
+ , "/" + database + "/_design/symposium/_view/works?callback=JSON_CALLBACK;key=" + s_id
, function(code, response){
console.log('symposium/_view/works', code, response);
angular.foreach( response.rows, function(row) {