X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=templates%2Fconference%2FWork.html.ep;h=e1d73c831cc7125c5ce13518093d40041431cc36;hb=2393a3b201b612154ae43217b0a5ccf6dca5e530;hp=f75bd24d1fcdad4843430a7d42aac280be29e1d0;hpb=4765e1f83752921b0601a6d2e39eb99a3d86422c;p=angular-mojolicious.git diff --git a/templates/conference/Work.html.ep b/templates/conference/Work.html.ep index f75bd24..e1d73c8 100644 --- a/templates/conference/Work.html.ep +++ b/templates/conference/Work.html.ep @@ -11,8 +11,8 @@ function Work($resource){ symposium: { organizer: [ {name:'', surname:'', inst:'', email:'' } ], work_nr: 1, }, }; this.last_saved_work = {}; - this.Work = $resource( '/data/conference/Work/:_id', { _id:'' } ); - this.Symposium = $resource( '/data/conference/Symposium/:_id', { _id:'' } ); + this.Work = $resource( '/data/conference/Work/:id', { id:'' } ); + this.Symposium = $resource( '/data/conference/Symposium/:id', { id:'' } ); this.reset(); this.$watch('$location.hashPath', this.hash_change); } @@ -21,17 +21,17 @@ Work.$inject=['$resource']; Work.prototype = { hash_change: function() { var id = this.$location.hashPath; -console.debug( 'hash_change', id, this.work._id ); - if ( id != this.work._id ) { +console.debug( 'hash_change', id, this.work.$id ); + if ( id != this.work.$id ) { if (id) { var self = this; - this.work = this.Work.get({ _id: id }, function(work) { + this.work = this.Work.get({ id: id }, function(work) { self.last_saved_work = angular.copy(work); if ( work.type == 'symposium' ) { - var s_id = work.symposium._id || work._id; - // first work doesn't have symposium._id, but we used same _id + 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 }); + self.symposium = self.Symposium.get({ id: s_id }); } }); } @@ -43,7 +43,7 @@ console.debug( 'load symposium ', s_id ); var current_symposium = null; if ( this.work && this.work.type == 'symposium' ) { current_symposium = this.work.symposium; - if ( this.work._id ) current_symposium.work_nr++; // only if saved + if ( this.work.$id ) current_symposium.work_nr++; // only if saved console.debug( 'current_symposium', current_symposium, this.work ) } this.work = new this.Work( this.master ); @@ -57,19 +57,21 @@ console.debug( 'reset', current_symposium, this.work, this.$location.hashPath ); save: function(){ var self = this; this.work.$save(function(work){ - self.$location.hashPath = work._id; - self.last_saved_work = angular.copy(work); + self.$location.hashPath = work.$id; // 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 = []; + if ( work.type == 'symposium' ) { + 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 = []; + } + self.symposium.works[ work.symposium.work_nr - 1 ] = work; + console.debug('save_symposium', self.symposium ); + self.symposium.$save(); } - self.symposium.works[ work.symposium.work_nr - 1 ] = work; - console.debug('save_symposium', self.symposium ); - self.symposium.$save(); + + self.last_saved_work = angular.copy(work); }); }, get_symposium: function() { this.symposium }, @@ -86,11 +88,6 @@ console.debug( 'reset', current_symposium, this.work, this.$location.hashPath );
-
@@ -105,7 +102,7 @@ Organizer: - +
[Add another organizer] @@ -122,7 +119,10 @@ Organizer:
Works which are part of this symposium:
    -
  1. {{w.title}}
  2. +
  3. +{{w.title}} +{{w.title}} +
@@ -134,7 +134,7 @@ Works which are part of this symposium: - + [Add another author] @@ -149,14 +149,14 @@ Works which are part of this symposium:
- - + + {{$invalidWidgets.visible()}} errors to fix in submission form -
-Permalink to {{work.title}} which you can bookmark +
+Permalink to {{work.title}} which you can bookmark

@@ -173,7 +173,7 @@ master = {{master}} $id={{$id}} work.$id={{work.$id}} -work._id={{work._id}} +work.$id={{work.$id}}