3 if (typeof (console) === 'undefined') console = { debug: function() {} }; // mock console.debug
5 function Registration($resource){
7 name: '', surname: '', inst: '', email: '',
9 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 if ( this.registration && this.registration.type == 'symposium' ) {
50 current_symposium = this.registration.symposium;
51 if ( this.registration.$id ) current_symposium.work_nr++; // only if saved
52 console.debug( 'current_symposium', current_symposium, this.registration )
54 this.registration = new this.Registration( this.master );
55 if ( current_symposium ) {
56 this.registration.symposium = current_symposium;
57 this.registration.type = 'symposium';
60 console.debug( 'reset', current_symposium, this.registration, this.$location.hashPath );
64 this.registration.$save(function(registration){
65 self.$location.hashPath = registration.$id;
67 // save symposium to separate resource
68 if ( registration.type == 'symposium' ) {
69 if ( ! self.symposium ) {
70 self.registration.symposium.$id = registration.$id; // reuse $id of first work for symposium
71 self.symposium = new self.Symposium( registration.symposium );
72 self.symposium.works = [];
74 self.symposium.works[ work.symposium.work_nr - 1 ] = registration.work;
75 console.debug('save_symposium', self.symposium );
76 self.symposium.$save();
79 self.last_saved = angular.copy(registration);
88 <style type="text/css">
128 .authors-label .name, .authors-label .surname, .authors-label .inst, .authors-label .email {
135 .name, .surname, .email {
166 border: solid 1px #dedede;
171 input:focus, textarea:focus
177 border: 1px solid #46d0fe;
180 input.ng-validation-error {
181 border: 1px solid #D74F25;
182 border: 1px solid #FF6666;
183 border: 1px solid #FF9966;
184 border: 1px solid #EDC8BC;
204 text-decoration: none;
221 <h1>Registration and Proposal Submission</h1>
223 <div ng:controller="Registration" ng:init="$window.$root = this;">
225 <div id="registration">
227 <input class="name" name="registration.name" ng:required>
228 <input class="name" name="registration.surname" ng:required>
230 <input name="registration.inst">
231 <input name="registration.email" ng:validate="email">
235 <div id="submission">
237 <h2>Type of conference submission:</h2>
239 <input type="radio" name="registration.type" value="">Just attending conference<br/>
240 <input type="radio" name="registration.type" value="symposium">Symposia<br/>
241 <input type="radio" name="registration.type" value="lecture">Oral presentation<br/>
242 <input type="radio" name="registration.type" value="poster">Poster presentation<br/>
243 <input type="radio" name="registration.type" value="round">Round table discussion<br/>
245 <div id="submit_work" ng:show="registration.type">
247 <div ng:show="registration.type == 'symposium'" style="background:#f0f0f0">
249 <label>Topic of symposium: <input name="registration.symposium.title" size="60" ng:required></label><br/>
251 <label>Summary: <br/>
252 <textarea name="registration.symposium.abstract" cols="50" rows="5"></textarea>
257 <div ng:repeat="organizer in registration.symposium.organizers">
258 [<a href="" ng:click="registration.symposium.organizer.$remove(author)">X</a>]
259 <input name="organizer.name" ng:required>
260 <input name="organizer.surname" ng:required>
261 <input name="organizer.inst" >
262 <input name="organizer.email" ng:required>
264 [<a href="" ng:click="registration.symposium.organizer.$add()">Add another organizer</a>]
269 <div ng:show="symposium">
270 Works which are part of this symposium:
272 <li ng:repeat="w in symposium.works"><a href="#{{w.$id}}">{{w.title}}</a></li>
277 <h2>Autors<span ng:show="registration.type == 'symposium'"> of {{registration.symposium.work_nr}}. work </span></h2>
279 <div ng:repeat="author in registration.work.authors">
280 [<a href="" ng:click="registration.work.authors.$remove(author)">X</a>]
281 <input name="author.name" ng:required>
282 <input name="author.surname" ng:required>
283 <input name="author.inst" >
284 <input name="author.email" ng:required>
286 [<a href="" ng:click="registration.work.authors.$add()">Add another author</a>]
290 <label>Title: <input name="registration.work.title" size="60" ng:required></label><br/>
293 <textarea name="registration.work.abstract" cols="50" rows="5"></textarea>
301 <span ng:show="$invalidWidgets.visible() == 0">
302 <input type="submit" value="Save" ng:click="save();" ng:show="! last_saved.$equals(registration)">
303 <input type="reset" value="Add another work" ng:click="reset()" ng:show="registration && registration.$id">
306 <b ng:show="$invalidWidgets.visible() > 0" style="color:#800">{{$invalidWidgets.visible()}} errors to fix in submission form</b>
310 <div ng:show="registration.$id">
311 Permalink to <a href="#{{registration.$id}}">DRZB2011 registration</a> which you can bookmark
314 </div><!-- registration.type == just attending -->
318 {{$window.location.href}}
320 registration = {{registration}}
322 dirty={{! last_saved.$equals(registration)}}
324 last_saved = {{last_saved}}
329 registration.$id={{registration.$id}}