cms/app-client/app/components/notice-component.js
changeset 447 38d5789e30d0
parent 446 2a93eb9f38f5
child 502 74fba571487e
equal deleted inserted replaced
446:2a93eb9f38f5 447:38d5789e30d0
    10     item: Ember.computed('model', 'player.model', function() {
    10     item: Ember.computed('model', 'player.model', function() {
    11         return this.get('model') || this.get('player').get('model');
    11         return this.get('model') || this.get('player').get('model');
    12     }),
    12     }),
    13 
    13 
    14     participants: Ember.computed('item.contributors', function() {
    14     participants: Ember.computed('item.contributors', function() {
    15         var participants = [];
    15         let participants = [];
    16         if(this.get('item')) {
    16         const contributors = this.get('item.contributors') || [];
    17             this.get('item').get('contributors').forEach(function(contributor) {
    17         let identifier;
    18                 if(contributor.name) {
    18         contributors.forEach(function(contributor) {
    19                     var participant = participants.find(participant => participant.name === contributor.name);
    19           identifier = contributor.name || contributor.url;
    20                     if(participant) {
    20           var participant = participants.find(participant => participant.identifier === identifier);
    21                         participant['role'].push(contributor.role.split('/').pop());
    21           if(participant) {
    22                     } else {
    22               participant['role'].push(contributor.role.split('/').pop());
    23                         participants.push({ name: contributor.name, role: [ contributor.role.split('/').pop() ] });
    23           } else {
    24                     }
    24               participants.push({ identifier: identifier, role: [ contributor.role.split('/').pop() ] });
    25                 }
    25           }
    26             });
    26         });
    27         }
       
    28         return participants;
    27         return participants;
    29     }),
       
    30 
       
    31     subjects: Ember.computed('item.subjects', function() {
       
    32         var subjects = [];
       
    33         if(this.get('item')) {
       
    34             this.get('item').get('subjects').forEach(function(subject) {
       
    35                 var object = {};
       
    36                 if(typeof subject === 'object') {
       
    37                     if(subject.datatype) {
       
    38                         object['url'] = subject.datatype;
       
    39                     }
       
    40                     if(subject.value) {
       
    41                         object['name'] = subject.value;
       
    42                     }
       
    43                 } else {
       
    44                     object['url'] = subject;
       
    45                 }
       
    46                 subjects.push(object);
       
    47             });
       
    48         }
       
    49         return subjects;
       
    50     }),
    28     }),
    51 
    29 
    52     location: Ember.computed('item.geoInfo', function() {
    30     location: Ember.computed('item.geoInfo', function() {
    53         var location = '';
    31         var location = '';
    54         if(this.get('item')) {
    32         if(this.get('item')) {