move controllers and add Symposium entity
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 2 Nov 2010 17:58:20 +0000 (18:58 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 2 Nov 2010 17:58:20 +0000 (18:58 +0100)
public/controller/conference/Work.js [new file with mode: 0644]
public/data/conference/Work.js [deleted file]
templates/conference/Symposium.html.ep [new file with mode: 0644]
templates/conference/Work.html.ep

diff --git a/public/controller/conference/Work.js b/public/controller/conference/Work.js
new file mode 100644 (file)
index 0000000..4f33038
--- /dev/null
@@ -0,0 +1,32 @@
+angular.service('conference', function($resource){
+ this.Work = $resource( '/data/conference/Work/:_id', { _id:'' } );
+}, {$inject:['$resource'],$creation:'eager'});
+
+function Work(){
+       this.master = {
+               type: '',
+               title: '',
+               abstract: '',
+               authors:[ { name:'', surname:'', inst:'', email:'' } ],
+       };
+       this.reset();
+       this.$watch('$location.hashPath', this.hash_change);
+}
+
+Work.prototype = {
+       hash_change: function() {
+               var id = this.$location.hashPath;
+               if ( id ) {
+                       this.work = this.Work.get({ _id: id });
+               }
+       },
+       reset: function() {
+               this.work = new this.Work( this.master );
+       },
+       save: function(){
+               var l = this.$location;
+               this.work.$save(function(work){
+                       l.hashPath = work._id;
+               });
+       }
+};
diff --git a/public/data/conference/Work.js b/public/data/conference/Work.js
deleted file mode 100644 (file)
index 4f33038..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-angular.service('conference', function($resource){
- this.Work = $resource( '/data/conference/Work/:_id', { _id:'' } );
-}, {$inject:['$resource'],$creation:'eager'});
-
-function Work(){
-       this.master = {
-               type: '',
-               title: '',
-               abstract: '',
-               authors:[ { name:'', surname:'', inst:'', email:'' } ],
-       };
-       this.reset();
-       this.$watch('$location.hashPath', this.hash_change);
-}
-
-Work.prototype = {
-       hash_change: function() {
-               var id = this.$location.hashPath;
-               if ( id ) {
-                       this.work = this.Work.get({ _id: id });
-               }
-       },
-       reset: function() {
-               this.work = new this.Work( this.master );
-       },
-       save: function(){
-               var l = this.$location;
-               this.work.$save(function(work){
-                       l.hashPath = work._id;
-               });
-       }
-};
diff --git a/templates/conference/Symposium.html.ep b/templates/conference/Symposium.html.ep
new file mode 100644 (file)
index 0000000..d4c6f06
--- /dev/null
@@ -0,0 +1,43 @@
+<script src="/controller/conference/Symposium.js"></script>
+
+<div ng:controller="Symposium">
+
+<h1>Prijava simpozija</h1>
+
+<div ng:show="work._id">
+<a href="#{{work._id}}">permalink to {{work.title}}</a>
+</div>
+
+   Naslov: <input name="work.title" size="60"><br/>
+   
+   Sazetak: <br/>
+    <textarea name="work.abstract" cols="50" rows="5"></textarea> <br/>
+
+<div ng:repeat="author in work.authors">
+[<a href="" ng:click="work.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>
+[<a href="" ng:click="work.authors.$add()">Add another author</a>]
+
+<hr>    
+
+    <input type="submit" value="Save" ng:click="save();" disabled="{{$invalidWidgets}}">
+    <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>
index 94aff86..fbeb4f9 100644 (file)
@@ -1,4 +1,4 @@
-<script src="/data/Work.js"></script>
+<script src="/controller/conference/Work.js"></script>
 
 <div ng:controller="Work">