cms/app-client/app/components/notice-component.js
changeset 270 6ddc52965fb8
parent 228 a2497a2b6224
child 271 e234339fe8df
--- a/cms/app-client/app/components/notice-component.js	Thu Aug 25 18:44:50 2016 +0200
+++ b/cms/app-client/app/components/notice-component.js	Thu Aug 25 19:10:41 2016 +0200
@@ -15,13 +15,39 @@
         if(this.get('item')) {
             this.get('item').get('contributors').forEach(function(contributor) {
                 if(contributor.name) {
-                    participants.push({ name: contributor.name, role: contributor.role.split('/').pop() });
+                    var participant = participants.find(participant => participant.name === contributor.name);
+                    if(participant) {
+                        participant['role'].push(contributor.role.split('/').pop())
+                    } else {
+                        participants.push({ name: contributor.name, role: [ contributor.role.split('/').pop() ] });
+                    }    
                 }
             });
         }
         return participants;
     }),
 
+    subjects: Ember.computed('item.subjects', function() {
+        var subjects = [];
+        if(this.get('item')) {
+            this.get('subjects').forEach(function(subject) {
+                var object = {};
+                if(typeof subject === 'object') {
+                    if(subject.datatype) {
+                        object['url'] = subject.datatype;
+                    }
+                    if(subject.value) {
+                        object['name'] = subject.value;
+                    }
+                } else {
+                    object['url'] = subject;
+                }
+                subjects.push(object);
+            });
+        }
+        return subjects;
+    }),
+
     location: Ember.computed('item.geoInfo', function() {
         var location = '';
         if(this.get('item')) {