3 if (typeof (console) === 'undefined') console = { debug: function() {} }; // mock console.debug
5 function Work($resource){
10 authors:[ { name:'', surname:'', inst:'', email:'' } ],
11 symposium: { authors: [ {name:'', surname:'', inst:'', email:''} ] },
13 this.Work = $resource( '/data/conference/Work/:_id', { _id:'' } );
15 this.$watch('$location.hashPath', this.hash_change);
17 Work.$inject=['$resource'];
20 hash_change: function() {
21 var id = this.$location.hashPath;
22 console.debug( 'hash_change', id, this.work._id );
23 if ( id != this.work._id ) {
24 if (id) this.work = this.Work.get({ _id: id })
29 console.debug( this.Work );
31 if ( this.work && this.work.type == 'symposium' ) symposium = this.work.symposium;
32 this.work = new this.Work( this.master );
34 this.work.symposium = symposium;
35 this.work.type = 'symposium';
37 console.debug( 'reset', symposium, this.work, this.$location.hashPath );
38 this.$location.hashPath = '';
41 var l = this.$location;
42 this.work.$save(function(work){
43 l.hashPath = work._id;
53 <div ng:controller="Work" ng:init="$window.$root = this">
56 <input type="radio" name="work.type" value="symposium"> Simpozij
58 <div ng:show="work.type == 'symposium'" style="background:#f0f0f0">
60 <select name="work.symposium_id" ng:show="work.type == 'symposium'" ng:controller="Symposium">
61 <option ng:repeat="s in symposiums" value="{{s._id}}">{{s.title}}</option>
65 Tema simpozija: <input name="work.symposium.title" size="60"><br/>
68 <textarea name="work.symposium.abstract" cols="50" rows="5"></textarea> <br/>
71 <div ng:repeat="author in work.symposium.authors">
72 [<a href="" ng:click="work.symposium.authors.$remove(author)">X</a>]
73 <input name="author.name" ng:required>
74 <input name="author.surname" ng:required>
75 <input name="author.inst" >
76 <input name="author.email" ng:required>
78 [<a href="" ng:click="work.symposium.authors.$add()">Add another organizer</a>]
84 <input type="radio" name="work.type" value="lecture"> Predavanje <br/>
85 <input type="radio" name="work.type" value="poster"> Poster <br/>
86 <input type="radio" name="work.type" value="round"> Okrugli stol <br/>
92 <div ng:repeat="author in work.authors">
93 [<a href="" ng:click="work.authors.$remove(author)">X</a>]
94 <input name="author.name" ng:required>
95 <input name="author.surname" ng:required>
96 <input name="author.inst" >
97 <input name="author.email" ng:required>
99 [<a href="" ng:click="work.authors.$add()">Add another author</a>]
110 <tr ng:repeat="author in work.authors">
111 <td>[<a href="" ng:click="work.authors.$remove(author)">X</a>]</td>
112 <td><input name="author.name" ng:required></td>
113 <td><input name="author.surname" ng:required></td>
114 <td><input name="author.inst" ></td>
115 <td><input name="author.email" ng:required></td>
119 <td>[<a href="" ng:click="work.authors.$add()">Add another author</a>]</td>
131 Naslov: <input name="work.title" size="60"><br/>
134 <textarea name="work.abstract" cols="50" rows="5"></textarea> <br/>
136 <span ng:show="$invalidWidgets.visible() == 0">
137 <input type="submit" value="Save" ng:click="work.symposium_id=symposium._id; save();">
138 <input type="reset" value="Novi rad" ng:click="reset()" ng:show="work && work._id">
141 <b ng:show="$invalidWidgets.visible() > 0" style="color:#800">{{$invalidWidgets.visible()}} errors to fix in submission form</b>
143 <div ng:show="work._id">
144 <a href="#{{work._id}}">permalink to {{work.title}}</a>
149 {{$window.location.href}}
150 <pre>work = {{work}}</pre>
151 <pre>master = {{master}}</pre>
155 work.$id={{work.$id}}
156 work._id={{work._id}}