56a6959b7dd63ea10eebcf1645e6fd7fcb81c817
[angular-mojolicious.git] / templates / conference / Work.html.ep
1 <script>
2 angular.service('conference', function($resource){
3  this.Work = $resource( '/data/conference/Work/' );
4 }, {$inject:['$resource'],$creation:'eager'});
5
6 function WorkForm(){
7         this.master = {
8                 type: '',
9                 title: '',
10                 abstract: '',
11                 authors:[ { name:'', surname:'', inst:'', 'email':'' } ],
12         };
13         this.cancel();
14 }
15 WorkForm.prototype = {
16         cancel: function() {
17                 this.work = angular.copy(this.master);
18         },
19         save: function(){
20                 if ( ! this.saved ) {
21                         this.saved = new this.Work( this.work );
22                         console.debug( 'new', this.saved, 'from', this.work );
23                         this.work = this.saved;
24                 }
25
26                 this.work.$save();
27                 console.debug( 'work', this.work );
28         }
29 };
30 </script>
31
32 <div ng:controller="WorkForm">
33 <pre>
34 $id={{$id}}
35 work.$id={{work.$id}}
36 work._id={{work._id}}
37 </pre>
38         <label>Vrsta rada:</label><br/>
39         <input type="radio" name="work.type" value="simp"> Simpozij <br/>
40         <input type="radio" name="work.type" value="pred"> Predavanje <br/>
41         <input type="radio" name="work.type" value="poster"> Poster <br/>
42         <input type="radio" name="work.type" value="round"> Okrugli stol <br/>
43
44
45 <div ng:repeat="author in work.authors">
46 [<a href="#" ng:click="work.authors.$remove(author)">X</a>]
47 <input name="author.name" ng:required>
48 <input name="author.surname" ng:required>
49 <input name="author.inst" >
50 <input name="author.email" ng:required>
51 </div>
52 [<a href="#" ng:click="work.authors.$add()">Add another author</a>]
53
54
55
56
57    Naslov: <input name="work.title" size="60"><br/>
58    
59    Sazetak: <br/>
60     <input type="submit" value="Save" ng:click="save()" disabled="{{$invalidWidgets}}">
61
62
63
64
65 Debug Information:
66 {{$window.location.href}}
67 <pre>work = {{work}}</pre>
68 <pre>master = {{master}}</pre>
69
70 </div>