477df511ff6a9039d858aab4a4d03c8097901472
[angular-mojolicious.git] / templates / conference / Work.html.ep
1 <script>
2
3 if (typeof (console) === 'undefined') console = { debug: function() {} }; // mock console.debug
4
5 function Work($resource){
6         this.master = {
7                 type: '',
8                 title: '',
9                 abstract: '',
10                 authors:[ { name:'', surname:'', inst:'', email:'' } ],
11                 symposium: { authors: [ {name:''} ] },
12         };
13         this.Work = $resource( '/data/conference/Work/:_id', { _id:'' } );
14         this.reset();
15         this.$watch('$location.hashPath', this.hash_change);
16 }
17 Work.$inject=['$resource'];
18
19 Work.prototype = {
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 })
25                         else this.reset();
26                 }
27         },
28         reset: function() {
29                 console.debug( this.Work );
30                 var symposium = null;
31                 if ( this.work && this.work.type == 'symposium' ) symposium = this.work.symposium;
32                 this.work = new this.Work( this.master );
33                 if ( symposium ) {
34                         this.work.symposium = symposium;
35                         this.work.type = 'symposium';
36                 }
37 console.debug( 'reset', symposium, this.work, this.$location.hashPath );
38                 this.$location.hashPath = '';
39         },
40         save: function(){
41                 var l = this.$location;
42                 this.work.$save(function(work){
43                         l.hashPath = work._id;
44                 });
45         }
46 };
47
48
49 </script>
50
51 <h1>Prijava rada</h1>
52
53 <div ng:controller="Work" ng:init="$window.$root = this">
54
55 <h2>Vrsta rada:</h2>
56 <input type="radio" name="work.type" value="symposium"> Simpozij
57
58 <div ng:show="work.type == 'symposium'" style="background:#f0f0f0">
59 <!--
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>
62 </select>
63 -->
64
65 Tema simpozija: <input name="work.symposium.title" size="60"><br/>
66    
67 Sažetak: <br/>
68 <textarea name="work.symposium.abstract" cols="50" rows="5"></textarea> <br/>
69
70 Organizator:
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>
77 </div>
78 [<a href="" ng:click="work.symposium.authors.$add()">Add another organizer</a>]
79
80 </div>
81
82 <br/>
83
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/>
87
88 <hr>
89
90 <h2>Autori rada</h2>
91
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>
98 </div>
99 [<a href="" ng:click="work.authors.$add()">Add another author</a>]
100 <!--
101
102     <table>
103       <tr>
104         <th> </th>
105         <th>Ime</th>
106         <th>Prezime</th>
107         <th>Ustanova</th>
108         <th>email</th>
109       </tr>
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>
116       </tr>
117       <tr>
118         <td> </td>
119         <td>[<a href="" ng:click="work.authors.$add()">Add another author</a>]</td>
120         <td> </td>
121         <td> </td>
122         <td> </td>
123       </tr>
124     </table>
125
126 -->
127
128 <hr>    
129
130
131    Naslov: <input name="work.title" size="60"><br/>
132
133    Sazetak: <br/>
134     <textarea name="work.abstract" cols="50" rows="5"></textarea> <br/>
135
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">
139         </span>
140
141         <b ng:show="$invalidWidgets.visible() &gt; 0" style="color:#800">{{$invalidWidgets.visible()}} errors to fix in submission form</b>
142
143         <div ng:show="work._id">
144         <a href="#{{work._id}}">permalink to {{work.title}}</a>
145         </div>
146
147 <hr>
148 Debug Information:
149 {{$window.location.href}}
150 <pre>work = {{work}}</pre>
151 <pre>master = {{master}}</pre>
152
153 <pre>
154 $id={{$id}}
155 work.$id={{work.$id}}
156 work._id={{work._id}}
157 </pre>
158
159 </div>