X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=templates%2Fconference%2FWork.html.ep;h=a0eb396db1458108931127df61e9f73509f22959;hb=28b421095dcb5d2f0e7ea38df2484d3326d448cc;hp=c17aa3c5d05c1e3fb7bec0a268a31a09dc092a2b;hpb=1fdeef215fbda0277bf8b8821b36953c20e9241e;p=angular-mojolicious.git diff --git a/templates/conference/Work.html.ep b/templates/conference/Work.html.ep index c17aa3c..a0eb396 100644 --- a/templates/conference/Work.html.ep +++ b/templates/conference/Work.html.ep @@ -23,7 +23,18 @@ Work.prototype = { 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.type == 'symposium' ) { + var s_id = work.symposium._id || work._id; + // first work doesn't have symposium._id, but we used same _id +console.debug( 'load symposium ', s_id ); + self.symposium = self.Symposium.get({ _id: s_id }, function() { self.work._changes-- }); + } + }); + } else this.reset(); } }, @@ -42,7 +53,6 @@ console.debug( 'current_symposium', current_symposium, this.work ) this.work.type = 'symposium'; } console.debug( 'reset', current_symposium, this.work, this.$location.hashPath ); - this.$location.hashPath = ''; }, save: function(){ var self = this; @@ -53,6 +63,7 @@ console.debug( 'reset', current_symposium, this.work, this.$location.hashPath ); // 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 = []; } @@ -72,7 +83,7 @@ console.debug( 'reset', current_symposium, this.work, this.$location.hashPath );

Vrsta rada:

- Simpozij +