code cleanup, added reset
[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         this.work = new this.Work( this.master );
15 }
16 WorkForm.prototype = {
17         reset: function() {
18                 this.work = angular.copy(this.master);
19                 console.info('reset');
20         },
21         save: function(){
22                 this.work.$save();
23 //              console.debug( 'work', this.work );
24         }
25 };
26 </script>
27
28 <div ng:controller="WorkForm">
29 <pre>
30 {{work.search()}}
31 $id={{$id}}
32 work.$id={{work.$id}}
33 work._id={{work._id}}
34 </pre>
35         <label>Vrsta rada:</label><br/>
36         <input type="radio" name="work.type" value="simp"> Simpozij <br/>
37         <input type="radio" name="work.type" value="pred"> Predavanje <br/>
38         <input type="radio" name="work.type" value="poster"> Poster <br/>
39         <input type="radio" name="work.type" value="round"> Okrugli stol <br/>
40
41 <!--
42 <div ng:repeat="author in work.authors">
43 [<a href="#" ng:click="work.authors.$remove(author)">X</a>]
44 <input name="author.name" ng:required>
45 <input name="author.surname" ng:required>
46 <input name="author.inst" >
47 <input name="author.email" ng:required>
48 </div>
49 [<a href="#" ng:click="work.authors.$add()">Add another author</a>]
50 -->
51
52     <table>
53       <tr>
54         <th> </th>
55         <th>Ime</th>
56         <th>Prezime</th>
57         <th>Ustanova</th>
58         <th>email</th>
59       </tr>
60       <tr ng:repeat="author in work.authors">
61         <td>[<a href="#" ng:click="work.authors.$remove(author)">X</a>]</td>
62         <td><input name="author.name" ng:required></td>
63         <td><input name="author.surname" ng:required></td>
64         <td><input name="author.inst" ></td>
65         <td><input name="author.email" ng:required></td>
66       </tr>
67       <tr>
68         <td> </td>
69         <td>[<a href="" ng:click="work.authors.$add()">Add another author</a>]</td>
70         <td> </td>
71         <td> </td>
72         <td> </td>
73       </tr>
74     </table>
75
76
77 <hr>    
78
79
80    Naslov: <input name="work.title" size="60"><br/>
81    
82    Sazetak: <br/>
83     <textarea name="work.abstract" cols="50" rows="5"></textarea> <br/>
84     <input type="submit" value="Save" ng:click="work.$save()" disabled="{{$invalidWidgets}}">
85     <input type="submit" value="Save" ng:click="save()" disabled="{{$invalidWidgets}}">
86     <input type="reset" value="Reset" ng:click="reset()">
87
88 <hr>
89 Debug Information:
90 {{$window.location.href}}
91 <pre>work = {{work}}</pre>
92 <pre>master = {{master}}</pre>
93
94 </div>