var id = this.$location.hashPath;
console.debug( 'hash_change', id, this.work._id );
if ( id != this.work._id ) {
- if (id) this.work = this.Work.get({ _id: id }, function(work) { work._changes = -1 })
+ if (id) {
+ var self = this;
+ this.work = this.Work.get({ _id: id }, function(work) {
+ work._changes = -1
+ if ( work.symposium._id ) {
+ self.symposium = self.Symposium.get({ _id: work.symposium._id }, function() { self.work._changes-- });
+ }
+ });
+ }
else this.reset();
}
},
this.work.type = 'symposium';
}
console.debug( 'reset', current_symposium, this.work, this.$location.hashPath );
- this.$location.hashPath = '';
},
save: function(){
var self = this;
// save symposium to separate resource
if ( work.type != 'symposium' ) return;
if ( ! self.symposium ) {
+ self.work.symposium._id = work._id; // reuse _id of first work for symposium
self.symposium = new self.Symposium( work.symposium );
self.symposium.works = [];
}