3 function Work($resource){
8 authors:[ { name:'', surname:'', inst:'', email:'' } ],
9 symposium: { authors: [ {name:''} ] },
11 this.Work = $resource( '/data/conference/Work/:_id', { _id:'' } );
13 this.$watch('$location.hashPath', this.hash_change);
15 Work.$inject=['$resource'];
18 hash_change: function() {
19 var id = this.$location.hashPath;
20 console.debug( 'hash_change', id, this.work._id );
21 if ( id != this.work._id ) {
22 if (id) this.work = this.Work.get({ _id: id })
27 console.debug( this.Work );
29 if ( this.work && this.work.type == 'symposium' ) symposium = this.work.symposium;
30 this.work = new this.Work( this.master );
32 this.work.symposium = symposium;
33 this.work.type = 'symposium';
35 console.debug( 'reset', symposium, this.work, this.$location.hashPath );
36 this.$location.hashPath = '';
39 var l = this.$location;
40 this.work.$save(function(work){
41 l.hashPath = work._id;
51 <div ng:controller="Work" ng:init="$window.$root = this">
54 <input type="radio" name="work.type" value="symposium"> Simpozij
56 <div ng:show="work.type == 'symposium'" style="background:#f0f0f0">
58 <select name="work.symposium_id" ng:show="work.type == 'symposium'" ng:controller="Symposium">
59 <option ng:repeat="s in symposiums" value="{{s._id}}">{{s.title}}</option>
63 Tema simpozija: <input name="work.symposium.title" size="60"><br/>
66 <textarea name="work.symposium.abstract" cols="50" rows="5"></textarea> <br/>
69 <div ng:repeat="author in work.symposium.authors">
70 [<a href="" ng:click="work.symposium.authors.$remove(author)">X</a>]
71 <input name="author.name" ng:required>
72 <input name="author.surname" ng:required>
73 <input name="author.inst" >
74 <input name="author.email" ng:required>
76 [<a href="" ng:click="work.symposium.authors.$add()">Add another organizer</a>]
82 <input type="radio" name="work.type" value="lecture"> Predavanje <br/>
83 <input type="radio" name="work.type" value="poster"> Poster <br/>
84 <input type="radio" name="work.type" value="round"> Okrugli stol <br/>
90 <div ng:repeat="author in work.authors">
91 [<a href="" ng:click="work.authors.$remove(author)">X</a>]
92 <input name="author.name" ng:required>
93 <input name="author.surname" ng:required>
94 <input name="author.inst" >
95 <input name="author.email" ng:required>
97 [<a href="" ng:click="work.authors.$add()">Add another author</a>]
108 <tr ng:repeat="author in work.authors">
109 <td>[<a href="" ng:click="work.authors.$remove(author)">X</a>]</td>
110 <td><input name="author.name" ng:required></td>
111 <td><input name="author.surname" ng:required></td>
112 <td><input name="author.inst" ></td>
113 <td><input name="author.email" ng:required></td>
117 <td>[<a href="" ng:click="work.authors.$add()">Add another author</a>]</td>
129 Naslov: <input name="work.title" size="60"><br/>
132 <textarea name="work.abstract" cols="50" rows="5"></textarea> <br/>
133 <input type="submit" value="Save" ng:click="work.symposium_id=symposium._id; save();" disabled="{{$invalidWidgets}}">
134 <input type="reset" value="Novi rad" ng:click="reset()">
136 <div ng:show="work._id">
137 <a href="#{{work._id}}">permalink to {{work.title}}</a>
142 {{$window.location.href}}
143 <pre>work = {{work}}</pre>
144 <pre>master = {{master}}</pre>
148 work.$id={{work.$id}}
149 work._id={{work._id}}