cms/app-client/app/serializers/transcript.js
changeset 245 c9dd78a43b07
child 255 ed05b89e3299
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/app/serializers/transcript.js	Wed Jul 20 21:08:31 2016 +0200
@@ -0,0 +1,27 @@
+import JSONAPISerializer from 'ember-data/serializers/json-api';
+
+export default JSONAPISerializer.extend({
+
+	normalizeResponse: function(store, primaryModelClass, payload, id, requestType) {
+		var annotations = [];
+		payload.annotations.forEach(function(annotation) {
+			annotations.push({
+				'content': annotation.content.data.content,
+				'translation': annotation.content.data.transl['@value'],
+				'start': annotation.begin,
+				'end': annotation.end
+			});
+		});
+        return {
+            'data': {
+	            'id': id,
+	            'type': 'transcript',
+	            'attributes': {
+	                'title': payload.meta['dc:title']['@value'],
+	                'annotations': annotations
+	            }
+	        }
+        };
+	}
+
+});