added Symposium selection to Work submit page
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 2 Nov 2010 18:41:18 +0000 (19:41 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 2 Nov 2010 18:41:18 +0000 (19:41 +0100)
public/controller/conference/Work.js
templates/conference/Work.html.ep

index 4f33038..c748465 100644 (file)
@@ -1,17 +1,15 @@
-angular.service('conference', function($resource){
- this.Work = $resource( '/data/conference/Work/:_id', { _id:'' } );
-}, {$inject:['$resource'],$creation:'eager'});
-
-function Work(){
+function Work($resource){
        this.master = {
                type: '',
                title: '',
                abstract: '',
                authors:[ { name:'', surname:'', inst:'', email:'' } ],
        };
+       this.Work = $resource( '/data/conference/Work/:_id', { _id:'' } );
        this.reset();
        this.$watch('$location.hashPath', this.hash_change);
 }
+Work.$inject=['$resource'];
 
 Work.prototype = {
        hash_change: function() {
@@ -21,6 +19,7 @@ Work.prototype = {
                }
        },
        reset: function() {
+               console.debug( this.Work );
                this.work = new this.Work( this.master );
        },
        save: function(){
index fbeb4f9..dabb771 100644 (file)
@@ -1,13 +1,30 @@
 <script src="/controller/conference/Work.js"></script>
+<script>
 
-<div ng:controller="Work">
+function Symposium($resource){
+       this.Symposium = $resource( '/data/conference/Symposium/:_id', { _id:'' } );
+       this.symposiums = this.Symposium.query();
+       console.debug( this );
+}
+Symposium.$inject=['$resource'];
+
+</script>
+
+<div ng:controller="Work" ng:init="$window.$root = this">
 
 <div ng:show="work._id">
 <a href="#{{work._id}}">permalink to {{work.title}}</a>
 </div>
 
        <label>Vrsta rada:</label><br/>
-       <input type="radio" name="work.type" value="simp"> Simpozij <br/>
+       <input type="radio" name="work.type" value="simp"> Simpozij
+
+<select name="work.symposium_id" ng:show="work.type == 'simp'" ng:controller="Symposium">
+<option ng:repeat="s in symposiums" value="{{s._id}}">{{s.title}}</option>
+</select>
+
+ <br/>
+
        <input type="radio" name="work.type" value="pred"> Predavanje <br/>
        <input type="radio" name="work.type" value="poster"> Poster <br/>
        <input type="radio" name="work.type" value="round"> Okrugli stol <br/>