--- 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')) {
--- 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;
--- 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 @@
<td class="title">Sujet{{#if (if-operator item.computedSubjects.length '>' 1)}}s{{/if}}</td>
<td>
<ul>
- {{#each item.computedSubjects as |subject|}}
+ {{#each subjects as |subject|}}
<li>
{{#if subject.url}}
<a href="{{subject.url}}" target="_blank">