# HG changeset patch # User Chloe Laisne # Date 1472145041 -7200 # Node ID 6ddc52965fb809269964808ec01ea120622c05cb # Parent 9659e91242e1704d0c4f41bebc5f3edeb4d945f1 Remove participants doubles diff -r 9659e91242e1 -r 6ddc52965fb8 cms/app-client/app/components/notice-component.js --- 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')) { diff -r 9659e91242e1 -r 6ddc52965fb8 cms/app-client/app/models/document.js --- a/cms/app-client/app/models/document.js Thu Aug 25 18:44:50 2016 +0200 +++ b/cms/app-client/app/models/document.js Thu Aug 25 19:10:41 2016 +0200 @@ -17,26 +17,6 @@ mediaArray: DS.attr({ defaultValue: function() { return []; } }), subjects: DS.attr({ defaultValue: function() { return []; } }), - computedSubjects: Ember.computed('subjects', function() { - var array = []; - 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; - } - array.push(object); - }); - return array; - }), - - duration_ms: DS.attr('number', { defaultValue: function() { var self = this; diff -r 9659e91242e1 -r 6ddc52965fb8 cms/app-client/app/templates/components/notice-component.hbs --- a/cms/app-client/app/templates/components/notice-component.hbs Thu Aug 25 18:44:50 2016 +0200 +++ b/cms/app-client/app/templates/components/notice-component.hbs Thu Aug 25 19:10:41 2016 +0200 @@ -23,7 +23,7 @@ Sujet{{#if (if-operator item.computedSubjects.length '>' 1)}}s{{/if}}