add Symposium
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 2 Nov 2010 18:43:47 +0000 (19:43 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 2 Nov 2010 18:43:47 +0000 (19:43 +0100)
public/controller/conference/Symposium.js [new file with mode: 0644]
templates/conference/Symposium.html.ep

diff --git a/public/controller/conference/Symposium.js b/public/controller/conference/Symposium.js
new file mode 100644 (file)
index 0000000..ddb227a
--- /dev/null
@@ -0,0 +1,31 @@
+function Symposium($resource){
+       this.master = {
+               type: '',
+               title: '',
+               abstract: '',
+               authors:[ { name:'', surname:'', inst:'', email:'' } ],
+       };
+       this.Symposium = $resource( '/data/conference/Symposium/:_id', { _id:'' } );
+       this.reset();
+       this.$watch('$location.hashPath', this.hash_change);
+}
+Symposium.$inject=['$resource'];
+
+Symposium.prototype = {
+       hash_change: function() {
+               var id = this.$location.hashPath;
+               if ( id ) {
+                       this.symposium = this.Symposium.get({ _id: id });
+               }
+       },
+       reset: function() {
+               console.debug( this.Symposium );
+               this.symposium = new this.Symposium( this.master );
+       },
+       save: function(){
+               var l = this.$location;
+               this.symposium.$save(function(symposium){
+                       l.hashPath = symposium._id;
+               });
+       }
+};
index d4c6f06..b51a39b 100644 (file)
@@ -4,23 +4,23 @@
 
 <h1>Prijava simpozija</h1>
 
 
 <h1>Prijava simpozija</h1>
 
-<div ng:show="work._id">
-<a href="#{{work._id}}">permalink to {{work.title}}</a>
+<div ng:show="symposium._id">
+<a href="#{{symposium._id}}">permalink to {{symposium.title}}</a>
 </div>
 
 </div>
 
-   Naslov: <input name="work.title" size="60"><br/>
+   Naslov: <input name="symposium.title" size="60"><br/>
    
    Sazetak: <br/>
    
    Sazetak: <br/>
-    <textarea name="work.abstract" cols="50" rows="5"></textarea> <br/>
+    <textarea name="symposium.abstract" cols="50" rows="5"></textarea> <br/>
 
 
-<div ng:repeat="author in work.authors">
-[<a href="" ng:click="work.authors.$remove(author)">X</a>]
+<div ng:repeat="author in symposium.authors">
+[<a href="" ng:click="symposium.authors.$remove(author)">X</a>]
 <input name="author.name" ng:required>
 <input name="author.surname" ng:required>
 <input name="author.inst" >
 <input name="author.email" ng:required>
 </div>
 <input name="author.name" ng:required>
 <input name="author.surname" ng:required>
 <input name="author.inst" >
 <input name="author.email" ng:required>
 </div>
-[<a href="" ng:click="work.authors.$add()">Add another author</a>]
+[<a href="" ng:click="symposium.authors.$add()">Add another author</a>]
 
 <hr>    
 
 
 <hr>    
 
     <input type="reset" value="Reset" ng:click="reset()">
        <a href="Symposium">Novi simpozij</a>
 
     <input type="reset" value="Reset" ng:click="reset()">
        <a href="Symposium">Novi simpozij</a>
 
-<hr>
-Debug Information:
-{{$window.location.href}}
-<pre>work = {{work}}</pre>
-<pre>master = {{master}}</pre>
-
-<pre>
-$id={{$id}}
-work.$id={{work.$id}}
-work._id={{work._id}}
-</pre>
-
 </div>
 </div>