cms/app-client/app/models/document.js
changeset 269 9659e91242e1
parent 253 0be9770b09b4
child 270 6ddc52965fb8
--- a/cms/app-client/app/models/document.js	Wed Aug 24 18:32:41 2016 +0200
+++ b/cms/app-client/app/models/document.js	Thu Aug 25 18:44:50 2016 +0200
@@ -15,6 +15,27 @@
     contributors: DS.attr({ defaultValue: function() { return []; } }),
     geoInfo: DS.attr({ defaultValue: function() { return {}; } }),
     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() {