restore original table template
[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     <table>
56       <tr>
57         <th> </th>
58         <th>Ime</th>
59         <th>Prezime</th>
60         <th>Ustanova</th>
61         <th>email</th>
62       </tr>
63       <tr ng:repeat="author in work.authors">
64         <td>[<a href="#" ng:click="work.authors.$remove(author)">X</a>]</td>
65         <td><input name="author.name" ng:required></td>
66         <td><input name="author.surname" ng:required></td>
67         <td><input name="author.inst" ></td>
68         <td><input name="author.email" ng:required></td>
69       </tr>
70       <tr>
71         <td> </td>
72         <td>[<a href="" ng:click="work.authors.$add()">Add another author</a>]</td>
73         <td> </td>
74         <td> </td>
75         <td> </td>
76       </tr>
77     </table>
78
79
80 <hr>    
81
82
83    Naslov: <input name="work.title" size="60"><br/>
84    
85    Sazetak: <br/>
86     <textarea name="work.abstract" cols="50" rows="5"></textarea> <br/>
87     <input type="submit" value="Save" ng:click="save()" disabled="{{$invalidWidgets}}">
88
89
90
91
92 <hr>
93 Debug Information:
94 {{$window.location.href}}
95 <pre>work = {{work}}</pre>
96 <pre>master = {{master}}</pre>
97
98 </div>