fix database name in view
[angular-mojolicious.git] / templates / conference / Symposium.html.ep
1 <script>
2
3 function Symposium($resource){
4         this.master = {
5                 type: '',
6                 title: '',
7                 abstract: '',
8                 authors:[ { name:'', surname:'', inst:'', email:'' } ],
9         };
10         this.Symposium = $resource( '/data/conference/Symposium/:id', { id:'' } );
11         this.reset();
12         this.$watch('$location.hashPath', this.hash_change);
13 }
14 Symposium.$inject=['$resource'];
15
16 Symposium.prototype = {
17         hash_change: function() {
18                 var id = this.$location.hashPath;
19                 if ( id ) {
20                         this.symposium = this.Symposium.get({ id: id });
21                 }
22         },
23         reset: function() {
24                 console.debug( this.Symposium );
25                 this.symposium = new this.Symposium( this.master );
26         },
27         save: function(){
28                 var l = this.$location;
29                 this.symposium.$save(function(symposium){
30                         l.hashPath = symposium.$id;
31                 });
32         },
33         $all: function() {
34                 if ( this.all ) return this.all;
35                 this.all = this.Symposium.query();
36                 console.log('$all', this.all);
37                 return this.all;
38         },
39 };
40
41 </script>
42
43 <div ng:controller="Symposium">
44
45 <input type=checkbox name=debug>
46
47 <ul>
48 <li ng:repeat="s in $all()">
49 <a href="#{{s.$id}}">{{s.title}}</a>
50 <br><small>{{s.abstract}}</small>
51 <pre ng:show="debug">{{s}}</pre>
52 </li>
53 </ul>
54
55 <h1>Prijava simpozija</h1>
56
57 <div ng:show="symposium._id">
58 <a href="#{{symposium._id}}">permalink to {{symposium.title}}</a>
59 </div>
60
61    Naslov: <input name="symposium.title" size="60"><br/>
62    
63    Sazetak: <br/>
64     <textarea name="symposium.abstract" cols="50" rows="5"></textarea> <br/>
65
66 <div ng:repeat="author in symposium.authors">
67 [<a href="" ng:click="symposium.authors.$remove(author)">X</a>]
68 <input name="author.name" ng:required>
69 <input name="author.surname" ng:required>
70 <input name="author.inst" >
71 <input name="author.email" ng:required>
72 </div>
73 [<a href="" ng:click="symposium.authors.$add()">Add another author</a>]
74
75 <hr>    
76
77     <input type="submit" value="Save" ng:click="save();" disabled="{{$invalidWidgets}}">
78     <input type="reset" value="Reset" ng:click="reset()">
79         <a href="Symposium">Novi simpozij</a>
80
81 </div>