cms/app-client/app/components/notice-component.js
changeset 447 38d5789e30d0
parent 446 2a93eb9f38f5
child 502 74fba571487e
--- a/cms/app-client/app/components/notice-component.js	Thu Nov 24 19:08:36 2016 +0100
+++ b/cms/app-client/app/components/notice-component.js	Sun Nov 27 15:12:30 2016 +0100
@@ -12,43 +12,21 @@
     }),
 
     participants: Ember.computed('item.contributors', function() {
-        var participants = [];
-        if(this.get('item')) {
-            this.get('item').get('contributors').forEach(function(contributor) {
-                if(contributor.name) {
-                    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() ] });
-                    }
-                }
-            });
-        }
+        let participants = [];
+        const contributors = this.get('item.contributors') || [];
+        let identifier;
+        contributors.forEach(function(contributor) {
+          identifier = contributor.name || contributor.url;
+          var participant = participants.find(participant => participant.identifier === identifier);
+          if(participant) {
+              participant['role'].push(contributor.role.split('/').pop());
+          } else {
+              participants.push({ identifier: identifier, role: [ contributor.role.split('/').pop() ] });
+          }
+        });
         return participants;
     }),
 
-    subjects: Ember.computed('item.subjects', function() {
-        var subjects = [];
-        if(this.get('item')) {
-            this.get('item').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')) {