3 if (typeof (console) === 'undefined') console = { debug: function() {} }; // mock console.debug
5 function Registration($resource){
8 name: '', surname: '', inst: '', email: '',
10 type: '', // just attending
14 authors:[ { name:'', surname:'', inst:'', email:'' } ],
16 symposium: { organizers: [ {name:'', surname:'', inst:'', email:'' } ], work_nr: 1, },
19 this.Registration = $resource( '/data/conference/Registration/:id', { id:'' } );
20 this.Symposium = $resource( '/data/conference/Symposium/:id', { id:'' } );
22 this.$watch('$location.hashPath', this.hash_change);
24 Registration.$inject=['$resource'];
26 Registration.prototype = {
27 hash_change: function() {
28 var id = this.$location.hashPath;
29 console.debug( 'hash_change', id, this.registration.$id );
30 if ( id != this.registration.$id ) {
33 this.registration = this.Registration.get({ id: id }, function(registration) {
34 self.last_saved = angular.copy(registration);
35 if ( registration.type == 'symposium' ) {
36 var s_id = registration.symposium.$id || registration.$id;
37 // first registration doesn't have symposium.$id, but we used same $id
38 console.debug( 'load symposium ', s_id );
39 self.symposium = self.Symposium.get({ id: s_id });
47 console.debug( this.Registration );
48 var current_symposium = null;
49 var current_person = null;
50 if ( this.registration && this.registration.type == 'symposium' ) {
51 current_symposium = this.registration.symposium;
52 current_person = this.registration.person;
53 if ( this.registration.$id ) current_symposium.work_nr++; // only if saved
54 console.debug( 'current_symposium', current_symposium, this.registration )
56 this.registration = new this.Registration( this.master );
57 if ( current_symposium ) {
58 this.registration.symposium = current_symposium;
59 this.registration.type = 'symposium';
60 this.registration.person = current_person;
63 console.debug( 'reset', current_symposium, this.registration, this.$location.hashPath );
67 this.registration.$save(function(registration){
68 self.$location.hashPath = registration.$id;
70 // save symposium to separate resource
71 if ( registration.type == 'symposium' ) {
72 if ( ! self.symposium ) {
73 self.registration.symposium.$id = registration.$id; // reuse $id of first work for symposium
74 self.symposium = new self.Symposium( registration.symposium );
75 self.symposium.works = [];
77 registration.work.$id = registration.$id; // preserve $id
78 self.symposium.works[ registration.symposium.work_nr - 1 ] = registration.work;
79 console.debug('save_symposium', self.symposium );
80 self.symposium.$save();
83 self.last_saved = angular.copy(registration);
92 <style type="text/css">
132 .authors-label .name, .authors-label .surname, .authors-label .inst, .authors-label .email {
139 .name, .surname, .email {
170 border: solid 1px #dedede;
175 input:focus, textarea:focus
181 border: 1px solid #46d0fe;
184 input.ng-validation-error {
185 border: 1px solid #D74F25;
186 border: 1px solid #FF6666;
187 border: 1px solid #FF9966;
188 border: 1px solid #EDC8BC;
208 text-decoration: none;
225 <h1>Registration and Proposal Submission</h1>
227 <div ng:controller="Registration" ng:init="$window.$root = this;">
229 <div id="registration">
231 <input class="name" name="registration.person.name" ng:required>
232 <input class="name" name="registration.person.surname" ng:required>
234 <input name="registration.person.inst">
235 <input name="registration.person.email" ng:validate="email">
239 <div id="submission">
241 <h2>Type of conference submission:</h2>
243 <input type="radio" name="registration.type" value="">Just attending conference<br/>
244 <input type="radio" name="registration.type" value="symposium">Symposia<br/>
245 <input type="radio" name="registration.type" value="lecture">Oral presentation<br/>
246 <input type="radio" name="registration.type" value="poster">Poster presentation<br/>
247 <input type="radio" name="registration.type" value="round">Round table discussion<br/>
249 <div id="submit_work" ng:show="registration.type">
251 <div ng:show="registration.type == 'symposium'" style="background:#f0f0f0">
253 <label>Topic of symposium: <input name="registration.symposium.title" size="60" ng:required></label><br/>
255 <label>Summary: <br/>
256 <textarea name="registration.symposium.abstract" cols="50" rows="5"></textarea>
261 <div ng:repeat="organizer in registration.symposium.organizers">
262 [<a href="" ng:click="registration.symposium.organizers.$remove(author)">X</a>]
263 <input name="organizer.name" ng:required>
264 <input name="organizer.surname" ng:required>
265 <input name="organizer.inst" >
266 <input name="organizer.email" ng:required>
268 [<a href="" ng:click="registration.symposium.organizers.$add()">Add another organizer</a>]
273 <div ng:show="symposium">
274 Works which are part of this symposium:
276 <li ng:repeat="w in symposium.works">
277 <a ng:show="registration.$id != w.$id" href="#{{w.$id}}" >{{w.title}}</a>
278 <b ng:show="registration.$id == w.$id">{{w.title}}</b>
284 <h2>Autors<span ng:show="registration.type == 'symposium'"> of {{registration.symposium.work_nr}}. work </span></h2>
286 <div ng:repeat="author in registration.work.authors">
287 [<a href="" ng:click="registration.work.authors.$remove(author)">X</a>]
288 <input name="author.name" ng:required>
289 <input name="author.surname" ng:required>
290 <input name="author.inst" >
291 <input name="author.email" ng:required>
293 [<a href="" ng:click="registration.work.authors.$add()">Add another author</a>]
297 <label>Title: <input name="registration.work.title" size="60" ng:required></label><br/>
300 <textarea name="registration.work.abstract" cols="50" rows="5"></textarea>
308 <span ng:show="$invalidWidgets.visible() == 0">
309 <input type="submit" value="Save" ng:click="save();" ng:show="! last_saved.$equals(registration)">
310 <input type="reset" value="Add another work" ng:click="reset()" ng:show="registration && registration.$id">
313 <b ng:show="$invalidWidgets.visible() > 0" style="color:#800">{{$invalidWidgets.visible()}} errors to fix in submission form</b>
317 <div ng:show="registration.$id">
318 Permalink to <a href="#{{registration.$id}}">DRZB2011 registration</a> which you can bookmark
321 </div><!-- registration.type == just attending -->
325 {{$window.location.href}}
327 registration = {{registration}}
329 dirty={{! last_saved.$equals(registration)}}
331 last_saved = {{last_saved}}
335 symposium = {{symposium}}
338 registration.$id={{registration.$id}}